From: terencehill Date: Tue, 28 Jan 2014 13:49:14 +0000 (+0100) Subject: CA: properly detect real spectator when spectators are not allowed (nospectators... X-Git-Tag: xonotic-v0.8.0~126^2~19 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=83e4658b364f09cf5b42694be6dc2e6c8b752514;p=xonotic%2Fxonotic-data.pk3dir.git CA: properly detect real spectator when spectators are not allowed (nospectators command) and make real spectators when calling allspec and "moveplayer spec" --- diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 457cfa197..ddc293e01 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -2006,7 +2006,10 @@ float nJoinAllowed(entity ignore) { * g_maxplayers_spectator_blocktime seconds */ void checkSpectatorBlock() { - if(IS_SPEC(self) || IS_OBSERVER(self)) { + if(IS_SPEC(self) || IS_OBSERVER(self)) + if(!self.caplayer) + if(IS_REAL_CLIENT(self)) + { if( time > (self.spectatortime + autocvar_g_maxplayers_spectator_blocktime) ) { Send_Notification(NOTIF_ONE_ONLY, self, MSG_INFO, INFO_QUIT_KICK_SPECTATING); dropclient(self); diff --git a/qcsrc/server/command/sv_cmd.qc b/qcsrc/server/command/sv_cmd.qc index 2e002eb1c..4816711d9 100644 --- a/qcsrc/server/command/sv_cmd.qc +++ b/qcsrc/server/command/sv_cmd.qc @@ -216,6 +216,8 @@ void GameCommand_allspec(float request, float argc) FOR_EACH_REALPLAYER(client) { self = client; + if(self.caplayer) + self.caplayer = 0; PutObserverInServer(); ++i; } @@ -1048,6 +1050,8 @@ void GameCommand_moveplayer(float request, float argc) if(!IS_SPEC(client) && !IS_OBSERVER(client)) { self = client; + if(self.caplayer) + self.caplayer = 0; PutObserverInServer(); successful = strcat(successful, (successful ? ", " : ""), client.netname); @@ -1152,9 +1156,10 @@ void GameCommand_nospectators(float request) { blockSpectators = 1; entity plr; - FOR_EACH_CLIENT(plr) //give every spectator seconds time to become a player + FOR_EACH_REALCLIENT(plr) //give every spectator seconds time to become a player { if(IS_SPEC(plr) || IS_OBSERVER(plr)) + if(!plr.caplayer) { plr.spectatortime = time; Send_Notification(NOTIF_ONE_ONLY, plr, MSG_INFO, INFO_SPECTATE_WARNING, autocvar_g_maxplayers_spectator_blocktime);