From: LegendaryGuard Date: Sat, 10 Jun 2023 08:16:28 +0000 (+0000) Subject: Add new 'playban' cvar to disallow banned players (forced to spectate) from playing... X-Git-Tag: xonotic-v0.8.6~19^2 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c7063553a6a7f0edbe27cd89d2d216d961e14b6a;p=xonotic%2Fxonotic-data.pk3dir.git Add new 'playban' cvar to disallow banned players (forced to spectate) from playing minigames --- diff --git a/qcsrc/common/minigames/sv_minigames.qc b/qcsrc/common/minigames/sv_minigames.qc index 57f6f46b6..46f989592 100644 --- a/qcsrc/common/minigames/sv_minigames.qc +++ b/qcsrc/common/minigames/sv_minigames.qc @@ -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); diff --git a/qcsrc/server/command/banning.qc b/qcsrc/server/command/banning.qc index c29c47c0e..b4f0bb308 100644 --- a/qcsrc/server/command/banning.qc +++ b/qcsrc/server/command/banning.qc @@ -1,6 +1,7 @@ #include "banning.qh" #include +#include #include #include #include @@ -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; diff --git a/qcsrc/server/command/banning.qh b/qcsrc/server/command/banning.qh index 6e2971f24..4c373b52e 100644 --- a/qcsrc/server/command/banning.qh +++ b/qcsrc/server/command/banning.qh @@ -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; } diff --git a/qcsrc/server/world.qc b/qcsrc/server/world.qc index d8c44d3fb..977f23571 100644 --- a/qcsrc/server/world.qc +++ b/qcsrc/server/world.qc @@ -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_"); diff --git a/xonotic-server.cfg b/xonotic-server.cfg index dc5be926d..4a374aa05 100644 --- a/xonotic-server.cfg +++ b/xonotic-server.cfg @@ -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