Skip to content

Commit

Permalink
Player nametag colors should revert to team colors when the resource …
Browse files Browse the repository at this point in the history
…is stopped
  • Loading branch information
T-MaxWiese-T committed May 11, 2024
1 parent f16577e commit 7b7ddd0
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions [gameplay]/playercolors/playercolors.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ function randomizePlayerColor(player)
end
addEventHandler("onPlayerJoin", root, randomizePlayerColor)

local function randomizeAllPlayerColors()
local function setAllPlayerColors()
for _, player in ipairs(getElementsByType("player")) do
randomizePlayerColor(player)
if eventName == "onResourceStop" then
setPlayerNametagColor(player, false)
else
randomizePlayerColor(player)
end
end
end
addEventHandler("onResourceStart", resourceRoot, randomizeAllPlayerColors)
addEventHandler("onGamemodeMapStart", root, randomizeAllPlayerColors) -- mapmanager resets player colors to white when the map ends
addEventHandler("onResourceStart", resourceRoot, setAllPlayerColors)
addEventHandler("onGamemodeMapStart", root, setAllPlayerColors) -- mapmanager resets player colors to white when the map ends
addEventHandler("onResourceStop", resourceRoot, setAllPlayerColors)

addEventHandler('onPlayerChat', root,
function(msg, type)
Expand Down

0 comments on commit 7b7ddd0

Please sign in to comment.