Template:AR/Resource functions: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "هذي الوظيفه تقوم بنسخ المود ==Syntax== <syntaxhighlight lang="lua"> resource copyResource ( resource theResource, string newResourceName [, string orga...")
 
(Replaced content with "هذي الوظيفه تقوم بنسخ المود")
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
هذي الوظيفه تقوم بنسخ المود
هذي الوظيفه تقوم بنسخ المود
==Syntax==
<syntaxhighlight lang="lua">
resource copyResource ( resource theResource, string newResourceName [, string organizationalDir ] )
</syntaxhighlight>
{{OOP||[[resource]]:copy}}
===Required Arguments===
*'''theResource:'''  االمود الذي تريد نسخه
*'''newResourceName:''' اسم المود الجديد
===Optional Arguments===
{{OptionalArg}}
* '''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.
==مثال==
<syntaxhighlight lang="lua">
-- هدا امر يقوم بنسخ المود /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)
</syntaxhighlight>

Latest revision as of 00:48, 27 September 2016

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