blake7120 Posted May 6, 2013 Share 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. Link to comment
Alexs Posted May 6, 2013 Share 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 ) Link to comment
Castillo Posted May 6, 2013 Share 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. Link to comment
blake7120 Posted May 7, 2013 Author Share 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 Link to comment
Castillo Posted May 7, 2013 Share Posted May 7, 2013 I don't really understand what do you mean, since you can't use spaces on your nick. Link to comment
blake7120 Posted May 7, 2013 Author Share 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 Link to comment
Castillo Posted May 7, 2013 Share 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. Link to comment
panos144 Posted May 7, 2013 Share Posted May 7, 2013 (edited) Deleted Edited May 10, 2013 by Guest Link to comment
blake7120 Posted May 9, 2013 Author Share Posted May 9, 2013 Thanks the script worked 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