fix issues with join/observe spam by throttling it to no more than 1 per 2 seconds.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4730 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2014-08-24 17:16:12 +00:00
parent 0de3e18aad
commit cd690a165a
2 changed files with 26 additions and 0 deletions

View file

@ -4397,6 +4397,18 @@ void Cmd_Join_f (void)
return;
}
if (!host_client->spectator)
{
SV_ClientTPrintf(host_client, PRINT_HIGH, "You are not currently spectating.\n");
return;
}
if (host_client->joinobservelockeduntil > realtime)
{
SV_TPrintToClient(host_client, PRINT_HIGH, va("Please wait %.1g more seconds\n", host_client->joinobservelockeduntil-realtime));
return;
}
host_client->joinobservelockeduntil = realtime + 2;
if (password.string[0] && stricmp(password.string, "none"))
{
SV_ClientTPrintf(host_client, PRINT_HIGH, "This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "player", "player");
@ -4513,6 +4525,18 @@ void Cmd_Observe_f (void)
return;
}
if (host_client->spectator)
{
SV_ClientTPrintf(host_client, PRINT_HIGH, "You are already spectating.\n");
return;
}
if (host_client->joinobservelockeduntil > realtime)
{
SV_TPrintToClient(host_client, PRINT_HIGH, va("Please wait %.1g more seconds\n", host_client->joinobservelockeduntil-realtime));
return;
}
host_client->joinobservelockeduntil = realtime + 2;
if (spectator_password.string[0] && stricmp(spectator_password.string, "none"))
{
SV_ClientTPrintf(host_client, PRINT_HIGH, "This server requires a %s password. Please disconnect, set the password and reconnect as %s.\n", "spectator", "spectator");