X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fcommand%2Fcmd.qc;h=e613599119a967fe7762d39f78dbf02150a3fc8e;hb=a491650510dce3f774cce457ebf15ddcafcf393f;hp=e23f9bc9892a70ddf649f69ee7f7725b9bc66035;hpb=c039d054a46888048d214000273ccfc63e4611b6;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index e23f9bc98..e61359911 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -30,8 +30,8 @@ #include -#include -#include +#include +#include #include #include @@ -159,33 +159,19 @@ void ClientCommand_mv_getpicture(entity caller, float request, float argc) // i } } +bool spawnAllowed(entity this); +void LeaveSpectatorMode(entity this); void ClientCommand_join(entity caller, float request) { switch (request) { case CMD_REQUEST_COMMAND: { - if (IS_CLIENT(caller)) - { - if (!IS_PLAYER(caller) && !lockteams && !gameover) - { - if (caller.caplayer) return; - if (nJoinAllowed(caller, caller)) - { - if (autocvar_g_campaign) campaign_bots_may_start = true; - TRANSMUTE(Player, caller); - PlayerScore_Clear(caller); - Kill_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CPID_PREVENT_JOIN); - Send_Notification(NOTIF_ALL, NULL, MSG_INFO, ((teamplay && caller.team != -1) ? APP_TEAM_ENT(caller, INFO_JOIN_PLAY_TEAM) : INFO_JOIN_PLAY), caller.netname); - PutClientInServer(caller); - } - else - { - // player may not join because of g_maxplayers is set - Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_JOIN_PREVENT); - } - } - } + if (!gameover) + if (IS_CLIENT(caller) && !IS_PLAYER(caller)) + if (spawnAllowed(caller)) + LeaveSpectatorMode(caller); + return; // never fall through to usage } @@ -326,6 +312,7 @@ void ClientCommand_say_team(entity caller, float request, float argc, string com } } +.int selectedteam; void ClientCommand_selectteam(entity caller, float request, float argc) { switch (request) @@ -363,7 +350,7 @@ void ClientCommand_selectteam(entity caller, float request, float argc) if (selection) { - if (caller.team == selection && !IS_DEAD(caller)) + if (caller.team == selection && selection != -1 && !IS_DEAD(caller)) { sprint(caller, "^7You already are on that team.\n"); } @@ -385,6 +372,8 @@ void ClientCommand_selectteam(entity caller, float request, float argc) } ClientKill_TeamChange(caller, selection); } + if(!IS_PLAYER(caller)) + caller.team_selected = true; // avoids asking again for team selection on join } } else