Enargy, Posted September 30, 2013 Posted September 30, 2013 Hi again, I make the point about this basic function, but now I want to place a number after the command. example: /<cmd> <number> --- '<number>' would be a specific number function testing() outputChatBox("Hello everybody!", 0, 0, 200, true) end addCommandHandler("hi", testing) Someone can help me. - Inactivo.
Dealman Posted September 30, 2013 Posted September 30, 2013 This should work, but I might have missed something since I didn't test it. Included an example for several arguments if you'd want that. function testing(cmd, number) --Example: /hi 10 would output "Hi 10" outputChatBox("Hi "..tostring(number), 0, 0, 200, true) end addCommandHandler("hi", testing) -- For Server-Side you might have to add in the source as well, (source, cmd, ...). function testing(cmd, ...) local numbers = table.concat({...}, " ") ArrayString = split(numbers, " ") outputChatBox("Hi "..ArrayString[1].." and "..ArrayString[2], 0, 0, 200, true) --Example: /hi 10 20 would output "Hi 10 and 20" end addCommandHandler("hi", testing) 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