Jump to content

HELP!


Nerses

Recommended Posts

I think this is what you mean. This sets the players name red when they join the server.

function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

Link to comment
I think this is what you mean. This sets the players name red when they join the server.
function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

Well that HTML colors to avoid. And where you need it to write/edit?

Link to comment

You just have to put it in any server-side file.

I think this is what you mean. This sets the players name red when they join the server.
function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

Well that HTML colors to avoid. And where you need it to write/edit?

These actually aren't HTML color codes. HTML mostly uses HEX (#ff0000, etc...) and this is RGB.

Link to comment
You just have to put it in any server-side file.
I think this is what you mean. This sets the players name red when they join the server.
function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

Well that HTML colors to avoid. And where you need it to write/edit?

These actually aren't HTML color codes. HTML mostly uses HEX (#ff0000, etc...) and this is RGB.

I had in mind. I created a new lua and meta file dumped to the server and it does not work

Link to comment
I think this is what you mean. This sets the players name red when they join the server.
function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

You may want to rethinking before you even try to help others with such code, you didn't attach the event to an element also this event doesn't have any parameters.

Link to comment
I think this is what you mean. This sets the players name red when they join the server.
function nametagColorChange ( thePlayer,  r, g, b ) 
    setPlayerNametagColor ( thePlayer, 255, 0, 0 ) 
end 
  
addEventHandler ( "onPlayerJoin", nametagColorChange ) 

You may want to rethinking before you even try to help others with such code, you didn't attach the event to an element also this event doesn't have any parameters.

help

Link to comment

Try using this:

addEventHandler ( "onPlayerJoin", root, function ( ) 
    updatePlayerNick ( source, getPlayerName ( source ) ) 
end ) 
  
addEventHandler ( "onClientPlayerChangeNick", root, function ( _, new ) 
    updatePlayerNick ( source, new ) 
end ) 
  
  
function updatePlayerNick ( source, n ) 
    local n = tostring ( n ):gsub ( " #%x%x%x%x%x%x", "" ) 
    if ( n == "" ) then 
        n = "User"..math.random(50) 
    end 
    setPlayerName ( source, n ) 
end 

Link to comment
Try using this:
addEventHandler ( "onPlayerJoin", root, function ( ) 
    updatePlayerNick ( source, getPlayerName ( source ) ) 
end ) 
  
addEventHandler ( "onClientPlayerChangeNick", root, function ( _, new ) 
    updatePlayerNick ( source, new ) 
end ) 
  
  
function updatePlayerNick ( source, n ) 
    local n = tostring ( n ):gsub ( " #%x%x%x%x%x%x", "" ) 
    if ( n == "" ) then 
        n = "User"..math.random(50) 
    end 
    setPlayerName ( source, n ) 
end 

where you want it all to write? or instead of what

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