WASSIm. Posted November 16, 2014 Share Posted November 16, 2014 hi guys i have problem i hope someone help me, so i make new event on player chat and he problem if anyone put command on chat its don't work addEvent("onPlayerChatRoom", true) addEventHandler("onPlayerChatRoom", root, function (message, type) if (string.sub(message, 1, 1) == "/") then local argcmd = split(message, " ") local command = tostring(argcmd[1]:gsub("/", "", 1)) table.remove(argcmd, 1) executeCommandHandler(command, source, unpack(argcmd))) end end) Link to comment
Bonsai Posted November 18, 2014 Share Posted November 18, 2014 Unless you are using a custom chatbox, you don't need to do anything with the command. Just check for "/" as first character, and return. Link to comment
WASSIm. Posted November 19, 2014 Author Share Posted November 19, 2014 Unless you are using a custom chatbox, you don't need to do anything with the command.Just check for "/" as first character, and return. i already checked its on line 4 but don't work Link to comment
.:HyPeX:. Posted November 19, 2014 Share Posted November 19, 2014 try this if (string.sub(message,0, 1) == "/") then or this if (string.sub(message,-1) == "/") then Link to comment
WASSIm. Posted November 19, 2014 Author Share Posted November 19, 2014 checking its working but command don't work Link to comment
.:HyPeX:. Posted December 10, 2014 Share Posted December 10, 2014 Debug & check if it actually executes, and what are you executing... 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