]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Merge branch 'Melanosuchus/kickban-unconnected' into 'master'
authorMario <zacjardine@y7mail.com>
Sun, 1 Feb 2015 04:31:41 +0000 (04:31 +0000)
committerMario <zacjardine@y7mail.com>
Sun, 1 Feb 2015 04:31:41 +0000 (04:31 +0000)
Melanosuchus/kickban unconnected

Changes:
* Unconnected clients cannot call votes
* Kickban won't discard said unconnected clients
* Bans are enforced on unconnected clients

See merge request !98

qcsrc/server/command/banning.qc
qcsrc/server/command/common.qc
qcsrc/server/command/vote.qc
qcsrc/server/ipban.qc

index 794854deddf1daa3b6e9b35b316f0d7fb1d3e443..aed01c7cbf9ab7e126e808c432d6baa6b769a07c 100644 (file)
@@ -69,7 +69,7 @@ void BanCommand_kickban(float request, float argc, string command)
                        if(argc >= 2)
                        {
                                entity client = GetIndexedEntity(argc, 1);
-                               float accepted = VerifyClientEntity(client, TRUE, FALSE);
+                               float accepted = VerifyKickableEntity(client);
                                float reason_arg, bantime, masksize;
                                string reason;
 
index c5ae7c7be069798f4cc0eff048f4d50e5633e7ac..04ed4b2840491a0bb2026386dc66e9c31215ec60 100644 (file)
@@ -21,6 +21,14 @@ string GetCallerName(entity caller)
                return admin_name(); //((autocvar_sv_adminnick != "") ? autocvar_sv_adminnick : autocvar_hostname);
 }
 
+// verify that the client provided is acceptable for kicking
+float VerifyKickableEntity(entity client)
+{
+       if (!IS_REAL_CLIENT(client))
+               return CLIENT_NOT_REAL;
+       return CLIENT_ACCEPTABLE;
+}
+
 // verify that the client provided is acceptable for use
 float VerifyClientEntity(entity client, float must_be_real, float must_be_bots)
 {
index 214083eaee9f32c080ad221512e3dfe39a28ba58..522ef4b7a4d5f2cda5960f3e3dffd0ee18273e8e 100644 (file)
@@ -792,6 +792,7 @@ void VoteCommand_call(float request, entity caller, float argc, string vote_comm
                        else if(!autocvar_sv_vote_gamestart && time < game_starttime) { print_to(caller, "^1Vote calling is not allowed before the match has started."); }
                        else if(vote_called) { print_to(caller, "^1There is already a vote called."); }
                        else if(!spectators_allowed && (caller && !IS_PLAYER(caller))) { print_to(caller, "^1Only players can call a vote."); }
+                       else if(caller && !IS_CLIENT(caller)) { print_to(caller, "^1Only connected clients can vote."); }
                        else if(timeout_status) { print_to(caller, "^1You can not call a vote while a timeout is active."); }
                        else if(caller && (time < caller.vote_waittime)) { print_to(caller, strcat("^1You have to wait ^2", ftos(ceil(caller.vote_waittime - time)), "^1 seconds before you can again call a vote.")); }
                        else if (!VoteCommand_checknasty(vote_command)) { print_to(caller, "^1Syntax error in command, see 'vhelp' for more info."); }
index d3d7fdca6e93aa87ad5db6b41f5261891672ff0a..d8a70fe658a238fe1d4e414cfd3164d472ee7a9e 100644 (file)
@@ -459,7 +459,7 @@ float Ban_MaybeEnforceBanOnce(entity client)
        if(client.ban_checked)
                return FALSE;
        client.ban_checked = TRUE;
-       return Ban_MaybeEnforceBan(self);
+       return Ban_MaybeEnforceBan(client);
 }
 
 string Ban_Enforce(float i, string reason)
@@ -469,7 +469,8 @@ string Ban_Enforce(float i, string reason)
 
        // Enforce our new ban
        s = "";
-       FOR_EACH_REALCLIENT(e)
+       FOR_EACH_CLIENTSLOT(e)
+               if (IS_REAL_CLIENT(e))
                if(Ban_IsClientBanned(e, i))
                {
                        if(reason != "")