Jump to content

Argument help!


Timiimit

Recommended Posts

  
  
function CommandFunction ( Player , Command ) -- First you make the command function , including command parameters (player and command) 
  
outputChatBox(getPlayerName(Player),Player) -- your code goes here , this code outputs the player name to the chat box and only the player who entered the command will see it , notice the code is SERVER-SIDE  
  
end  
  
addCommandHandler("MyCommand",CommandFunction) -- then you add the Command Handler , and MyCommand will be the command you are handling , and CommandFunction is the function to handle with command , for more information enter the wiki : [url=https://wiki.multitheftauto.com/wiki/Scripting_Introduction#Creating_a_simple_command]https://wiki.multitheftauto.com/wiki/Scr ... le_command[/url] 
  

Link to comment
function myCommand (thePlayer, commandName, arg1, arg2) -- We add a function with two arguments: arg1, arg2. 
     outputChatBox("Argument 1 text: ".. tostring(arg1), thePlayer) -- We output the first argument text. 
     outputChatBox("Argument 2 text: ".. tostring(arg2), thePlayer) -- We output the second argument text. 
end -- We end the function. 
addCommandHandler("test",myCommand) -- We add the command handler "test" attached to "myCommand" function. 

Then you do like this: /test hello world and it should output "hello", "world".

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...