Hey there, I'm on a command script and i wanted to make commands executable with the "!" character apart of the ususal "/"
For example:
Chatbox say:
/givemoney Shido 1
Output:
* Shido gave Shido $1
---------------------------
Chatbox say:
!givemoney Shido 1
Output:
Shido: !givemoney Shido 1
* Shido gave Shido $1
The best way I could think was making the server detect when the player uses the "!" at the start of the message and putting all the words on a table, then using the entries of the table to make an executeCommandHandler
So after a little working I got this:
addEventHandler("onPlayerChat",root,function(msg,msgtype)
if msgtype == 0 then
local s,e = string.find(msg,"%!") -- Finding the "!" char
if s == 1 then
local cmdmsg = string.gsub(msg,"!","",1) -- Extracting the "!" char from the string
local args = string.explode(cmdmsg," ") -- Function from the "Useful Functions" page on the wiki
executeCommandHandler(args[1],source,args[2],args[3],etc...) -- Finding a way to put all the arguments......
end
end
end)
Is there a best way to get this working? or if i'm in the right way, is there an appropiate way to put the arguments on the execute function? (because i know the args[2],args[3],etc... is a really bad way)