Skip to content

Commit e580d17

Browse files
committed
Allow disabling of game modes on the fly #49
1 parent 2ab1ed9 commit e580d17

File tree

1 file changed

+15
-4
lines changed

1 file changed

+15
-4
lines changed

valve/addons/amxmodx/scripting/agmodx.sma

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1684,13 +1684,19 @@ public CmdAgNextMode(id, level, cid) {
16841684
return PLUGIN_HANDLED;
16851685
}
16861686

1687-
if (TrieKeyExists(gTrieVoteList, arg)) {
1688-
log_amx("AgNextMode: ^"%s^" ^"%N^"", arg, id);
1689-
set_pcvar_string(gCvarGameMode, arg); // set next mode
1690-
} else {
1687+
if (!TrieKeyExists(gTrieVoteList, arg)) {
16911688
client_print(id, print_console, "%l", "INVALID_MODE");
1689+
return PLUGIN_HANDLED;
16921690
}
16931691

1692+
if (!IsGameModeAllowed(arg)) {
1693+
client_print(id, print_console, "%l", "GAMEMODE_NOTALLOWED");
1694+
return PLUGIN_HANDLED;
1695+
}
1696+
1697+
log_amx("AgNextMode: ^"%s^" ^"%N^"", arg, id);
1698+
set_pcvar_string(gCvarGameMode, arg); // set next mode
1699+
16941700
return PLUGIN_HANDLED;
16951701
}
16961702

@@ -2308,6 +2314,11 @@ public OnVoteAgNextMode(id, check, argc, arg1[], arg2[]) {
23082314
client_print(id, print_console, "%l", "INVALID_MODE");
23092315
return false;
23102316
}
2317+
2318+
if (!IsGameModeAllowed(arg2)) {
2319+
client_print(id, print_console, "%l", "GAMEMODE_NOTALLOWED");
2320+
return false;
2321+
}
23112322
}
23122323

23132324
return true;

0 commit comments

Comments
 (0)