From 5047fec925414f93ab2c8b21e4cc3da0aed106db Mon Sep 17 00:00:00 2001 From: FruitieX Date: Sat, 23 Oct 2010 16:25:56 +0300 Subject: [PATCH] reimplement the cts kill delay from fruitiex/rankings-recode. This is a feature that stops cheating on some maps, by running back to the start line and starting out with more speed than you otherwise would --- defaultXonotic.cfg | 1 + qcsrc/server/cl_client.qc | 16 ++++++++++++++++ qcsrc/server/race.qc | 5 +++++ 3 files changed, 22 insertions(+) diff --git a/defaultXonotic.cfg b/defaultXonotic.cfg index e9cd073be1..55499628c7 100644 --- a/defaultXonotic.cfg +++ b/defaultXonotic.cfg @@ -626,6 +626,7 @@ set g_rc_respawn_delay 0 set g_cts_respawn_waves 0 set g_cts_respawn_delay 0 set g_cts_selfdamage 1 "0 = disable all selfdamage and falldamage in cts" +set g_cts_finish_kill_delay 10 "prevent cheating by running back to the start line, and starting out with more speed than otherwise possible" // overtime seta timelimit_overtime 2 "duration in minutes of one added overtime, added to the timelimit" diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index df6c8d4b2a..e618b565bd 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -1308,6 +1308,22 @@ void ClientKill (void) ClientKill_TeamChange(0); } +void CTS_ClientKill_Think (void) +{ + self = self.owner; // set self to the player to be killed + sprint(self, "^1You were killed in order to prevent cheating!"); + ClientKill_Now(); +} + +void CTS_ClientKill (float t) // silent version of ClientKill +{ + entity e; + spawn(e); + e.owner = self; + e.think = CTS_ClientKill_Think; + e.nextthink = t; +} + void DoTeamChange(float destteam) { float t, c0; diff --git a/qcsrc/server/race.qc b/qcsrc/server/race.qc index 2f15889819..2de74ab523 100644 --- a/qcsrc/server/race.qc +++ b/qcsrc/server/race.qc @@ -441,7 +441,12 @@ void race_SendTime(entity e, float cp, float t, float tvalid) if(t != 0) { if(cp == race_timed_checkpoint) + { race_SetTime(e, t, recordtime); + if(g_cts && cvar("g_cts_finish_kill_delay")) + { + CTS_ClientKill(cvar("g_cts_finish_kill_delay")); + } if(t < recordtime || recordtime == 0) { -- 2.39.2