Skip to content

Commit

Permalink
Fix agnextmode not working as expected
Browse files Browse the repository at this point in the history
- Don't allow to vote agnextmode with empty argument.
- Don't change game mode, instead just change CVar value.
- Fixed misspellings in translations.
  • Loading branch information
rtxa committed Oct 19, 2024
1 parent a2ab8fe commit 2ab1ed9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
6 changes: 3 additions & 3 deletions valve/addons/amxmodx/data/lang/agmodx.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ VOTE_ACCEPTED = Vote: %s %s^nCalled by: %s^nAccepted
VOTE_DENIED = Vote: %s %s^nCalled by: %s^nDenied
VOTE_RUNNING = Vote is running, type 'yes' or 'no' in console
VOTE_DELAY = Last vote was not accepted - %i seconds until next vote can be called
VOTE_NOTALLOWED = Voto not allowed by server admin.
VOTE_NOTALLOWED = Vote not allowed by server admin.
VOTE_NOTALLOWED_GAMEMODE = Vote is not allowed in this gamemode.
INVALID_MAP = Map is invalid
INVALID_MODE = Mode is invalid. Type 'vote' in console to see available modes
INVALID_MODE = Mode is invalid.
INVALID_NUMBER = Number is invalid
INVALID_NUMBER_MAX = Number is invalid. Max value allowed is:
INVALID_NUMBER_MIN = Number is invalid. Min value allowed is:
Expand Down Expand Up @@ -88,7 +88,7 @@ VOTE_DELAY = El ultimo voto no ha sido aceptado - Faltan %i segundos para poder
VOTE_NOTALLOWED = Voto deshabilitado por el servidor.
VOTE_NOTALLOWED_GAMEMODE = Voto no permitido en este modo.
INVALID_MAP = Mapa invalido
INVALID_MODE = Modo invalido. Escriba 'vote' en consola para ver los modos disponibles
INVALID_MODE = Modo invalido.
INVALID_NUMBER = Numero invalido
INVALID_NUMBER_MAX = Numero invalido. El maximo valor permitido es:
INVALID_NUMBER_MIN = Numero invalido. El minimo valor permitido es:
Expand Down
9 changes: 7 additions & 2 deletions valve/addons/amxmodx/scripting/agmodx.sma
Original file line number Diff line number Diff line change
Expand Up @@ -2291,18 +2291,23 @@ public OnVoteAgNextMap(id, check, argc, arg1[], arg2[]) {
}

public OnVoteAgNextMode(id, check, argc, arg1[], arg2[]) {
if (argc != 1) {
if (argc != 2) {
client_print(id, print_console, "%l", "VOTE_INVALID");
return false;
}

if (!check) {
ChangeMode(arg2);
set_pcvar_string(gCvarGameMode, arg2);
} else {
if (!get_pcvar_num(gCvarAllowVoteGameMode)) {
console_print(id, "%l", "VOTE_NOTALLOWED");
return false;
}

if (!TrieKeyExists(gTrieVoteList, arg2)) {
client_print(id, print_console, "%l", "INVALID_MODE");
return false;
}
}

return true;
Expand Down

0 comments on commit 2ab1ed9

Please sign in to comment.