Hi! I wasn’t able to find an example on how to use team.SetColor in darkrp.
I was wondering if any of you guys can provide one?
After you declare the job, call team.SetColor(TEAM_ENUM, Color(255, 255, 255)).
local function UnderCover( ply, text, team )
if string.sub( text, 1, 5 ) == "!hide" then
local PlyTeam = ply:Team()
ply:ChatPrint("Hello "..PlyTeam)
if PlyTeam == 29 then
ply:ChatPrint("Ran")
team.SetColor(PlyTeam,Color(255,255,255))
end
end
end
hook.Add("PlayerSay", "UnderCover", UnderCover )
Am I not declaring the job correctly?
Yeah you are but, is even team.SetColor networked?
I think you’ve got to send it to the client or something after that so it updates, i’m not sure tho, but according to the code on the thing, i don’t see it being networked. You can try doing so.
Source
I forgot to mention the error i was getting, I don’t know if it matters.
lua:53: attempt to index local ‘team’ (a boolean value)
Because you’re overriding the Team library with the 3rd argument from the function. Rename it to something else like, isTeam instead.
Ok, I renamed the var isteam, it throws no errors, but does nothing to team color. I wouldnt know how to proceed.
Edit: The name in chat changes color, the scoreboard does not.
Sorry, yeah all set, I used sendlua, thanks. To set the job name, I used a timer for 3 seconds, but thats not working.
timer.Simple(3, function()
ply:ConCommand("say /job Thief")
end)
Edit: I’m dumb, scoreboard not using getdarkrpvar. Thanks for your help!
You shouldn’t use SendLua nor ConCommand for that: use net messages.
Sorry, lol I ended up using updateJob() anyways!