-Doc- Posted July 21, 2015 Posted July 21, 2015 How it's possible to make more than one command at this script.I can use only with single commands /cd or /rules. But i wanna for example /mute blue and its not working. Here is the code. if string.sub(first,1,1) == "/" then local command = string.sub(first,2,string.len(first)) executeCommandHandler( command, thePlayer ) My scripting skills
Dealman Posted July 21, 2015 Posted July 21, 2015 I really don't understand what it is you're asking for here, you want a command to mute a specific player? If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Gr0x Posted July 21, 2015 Posted July 21, 2015 I really don't understand what it is you're asking for here, you want a command to mute a specific player? thats an example man! thats a question man!
-Doc- Posted July 21, 2015 Author Posted July 21, 2015 With that command i can use only single function like /cd I wanna make to use more functions like EXAMPLE /start hud or /mute blue...Help? My scripting skills
Dealman Posted July 21, 2015 Posted July 21, 2015 Just use addCommandHandler, no need to do whatever you tried to do. Use the examples, it's really simple. playerSource: The player who triggered the command. If not triggered by a player (e.g. by admin), this will be false.commandName: The name of the command triggered. This is useful if multiple commands go through one function. arg1, arg2, ...: Each word after command name in the original command is passed here in a seperate variable. If there is no value for an argument, its variable will contain nil. You can deal with a variable number of arguments using the vararg expression, as shown in Server Example 2 below. Quick example; function ExampleCode(theCMD, arg1) if(type(arg1) == "string") then outputChatBox("Hello "...arg1) -- /Hello World will output "Hello World". /Hello Space will output "Hello Space". end end addCommandHandler("Hello", ExampleCode) If I help you in a thread and you need further assistance, please don't PM me - use the thread you created instead. This way everyone on the forum can take advantage of it.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now