Skip to content

Commit 976f82c

Browse files
committed
SV_USER: Fix /join allowing spectator to join without logging in
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.
1 parent 6566be3 commit 976f82c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/sv_user.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,7 @@ Set client to player mode without reconnecting
24042404
*/
24052405
static void Cmd_Join_f (void)
24062406
{
2407+
extern cvar_t sv_login;
24072408
int i;
24082409
int clients;
24092410

@@ -2423,6 +2424,12 @@ static void Cmd_Join_f (void)
24232424
return;
24242425
}
24252426

2427+
// Might have been 'not necessary' for spectator but needed for player
2428+
if (sv_client->logged <= 0 && (int)sv_login.value) {
2429+
SV_ClientPrintf (sv_client, PRINT_HIGH, "This server requires users to login. Please disconnect and reconnect as a player.\n");
2430+
return;
2431+
}
2432+
24262433
if (realtime - sv_client->connection_started < 5)
24272434
{
24282435
SV_ClientPrintf (sv_client, PRINT_HIGH, "Wait %d seconds\n", 5 - (int)(realtime - sv_client->connection_started));

0 commit comments

Comments
 (0)