Skip to content

Commit

Permalink
SV_USER: Fix /join allowing spectator to join without logging in
Browse files Browse the repository at this point in the history
When sv_login set to 1, spectators do not need to login to connect,
but can then execute /join to convert to a player, skipping the
login process.
  • Loading branch information
meag committed Jun 25, 2016
1 parent 6566be3 commit 976f82c
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/sv_user.c
Original file line number Diff line number Diff line change
Expand Up @@ -2404,6 +2404,7 @@ Set client to player mode without reconnecting
*/
static void Cmd_Join_f (void)
{
extern cvar_t sv_login;
int i;
int clients;

Expand All @@ -2423,6 +2424,12 @@ static void Cmd_Join_f (void)
return;
}

// Might have been 'not necessary' for spectator but needed for player
if (sv_client->logged <= 0 && (int)sv_login.value) {
SV_ClientPrintf (sv_client, PRINT_HIGH, "This server requires users to login. Please disconnect and reconnect as a player.\n");
return;
}

if (realtime - sv_client->connection_started < 5)
{
SV_ClientPrintf (sv_client, PRINT_HIGH, "Wait %d seconds\n", 5 - (int)(realtime - sv_client->connection_started));
Expand Down

0 comments on commit 976f82c

Please sign in to comment.