• Random color for job color, not working for text.
    6 replies, posted
Using DarkRP and have the job color set to random. When the server boots, it changes to a random color. It works fine for how it shows up in the HUD but the chat text for them is always a weird lime green color instead of whatever random color is set for the job. Is there any way around this?
Seems like something is overwriting the ChatText hook.
Could you paste the team code from shared.lua e.g. TEAM_MYTEAM = AddExtraTeam(........
This is exactly how I have it. [lua] colorOne = math.random(255) colorTwo = math.random(255) colorThree = math.random(255) TEAM_MOD = AddExtraTeam("Mod", Color(colorOne, colorTwo, colorThree, 255), "models/player/combine_soldier_prisonguard.mdl",[[ You're a mod. Duh. Don't play as this character. Only enforce rules.]], {"admin_keypad_cracker"}, "mod" , 0, 42, 2 , false, false) [/lua] Right now the random color is set to a redish color in the hud, but as said before the chat text = barf green.
Okay, the reason this happens NnyAskC is because the client and server are both executing your code here and coming up with different colors as a result of your math.random library calls. One solution could be to setup this team on the server and network the resulting color to the clients when they join ready to setup the team. I hope that makes sense to you. If not host a multiplayer game and you will see that the hud color changes everytime you type retry in console but the chat color is still the same unless you disconnect and shutdown the server completely, because the chat color is coming from the servers team information.
I understand what you mean, not sure how to go about doing it but I'll give it a shot. Can't learn if you don't try. Thank you for your help! ^_^
I think you could make a timer to update the colors that are being called so it refreshes the value that you are trying to call from 1 to 255. I'm assuming you could go: [lua] timer.Create("RefreshClrValues", 1, 0, function() colorOne = math.random(255) colorTwo = math.random(255) colorThree = math.random(255) end) [/lua]
Sorry, you need to Log In to post a reply to this thread.