X-Git-Url: https://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fanticheat.qc;h=284e72be94602cbb1f5ea85585f015d24b6e6040;hb=d8dc92d9f645bff00249e5c0ad915095542d895d;hp=1da6ad3ec6732043e3ad6abcd755b5d2993990e5;hpb=0a5f730751cf4a7f6ce555ef920fe9fdcd8e59ac;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/anticheat.qc b/qcsrc/server/anticheat.qc index 1da6ad3ec..284e72be9 100644 --- a/qcsrc/server/anticheat.qc +++ b/qcsrc/server/anticheat.qc @@ -1,3 +1,5 @@ +.float anticheat_jointime; + void mean_accumulate(entity e, .float a, .float c, float mean, float value, float weight) { if(weight == 0) @@ -67,14 +69,14 @@ void anticheat_physics() { if(time < self.anticheat_div0_evade_offset) self.anticheat_div0_evade_v_angle = self.v_angle; - MEAN_ACCUMULATE(anticheat_div0_evade, 1 - (self.anticheat_div0_evade_forward_initial * v_forward), 1); + MEAN_ACCUMULATE(anticheat_div0_evade, 0.5 - 0.5 * (self.anticheat_div0_evade_forward_initial * v_forward), 1); } - MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), max(0, sys_frametime - frametime)); + MEAN_ACCUMULATE(anticheat_div0_strafebot_old, movement_oddity(self.movement, self.anticheat_div0_strafebot_movement_prev), 1); self.anticheat_div0_strafebot_movement_prev = self.movement; if(vlen(self.anticheat_div0_strafebot_forward_prev)) - MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 1 - (self.anticheat_div0_strafebot_forward_prev * v_forward), max(0, sys_frametime - frametime)); + MEAN_ACCUMULATE(anticheat_div0_strafebot_new, 0.5 - 0.5 * (self.anticheat_div0_strafebot_forward_prev * v_forward), 1); self.anticheat_div0_strafebot_forward_prev = v_forward; // generic speedhack detection: correlate anticheat_speedhack_movetime (UPDATED BEFORE THIS) and server time @@ -88,7 +90,7 @@ void anticheat_physics() self.anticheat_speedhack_offset = f; else { - MEAN_ACCUMULATE(anticheat_speedhack, fabs(f - self.anticheat_speedhack_offset), 1); + MEAN_ACCUMULATE(anticheat_speedhack, max(0, f - self.anticheat_speedhack_offset), 1); self.anticheat_speedhack_offset += (f - self.anticheat_speedhack_offset) * frametime * 0.1; } @@ -151,14 +153,26 @@ void anticheat_prethink() self.anticheat_div0_evade_offset = 0; } +string anticheat_display(float f, float mi, float ma) +{ + string s; + s = ftos(f); + if(f <= mi) + return strcat(s, ":N"); + if(f >= ma) + return strcat(s, ":Y"); + return strcat(s, ":-"); +} + void anticheat_report() { if(!autocvar_sv_eventlog) return; + GameLogEcho(strcat(":anticheat:_time:", ftos(self.playerid), ":", ftos(servertime - self.anticheat_jointime))); GameLogEcho(strcat(":anticheat:speedhack:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_speedhack)))); GameLogEcho(strcat(":anticheat:div0_strafebot_old:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_strafebot_old)))); GameLogEcho(strcat(":anticheat:div0_strafebot_new:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_strafebot_new)))); - GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", ftos(MEAN_EVALUATE(anticheat_div0_evade)))); + GameLogEcho(strcat(":anticheat:div0_evade:", ftos(self.playerid), ":", anticheat_display(MEAN_EVALUATE(anticheat_div0_evade), 0.15, 0.3))); } void anticheat_serverframe() @@ -169,6 +183,7 @@ void anticheat_serverframe() void anticheat_init() { self.anticheat_speedhack_offset = 0; + self.anticheat_jointime = servertime; } void anticheat_shutdown()