From 0077ae5823537829e7c77fd617b1790c3eaf1f51 Mon Sep 17 00:00:00 2001 From: Des - Date: Sun, 1 Sep 2024 11:07:16 +0000 Subject: [PATCH] Add cl_hook_race_pb to run on client when they set a new personal best time --- gamemodes-client.cfg | 6 ++++++ qcsrc/common/gamemodes/gamemode/race/cl_race.qc | 5 +++++ 2 files changed, 11 insertions(+) diff --git a/gamemodes-client.cfg b/gamemodes-client.cfg index c63bba5a7..1648daca5 100644 --- a/gamemodes-client.cfg +++ b/gamemodes-client.cfg @@ -39,3 +39,9 @@ alias cl_hook_gamestart_surv alias cl_hook_gameend alias cl_hook_shutdown alias cl_hook_activeweapon +// called on client personal best set +// $1 new pb time, +// $2 old pb time, +// $3 how much time the pb improved by +// $4 new rank# on the leaderboard +alias cl_hook_race_pb diff --git a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc index d0c3c0372..f02905d60 100644 --- a/qcsrc/common/gamemodes/gamemode/race/cl_race.qc +++ b/qcsrc/common/gamemodes/gamemode/race/cl_race.qc @@ -68,6 +68,11 @@ void HUD_Mod_Race(vector pos, vector mySize) f &= ~1; cvar_set("cl_autodemo_delete", ftos(f)); // don't delete demo with new record! } + localcmd("\ncl_hook_race_pb \"", + TIME_ENCODED_TOSTRING(score, false), "\" \"", + TIME_ENCODED_TOSTRING(t, false), "\" \"", + (t ? TIME_ENCODED_TOSTRING(t-score, false) : "0"), "\" \"", + sprintf("%d", race_myrank), "\"\n"); } if(t != crecordtime_prev) { -- 2.39.2