Skip to content

Commit

Permalink
Allow disabling of game modes on the fly #49
Browse files Browse the repository at this point in the history
  • Loading branch information
rtxa committed Oct 19, 2024
1 parent 2ab1ed9 commit e580d17
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions valve/addons/amxmodx/scripting/agmodx.sma
Original file line number Diff line number Diff line change
Expand Up @@ -1684,13 +1684,19 @@ public CmdAgNextMode(id, level, cid) {
return PLUGIN_HANDLED;
}

if (TrieKeyExists(gTrieVoteList, arg)) {
log_amx("AgNextMode: ^"%s^" ^"%N^"", arg, id);
set_pcvar_string(gCvarGameMode, arg); // set next mode
} else {
if (!TrieKeyExists(gTrieVoteList, arg)) {
client_print(id, print_console, "%l", "INVALID_MODE");
return PLUGIN_HANDLED;
}

if (!IsGameModeAllowed(arg)) {
client_print(id, print_console, "%l", "GAMEMODE_NOTALLOWED");
return PLUGIN_HANDLED;
}

log_amx("AgNextMode: ^"%s^" ^"%N^"", arg, id);
set_pcvar_string(gCvarGameMode, arg); // set next mode

return PLUGIN_HANDLED;
}

Expand Down Expand Up @@ -2308,6 +2314,11 @@ public OnVoteAgNextMode(id, check, argc, arg1[], arg2[]) {
client_print(id, print_console, "%l", "INVALID_MODE");
return false;
}

if (!IsGameModeAllowed(arg2)) {
client_print(id, print_console, "%l", "GAMEMODE_NOTALLOWED");
return false;
}
}

return true;
Expand Down

0 comments on commit e580d17

Please sign in to comment.