blake7120 Posted May 6, 2013 Posted May 6, 2013 how to make it block hex code names in game so that it automatically changes their name back to what it was when they try to change it to a hex color name.
Alexs Posted May 6, 2013 Posted May 6, 2013 addEventHandler( "onPlayerJoin", root, function() setPlayerName((getPlayerName( source )):gsub( "#%x%x%x%x%x%x", "" )) end ) addEventHandler( "onPlayerChangeNick", root, function(old, name) setPlayerName((name):gsub( "#%x%x%x%x%x%x", "" )) end )
Castillo Posted May 6, 2013 Posted May 6, 2013 addEventHandler( "onPlayerChangeNick", root, function(old, name) setPlayerName((name):gsub( "#%x%x%x%x%x%x", "" )) end ) Instead of that, you can just cancel the event if it has HEX codes in it.
blake7120 Posted May 7, 2013 Author Posted May 7, 2013 thanks but when i try to use it to make sure it works it dosent then i make my name without a space with the hex code it lets the hex code work
Castillo Posted May 7, 2013 Posted May 7, 2013 I don't really understand what do you mean, since you can't use spaces on your nick.
blake7120 Posted May 7, 2013 Author Posted May 7, 2013 try that script then put a hex name space reg name Edit: well then nvm then that means the script dosent even work
Castillo Posted May 7, 2013 Posted May 7, 2013 Try this one: addEventHandler ( "onPlayerJoin", root, function ( ) local name = getPlayerName ( source ) if name:find ( "#%x%x%x%x%x%x" ) then setPlayerName ( source, name:gsub ( "#%x%x%x%x%x%x", "" ) ) end end ) addEventHandler ( "onPlayerChangeNick", root, function ( _, new ) if new:find ( "#%x%x%x%x%x%x" ) then cancelEvent ( ) end end ) P.S: Is a server side script.
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