Jump to content

Error. Help please


bartje01

Recommended Posts

Hey guys, I'm making a /namecolor command so people can set their name color.

I've followed instructions from the wiki here.

  
function nametagColorChange ( thePlayer, commandName, r, g, b ) 
setPlayerNametagColor ( thePlayer, r, g, b ) 
outputChatBox("HINT:/namecolor  [Colorid 0-250]") 
end 
addCommandHandler ( "namecolor", nametagColorChange) 
  

WARNING: race\race_server.lua:1431: Bad argument @ 'setPlayerNametagColor'

It sends me the message: Hint:/namecolor [colorid 0-250]

So I know it must be something with this line

setPlayerNametagColor ( thePlayer, r, g, b )

So what could it be?

Thanks

Link to comment
function nametagColorChange ( thePlayer, commandName, r, g, b ) 
setPlayerNametagColor ( thePlayer, tonumber(r), tonumber(g), tonumber(b) ) 
outputChatBox("HINT:/namecolor  [Colorid 0-250]") 
end 
addCommandHandler ( "namecolor", nametagColorChange) 

Try that.

Link to comment

Are you sure? do you insert 3 values? example: 255 0 0 = red

  
function nametagColorChange ( thePlayer, commandName, r, g, b ) 
if r and g and b then 
setPlayerNametagColor ( thePlayer, tonumber(r), tonumber(g), tonumber(b) ) 
else 
outputChatBox("HINT:/namecolor  [syntax 255 0 0]", thePlayer, 255, 100, 0) 
  end 
end 
addCommandHandler ( "namecolor", nametagColorChange) 

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...