mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-31 05:00:35 +00:00
Removed the old timecheat protection and added a system that adjusts
time to what the server thinks is correct when too much inaccuracy builds up. This nearly eliminates all speed cheating, both normal and reverse, except for a brief burst before the protection kicks in. Might need cleaning up/tweaking.
This commit is contained in:
parent
2f98af35b8
commit
7f4cd09e9d
3 changed files with 18 additions and 48 deletions
|
@ -555,9 +555,8 @@ void ClientReliableWrite_SZ(client_t *cl, void *data, int len);
|
|||
|
||||
void Cvar_Info (struct cvar_s *var);
|
||||
|
||||
extern struct cvar_s *sv_timekick;
|
||||
extern struct cvar_s *sv_timekick_fuzz;
|
||||
extern struct cvar_s *sv_timekick_interval;
|
||||
extern struct cvar_s *sv_timecheck_fuzz;
|
||||
extern struct cvar_s *sv_timecheck_decay;
|
||||
extern struct cvar_s *sv_maxrate;
|
||||
extern struct cvar_s *sv_timestamps;
|
||||
extern struct cvar_s *sv_timefmt;
|
||||
|
|
|
@ -2041,13 +2041,10 @@ SV_InitLocal (void)
|
|||
"Sets the water friction value");
|
||||
sv_aim = Cvar_Get ("sv_aim", "2", CVAR_NONE, NULL,
|
||||
"Sets the value for auto-aiming leniency");
|
||||
sv_timekick = Cvar_Get ("sv_timekick", "3", CVAR_SERVERINFO, Cvar_Info,
|
||||
"Time cheat protection");
|
||||
sv_timekick_fuzz = Cvar_Get ("sv_timekick_fuzz", "30", CVAR_NONE, NULL,
|
||||
"Time cheat \"fuzz factor\" in milliseconds");
|
||||
sv_timekick_interval = Cvar_Get ("sv_timekick_interval", "30", CVAR_NONE,
|
||||
NULL, "Time cheat check interval in "
|
||||
"seconds");
|
||||
sv_timecheck_fuzz = Cvar_Get ("sv_timecheck_fuzz", "250", CVAR_NONE, NULL,
|
||||
"Milliseconds of tolerance before time cheat throttling kicks in.");
|
||||
sv_timecheck_decay = Cvar_Get ("sv_timecheck_decay", "2", CVAR_NONE,
|
||||
NULL, "Rate at which time inaccuracies are \"forgiven\".");
|
||||
sv_minqfversion = Cvar_Get ("sv_minqfversion", "0", CVAR_SERVERINFO,
|
||||
Cvar_Info, "Minimum QF version on client");
|
||||
sv_maxrate = Cvar_Get ("sv_maxrate", "10000", CVAR_SERVERINFO, Cvar_Info,
|
||||
|
|
|
@ -84,9 +84,8 @@ cvar_t *sv_kickfake;
|
|||
|
||||
cvar_t *sv_mapcheck;
|
||||
|
||||
cvar_t *sv_timekick;
|
||||
cvar_t *sv_timekick_fuzz;
|
||||
cvar_t *sv_timekick_interval;
|
||||
cvar_t *sv_timecheck_fuzz;
|
||||
cvar_t *sv_timecheck_decay;
|
||||
|
||||
void SV_FullClientUpdateToClient (client_t *client, client_t *cl);
|
||||
|
||||
|
@ -1418,45 +1417,20 @@ SV_PreRunCmd (void)
|
|||
void
|
||||
SV_RunCmd (usercmd_t *ucmd, qboolean inside)
|
||||
{
|
||||
double tmp_time;
|
||||
int oldmsec, tmp_time1, i, n;
|
||||
int oldmsec, passed, i, n;
|
||||
edict_t *ent;
|
||||
|
||||
if (!inside) { // prevent infinite loop
|
||||
host_client->msecs += ucmd->msec;
|
||||
|
||||
if (!host_client->spectator && sv_timekick->int_val
|
||||
&& ((tmp_time = realtime - host_client->last_check) >=
|
||||
sv_timekick_interval->value)) {
|
||||
|
||||
tmp_time1 = tmp_time * (1000 + sv_timekick_fuzz->value);
|
||||
|
||||
if ((host_client->last_check != -1) // don't do it if new player
|
||||
&& (host_client->msecs > tmp_time1)) {
|
||||
host_client->msec_cheating++;
|
||||
SV_BroadcastPrintf (PRINT_HIGH, "%s thinks there are %d ms "
|
||||
"in %d seconds (Strike %d/%d)\n",
|
||||
host_client->name, host_client->msecs,
|
||||
(int) tmp_time, host_client->msec_cheating,
|
||||
sv_timekick->int_val);
|
||||
|
||||
if (host_client->msec_cheating >= sv_timekick->int_val) {
|
||||
SV_BroadcastPrintf (PRINT_HIGH, "Strike %d for %s!!\n",
|
||||
host_client->msec_cheating,
|
||||
host_client->name);
|
||||
SV_BroadcastPrintf
|
||||
(PRINT_HIGH, "Please see "
|
||||
"http://www.quakeforge.net/speed_cheat.php for "
|
||||
"information on QuakeForge's time cheat protection. "
|
||||
"That page explains how some may be cheating "
|
||||
"without knowing it.\n");
|
||||
SV_DropClient (host_client);
|
||||
if (!inside) {
|
||||
if (host_client->last_check != -1.0) {
|
||||
passed = (int)((realtime - host_client->last_check)*1000.0);
|
||||
host_client->msecs += passed - ucmd->msec;
|
||||
host_client->msecs -= host_client->msecs >= 0 ? sv_timecheck_decay->int_val : -sv_timecheck_decay->int_val;
|
||||
if (abs(host_client->msecs) > sv_timecheck_fuzz->int_val) {
|
||||
host_client->msecs = bound (-sv_timecheck_fuzz->int_val, host_client->msecs, sv_timecheck_fuzz->int_val);
|
||||
ucmd->msec = passed;
|
||||
}
|
||||
}
|
||||
|
||||
host_client->msecs = 0;
|
||||
host_client->last_check = realtime;
|
||||
}
|
||||
host_client->last_check = realtime;
|
||||
}
|
||||
|
||||
cmd = *ucmd;
|
||||
|
|
Loading…
Reference in a new issue