]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Add new 'playban' cvar to disallow banned players (forced to spectate) from playing...
authorLegendaryGuard <rootuser999@gmail.com>
Sat, 10 Jun 2023 08:16:28 +0000 (08:16 +0000)
committerLegendaryGuard <rootuser999@gmail.com>
Sat, 10 Jun 2023 08:16:28 +0000 (08:16 +0000)
qcsrc/common/minigames/sv_minigames.qc
qcsrc/server/command/banning.qc
qcsrc/server/command/banning.qh
qcsrc/server/world.qc
xonotic-server.cfg

index 57f6f46b6153570fe0b4c276875d07664191b539..46f98959272627c1b52aeead334f03dff83277f9 100644 (file)
@@ -213,7 +213,7 @@ entity join_minigame(entity player, string game_id )
        return NULL;
 }
 
-void part_minigame(entity player )
+void part_minigame(entity player)
 {
        entity minig = CS(player).active_minigame;
 
@@ -268,6 +268,8 @@ string invite_minigame(entity inviter, entity player)
                return "Invalid player";
        if ( inviter == player )
                return "You can't invite yourself";
+       if (PlayerInList(player, autocvar_g_playban_list) && autocvar_g_playban_minigames) // playban
+               return "You can't invite a banned player";
        if ( CS(player).active_minigame == CS(inviter).active_minigame )
                return strcat(player.netname," is already playing");
 
@@ -312,6 +314,13 @@ void ClientCommand_minigame(entity caller, int request, int argc, string command
                return;
        }
 
+       if (PlayerInList(caller, autocvar_g_playban_list) && autocvar_g_playban_minigames) // playban
+       {
+               Send_Notification(NOTIF_ONE_ONLY, caller, MSG_CENTER, CENTER_JOIN_PLAYBAN);
+               sprint(caller, "You aren't allowed to play minigames because you are banned from them in this server.\n");
+               return;
+       }
+
        if (request == CMD_REQUEST_COMMAND )
        {
                string minig_cmd = argv(1);
index c29c47c0e8aada55583752c0c9c1a66484d05190..b4f0bb3082a4980bb4ed6e9c31f1b958a88b1246 100644 (file)
@@ -1,6 +1,7 @@
 #include "banning.qh"
 
 #include <common/command/_mod.qh>
+#include <common/minigames/sv_minigames.qh>
 #include <common/state.qh>
 #include <common/stats.qh>
 #include <common/util.qh>
@@ -183,6 +184,8 @@ void BanCommand_playban(int request, int argc, string command)
 
                                        LOG_INFO(strcat("Play-banning player ", GetCallerName(client), " (", argv(1), ")."));
                                        PutObserverInServer(client, true, true);
+                                       if (autocvar_g_playban_minigames) 
+                                               part_minigame(client);
                                        cvar_set("g_playban_list", cons(autocvar_g_playban_list, theid));
 
                                        return;
index 6e2971f24b9958e2846e5e80ee4f5ed372cccdd0..4c373b52e2d946fd0950a975af6567a483190ec1 100644 (file)
@@ -12,6 +12,7 @@ string autocvar_g_banned_list;
 bool autocvar_g_banned_list_idmode;
 string autocvar_g_chatban_list;
 string autocvar_g_playban_list;
+bool autocvar_g_playban_minigames;
 string autocvar_g_voteban_list;
 
 #define GET_BAN_ARG(v, d) if (argc > reason_arg) { if ((v = stof(argv(reason_arg))) != 0) ++reason_arg; else v = d; } else { v = d; }
index d8c44d3fb5e8515ec2c4c1b59b8163e8dbd37a6e..977f235715a90a90064d4a8f332f3dbd36595af1 100644 (file)
@@ -238,6 +238,7 @@ void cvar_changes_init()
                BADCVAR("g_require_stats");
                BADCVAR("g_chatban_list");
                BADCVAR("g_playban_list");
+               BADCVAR("g_playban_minigames");
                BADCVAR("g_voteban_list");
                BADPREFIX("developer_");
                BADPREFIX("g_ban_");
index dc5be926d0479a3943e73a1f7d57ee69654577c5..4a374aa05b2beb990950e4b23e3efc5f47d94a43 100644 (file)
@@ -408,6 +408,7 @@ set g_banned_list "" "list of banned players; player format: IP remainingtime"
 set g_banned_list_idmode "1" "when set, the IP banning system always uses the ID over the IP address (so a user in a banned IP range can connect if they have a valid signed ID)"
 set g_chatban_list "" "list of banned players from chat; player format: IP or playerkey"
 set g_playban_list "" "list of banned players from playing (forced to spectate); player format: IP or playerkey"
+set g_playban_minigames 0 "disallow playbanned players (who are forced to spectate) from playing minigames"
 set g_voteban_list "" "list of banned players from voting; player format: IP or playerkey"
 
 // useful vote aliases