Nerses Posted May 27, 2014 Share Posted May 27, 2014 How to make that when the man went on a server with color nick, that it was not? html code that is displayed before the nick is. Link to comment
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 so when the man went on a server with color nick, that it was not? html code that is displayed before the nick is. Link to comment
mint3d Posted May 27, 2014 Share Posted May 27, 2014 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
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 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
mint3d Posted May 27, 2014 Share Posted May 27, 2014 To edit the colours edit this 255, 0, 0 Link to comment
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 To edit the colours edit this 255, 0, 0 I understand but I ask himself where this code to write? Link to comment
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 To edit the colours edit this 255, 0, 0 ???? Link to comment
xXMADEXx Posted May 27, 2014 Share Posted May 27, 2014 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
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 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
TAPL Posted May 27, 2014 Share Posted May 27, 2014 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
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 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
TAPL Posted May 27, 2014 Share Posted May 27, 2014 help Write in English so people here can understand what you're asking for, because i didn't get any shit. Link to comment
Nerses Posted May 27, 2014 Author Share Posted May 27, 2014 help Write in English so people here can understand what you're asking for, because i didn't get any :~. for example a man went to #fff0f... and so on and so his nickname was white as at all and not a colour Link to comment
xXMADEXx Posted May 27, 2014 Share Posted May 27, 2014 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
Nerses Posted May 28, 2014 Author Share Posted May 28, 2014 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
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