]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
CA: properly detect real spectator when spectators are not allowed (nospectators...
authorterencehill <piuntn@gmail.com>
Tue, 28 Jan 2014 13:49:14 +0000 (14:49 +0100)
committerterencehill <piuntn@gmail.com>
Tue, 28 Jan 2014 13:49:14 +0000 (14:49 +0100)
qcsrc/server/cl_client.qc
qcsrc/server/command/sv_cmd.qc

index 457cfa19752c6b4382984a30e3ce221accb829d0..ddc293e0162a80d97a43b445e51df0238ec7ee53 100644 (file)
@@ -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);
index 2e002eb1c53d827904846a4655e284a9414401f9..4816711d96d0b051479de1867fd8af1d3cc4b8ac 100644 (file)
@@ -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 <g_maxplayers_spectator_blocktime> seconds time to become a player
+                       FOR_EACH_REALCLIENT(plr) //give every spectator <g_maxplayers_spectator_blocktime> 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);