diff --git a/engine/server/server.h b/engine/server/server.h index 3b6df8971..5e136ce30 100644 --- a/engine/server/server.h +++ b/engine/server/server.h @@ -494,6 +494,7 @@ typedef struct client_s double floodprotmessage; double lastspoke; double lockedtill; + float joinobservelockeduntil; qboolean upgradewarn; // did we warn him? @@ -983,6 +984,7 @@ int SV_ModelIndex (const char *name); void SV_WriteClientdataToMessage (client_t *client, sizebuf_t *msg); void SVQW_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qboolean force, unsigned int protext); +void SV_GetNewSpawnParms(client_t *cl); void SV_SaveSpawnparms (void); void SV_SaveSpawnparmsClient(client_t *client, float *transferparms); //if transferparms, calls SetTransferParms instead, and does not modify the player. void SV_SaveLevelCache(char *savename, qboolean dontharmgame); diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index beafb7d2c..9c869b251 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -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");