Dardex Posted March 16, 2014 Share Posted March 16, 2014 Hello! How can I block people who use color codes on their name when they want to register on server? function RegisterHandler ( player, username, password) local acc = addAccount(username,password) if acc then logIn(player,acc,password) outputChatBox("You've been successfully registred!",player,0,125,0) triggerClientEvent ( "CloseShit", getRootElement()) else outputChatBox("Hint:Do not use name colorcodes",player,125,0,0) outputChatBox("Username is already taken.",player,125,0,0) end end addEvent( "RegisterSubmit", true ) addEventHandler( "RegisterSubmit", getRootElement(), RegisterHandler ) this is registration function Link to comment
Castillo Posted March 16, 2014 Share Posted March 16, 2014 if username:find ( "#%x%x%x%x%x%x" ) then outputChatBox ( "You can't use HEX codes in the account name.", player, 255, 0, 0 ) return end Link to comment
JR10 Posted March 16, 2014 Share Posted March 16, 2014 You can use this to check if a name has color codes: if (string.find(name, '#%x%x%x%x%x%x')) then To remove color codes: string.gsub(name, '#%x%x%x%x%x%x', '') Link to comment
Dardex Posted March 16, 2014 Author Share Posted March 16, 2014 should I add this on registration function? Link to comment
Dardex Posted March 16, 2014 Author Share Posted March 16, 2014 Nvm worked ty SolidSnake/JR10 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