sQuirreL6 Posted July 19, 2013 Share Posted July 19, 2013 I want to make if player types a command like /givecar 255 255 255 to add arguments but not only for givecar but for all command even if command does not have arguments if (string.find(guiGetText(chatLabel), "/")) then local cleanCommand = string.gsub(guiGetText(chatLabel), "/", "") local param1, param2, param3, param4 = false if string.find(guiGetText(chatLabel), " ") then param1, param2, param3, param4 = split(cleanCommand, " ") end triggerServerEvent("executeCommand", localPlayer, cleanCommand, param1, param2, param3, param4) Execute like this: executeCommandHandler(command, source, p1, p2, p3, p4) Link to comment
Castillo Posted July 20, 2013 Share Posted July 20, 2013 if ( string.find ( guiGetText ( chatLabel ), "/" ) ) then local cleanCommand = string.gsub ( guiGetText ( chatLabel ), "/", "" ) local params = { } if string.find ( guiGetText ( chatLabel ), " " ) then params = split ( cleanCommand, " " ) end triggerServerEvent ( "executeCommand", localPlayer, cleanCommand, unpack ( params ) ) Try that. Link to comment
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