2
0
mirror of https://github.com/FWGS/xash3d-fwgs synced 2024-11-23 10:20:08 +01:00

engine: server: use sv_speedhack_kick cvar value as a number of speedhack warns before automatic kick

Thanks to @tyabus for suggestion
This commit is contained in:
Alibek Omarov 2023-05-19 04:49:14 +03:00
parent 3415185dde
commit fbd7d8f58a
3 changed files with 2 additions and 4 deletions

View File

@ -80,8 +80,6 @@ extern int SV_UPDATE_BACKUP;
#define FCL_SEND_RESOURCES BIT( 9 )
#define FCL_FORCE_UNMODIFIED BIT( 10 )
#define MAX_CLIENT_IGNORECMDTIME_WARNS 10 // just a random number (for now)
typedef enum
{
ss_dead, // no map loaded

View File

@ -59,7 +59,7 @@ CVAR_DEFINE_AUTO( sv_log_onefile, "0", FCVAR_ARCHIVE, "logs server information t
CVAR_DEFINE_AUTO( sv_trace_messages, "0", FCVAR_LATCH, "enable server usermessages tracing (good for developers)" );
CVAR_DEFINE_AUTO( sv_master_response_timeout, "4", FCVAR_ARCHIVE, "master server heartbeat response timeout in seconds" );
CVAR_DEFINE_AUTO( sv_autosave, "1", FCVAR_ARCHIVE|FCVAR_SERVER|FCVAR_PRIVILEGED, "enable autosaving" );
CVAR_DEFINE_AUTO( sv_speedhack_kick, "1", FCVAR_ARCHIVE, "enable automatic kicking players who use speedhacks" );
CVAR_DEFINE_AUTO( sv_speedhack_kick, "10", FCVAR_ARCHIVE, "number of speedhack warns before automatic kick (0 to disable)" );
// game-related cvars
CVAR_DEFINE_AUTO( mapcyclefile, "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" );

View File

@ -919,7 +919,7 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed )
cl->ignorecmdtime_warns++;
// automatically kick player
if( sv_speedhack_kick.value && cl->ignorecmdtime_warns > MAX_CLIENT_IGNORECMDTIME_WARNS )
if( sv_speedhack_kick.value && cl->ignorecmdtime_warns > sv_speedhack_kick.value )
SV_KickPlayer( cl, "Speed hacks aren't allowed on this server" );
}
cl->cmdtime += ((double)ucmd->msec / 1000.0 );