Jump to content

Color = kick.


#DaMiAnO

Recommended Posts

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) 

Link to comment
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) 

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...