Template:AR/Resource functions

From Multi Theft Auto: Wiki
Revision as of 00:44, 27 September 2016 by Ahmed Ly (talk | contribs) (Created page with "هذي الوظيفه تقوم بنسخ المود ==Syntax== <syntaxhighlight lang="lua"> resource copyResource ( resource theResource, string newResourceName [, string orga...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

هذي الوظيفه تقوم بنسخ المود

Syntax

resource copyResource ( resource theResource, string newResourceName [, string organizationalDir ] )

OOP Syntax Help! I don't understand this!

Method: resource:copy(...)


Required Arguments

  • theResource: االمود الذي تريد نسخه
  • newResourceName: اسم المود الجديد

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • organizationalDir: A string containing the path where the resource should be copied to (e.g. "[gamemodes]/[amx]").

Returns

Returns the resource element of the copy. Returns false if the arguments are incorrect.


مثال

-- هدا امر يقوم بنسخ المود /backupresource [resourcename]
function backupResource (player,command,resourcetobackup) 
  if (resourcetobackup) and (getResourceFromName(resourcetobackup)) then 
    copyResource (getResourceFromName(resourcetobackup),resourcetobackup .. "_backup") 
    outputChatBox ("Resource " .. resourcetobackup .. " succesfully backed up!",player,255,0,0,false) 
  else -- if it isn't exist
    outputChatBox ("Resource can't be backed up! (don't forget the parameters!)",player,255,0,0,false) 
  end
end
addCommandHandler ("backupresource",backupResouce)