#DaMiAnO Posted March 16, 2012 Posted March 16, 2012 Hi! What can I create 'auto-kicker', if player have color code, or '#' in Name? I don't have any idea for this.
Aibo Posted March 16, 2012 Posted March 16, 2012 function checkForColorCodes() if string.find(getPlayerName(source), "#%x%x%x%x%x%x") then kickPlayer(source, "Color codes in the name") end end addEventHandler("onPlayerJoin", root, checkForColorCodes)
#DaMiAnO Posted March 16, 2012 Author Posted March 16, 2012 function checkForColorCodes() if string.find(getPlayerName(source), "#%x%x%x%x%x%x") then kickPlayer(source, "Color codes in the name") end end addEventHandler("onPlayerJoin", root, checkForColorCodes) Not working.
Cadu12 Posted March 16, 2012 Posted March 16, 2012 Better you use OnPlayerConnect event and cancelEvent. https://wiki.multitheftauto.com/wiki/OnPlayerConnect
#DaMiAnO Posted March 16, 2012 Author Posted March 16, 2012 Error. bad argument #1 to `find` (string expected, got boolean).
Aibo Posted March 16, 2012 Posted March 16, 2012 function checkForColorCodes() if string.find(getPlayerName(source), "#%x%x%x%x%x%x") then kickPlayer(source, "Color codes in the name") end end addEventHandler("onPlayerJoin", root, checkForColorCodes) Not working. you resource must have access to kickPlayer function. Error.bad argument #1 to `find` (string expected, got boolean). and that is because you dont need getPlayerName() when using onPlayerConnect: function checkForColorCodes(name) if string.find(name, "#%x%x%x%x%x%x") then cancelEvent(true, "Color codes in the name") end end addEventHandler("onPlayerConnect", root, checkForColorCodes)
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