From d9cb0f8411702e9b9debd7beb0b821699ea40139 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 14 Jul 2020 05:37:36 +1000 Subject: [PATCH] Set the player's colour each frame on the server side so the scoreboard reflects their status (hunter colour is hidden until the game is stopped at the end of a round) --- .../gamemodes/gamemode/survival/sv_survival.qc | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc index b7516d8d2..47fcca7a1 100644 --- a/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc +++ b/qcsrc/common/gamemodes/gamemode/survival/sv_survival.qc @@ -223,6 +223,21 @@ MUTATOR_HOOKFUNCTION(surv, ClientObituary) M_ARGV(5, bool) = true; // anonymous attacker } +MUTATOR_HOOKFUNCTION(surv, PlayerPreThink) +{ + entity player = M_ARGV(0, entity); + + if(IS_PLAYER(player)) + { + // update the scoreboard colour display to out the real killer at the end of the round + // running this every frame to avoid cheats + int plcolor = SURV_COLOR_PREY; + if(player.survival_status == SURV_STATUS_HUNTER && game_stopped) + plcolor = SURV_COLOR_HUNTER; + setcolor(player, plcolor); + } +} + MUTATOR_HOOKFUNCTION(surv, PlayerSpawn) { entity player = M_ARGV(0, entity); -- 2.39.2