Browse Source

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

Thanks to @tyabus for suggestion
pull/2/head
Alibek Omarov 2 years ago
parent
commit
fbd7d8f58a
  1. 2
      engine/server/server.h
  2. 2
      engine/server/sv_main.c
  3. 2
      engine/server/sv_pmove.c

2
engine/server/server.h

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

2
engine/server/sv_main.c

@ -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_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_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_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 // game-related cvars
CVAR_DEFINE_AUTO( mapcyclefile, "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" ); CVAR_DEFINE_AUTO( mapcyclefile, "mapcycle.txt", 0, "name of multiplayer map cycle configuration file" );

2
engine/server/sv_pmove.c

@ -919,7 +919,7 @@ void SV_RunCmd( sv_client_t *cl, usercmd_t *ucmd, int random_seed )
cl->ignorecmdtime_warns++; cl->ignorecmdtime_warns++;
// automatically kick player // 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" ); SV_KickPlayer( cl, "Speed hacks aren't allowed on this server" );
} }
cl->cmdtime += ((double)ucmd->msec / 1000.0 ); cl->cmdtime += ((double)ucmd->msec / 1000.0 );

Loading…
Cancel
Save