diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 222d6d6c..e63e5df9 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -58,6 +58,7 @@ new g_Tracker; new g_Size; public Trie:g_tempBans +new Trie:g_tXvarsFlags; stock InsertInfo(id) { @@ -174,6 +175,8 @@ public plugin_init() register_concmd("amx_pause", "cmdPause", ADMIN_CVAR, "- pause or unpause the game") register_concmd("amx_who", "cmdWho", ADMIN_ADMIN, "- displays who is on server") register_concmd("amx_cvar", "cmdCvar", ADMIN_CVAR, " [value]") + register_concmd("amx_xvar_float", "cmdXvar", ADMIN_CVAR, " [value]") + register_concmd("amx_xvar_int", "cmdXvar", ADMIN_CVAR, " [value]") register_concmd("amx_plugins", "cmdPlugins", ADMIN_ADMIN) register_concmd("amx_modules", "cmdModules", ADMIN_ADMIN) register_concmd("amx_map", "cmdMap", ADMIN_MAP, "") @@ -828,6 +831,122 @@ public cmdCvar(id, level, cid) return PLUGIN_HANDLED } +public cmdXvar(id, level, cid) +{ + if( !cmd_access(id, level, cid, 2) ) + { + return PLUGIN_HANDLED; + } + + new cmd[15], arg1[32], arg2[32]; + + read_argv(0, cmd, charsmax(cmd)); + read_argv(1, arg1, charsmax(arg1)); + trim(arg1); + if( read_argc() > 2 ) + { + read_argv(2, arg2, charsmax(arg2)); + trim(arg2); + + if( equali(arg1, "add") ) + { + if( get_user_flags(id) & ADMIN_RCON && xvar_exists(arg2) ) + { + if( !g_tXvarsFlags ) + { + g_tXvarsFlags = TrieCreate(); + } + TrieSetCell(g_tXvarsFlags, arg2, 1); + } + return PLUGIN_HANDLED; + } + } + + new bFloat = equali(cmd, "amx_xvar_float"); + + new xvar = get_xvar_id( arg1 ); + + if( xvar == -1 ) + { + console_print(id, "[AMXX] %L", id, "UNKNOWN_XVAR", arg1) + return PLUGIN_HANDLED + } + + new any:value; + + if( !arg2[0] ) // get value + { + value = get_xvar_num(xvar); + if( bFloat ) + { + float_to_str(value, arg2, charsmax(arg2)); + } + else + { + num_to_str(value, arg2, charsmax(arg2)); + } + console_print(id, "[AMXX] %L", id, "XVAR_IS", arg1, arg2); + return PLUGIN_HANDLED; + } + + // set value + if( g_tXvarsFlags && TrieKeyExists(g_tXvarsFlags, arg1) && ~get_user_flags(id) & ADMIN_RCON ) + { + console_print(id, "[AMXX] %L", id, "XVAR_NO_ACC"); + return PLUGIN_HANDLED; + } + + new endPos; + if( bFloat ) + { + value = strtof(arg2, endPos); + if( !endPos ) + { + return PLUGIN_HANDLED; + } + } + else + { + value = strtol(arg2, endPos); + if( !endPos ) + { + return PLUGIN_HANDLED; + } + } + + set_xvar_num(xvar, value); + + // convert back value to string so admin can know value has been set correctly + if( bFloat ) + { + float_to_str(value, arg2, charsmax(arg2)); + } + else + { + num_to_str(value, arg2, charsmax(arg2)); + } + + new authid[32], name[32]; + + get_user_authid(id, authid, charsmax(authid)); + get_user_name(id, name, charsmax(name)); + + log_amx("Cmd: ^"%s<%d><%s><>^" set xvar (name ^"%s^") (value ^"%s^")", name, get_user_userid(id), authid, arg1, arg2); + + // Display the message to all clients + new players[32], pnum, plr; + get_players(players, pnum, "ch"); + for (new i; i "%s" +SET_XVAR_TO = %s laittoi xvarin %s --> "%s" CVAR_CHANGED = Cvar "%s" --> "%s" +XVAR_CHANGED = Xvar "%s" --> "%s" LOADED_PLUGINS = Ladatut pluginit talla hetkella NAME = nimi VERSION = versio @@ -930,11 +995,16 @@ ADMIN_MAP_1 = l33t s3rv3r 0P: ch4ngl3v3l %s ADMIN_MAP_2 = l33t s3rv3r 0P %s: ch4ngl3v3l %s NO_MORE_CVARS = 3rr0r | N0T 3NUFF M4N4 | c4nn0t +++ m0r3 l33t (\/4|2s f0r |2(0|\| 4cc3ss! UNKNOWN_CVAR = th!$ l33t (\/4|2: %s sux, ch00s3 4g4!n +UNKNOWN_XVAR = th!$ l33t ><\/4|2: %s sux, ch00s3 4g4!n CVAR_NO_ACC = a((e$$ d3|\|i3d. FA(3! N0 l33t (\/4|2 ch4ng'!n f0 j00! +XVAR_NO_ACC = a((e$$ d3|\|i3d. FA(3! N0 l33t ><\/4|2 ch4ng'!n f0 j00! CVAR_IS = C\/4|2 "%s" is "%s" +XVAR_IS = ><\/4|2 "%s" is "%s" PROTECTED = | N0T 3NUFF M4N4! | a((e$$ d3|\|i3d. FA(3! SET_CVAR_TO = %s s3t l33t (\/4|2 %s to "%s" +SET_XVAR_TO = %s s3t l33t ><\/4|2 %s to "%s" CVAR_CHANGED = C\/4|2 "%s" ch4ngd to "%s" +XVAR_CHANGED = ><\/4|2 "%s" ch4ngd to "%s" LOADED_PLUGINS = l04d'3d l33t plug!nz NAME = n4m VERSION = v3r$i0n @@ -999,11 +1069,16 @@ ADMIN_MAP_1 = ADMINISTRATOR: smeni kartata na %s ADMIN_MAP_2 = ADMINISTRATOR %s: smeni kartata na %s NO_MORE_CVARS = Nomeje da se dobavqt pove4e cvars kam rcon dostapa! UNKNOWN_CVAR = Nepoznat cvar: %s +UNKNOWN_XVAR = Nepoznat xvar: %s CVAR_NO_ACC = Nqmate dostap do tozi cvar +XVAR_NO_ACC = Nqmate dostap do tozi xvar CVAR_IS = Cvar "%s" e "%s" +XVAR_IS = Xvar "%s" e "%s" PROTECTED = predpazen SET_CVAR_TO = %s nastroi cvar %s na "%s" +SET_XVAR_TO = %s nastroi xvar %s na "%s" CVAR_CHANGED = Cvar "%s" smenen na "%s" +XVAR_CHANGED = Xvar "%s" smenen na "%s" LOADED_PLUGINS = v momenta ka4eni plugini NAME = ime VERSION = versiq @@ -1068,11 +1143,16 @@ ADMIN_MAP_1 = ADMIN: schimbare harta pe %s ADMIN_MAP_2 = ADMIN %s: schimbare harta pe %s NO_MORE_CVARS = Nu se pot adauga mai multe comenzi pentru accesul rcon! UNKNOWN_CVAR = Comanda nerecunoscuta: %s +UNKNOWN_XVAR = Comanda nerecunoscuta: %s CVAR_NO_ACC = Nu ai acces la aceasta comanda +XVAR_NO_ACC = Nu ai acces la aceasta comanda CVAR_IS = Comanda "%s" este "%s" +XVAR_IS = Comanda "%s" este "%s" PROTECTED = PROTEJAT SET_CVAR_TO = %s seteaza comanda %s pe "%s" +SET_XVAR_TO = %s seteaza comanda %s pe "%s" CVAR_CHANGED = Comanda "%s" a fost schimbata pe "%s" +XVAR_CHANGED = Comanda "%s" a fost schimbata pe "%s" LOADED_PLUGINS = Plugin-uri incarcate NAME = nume VERSION = versiune @@ -1138,11 +1218,16 @@ ADMIN_MAP_1 = ADMIN: palyavaltas %s ADMIN_MAP_2 = ADMIN %s: palyavaltas %s NO_MORE_CVARS = Nem lehet tobb cvars hozaadni az rcon hozzafereshez! UNKNOWN_CVAR = Ismeretlen cvar: %s +UNKNOWN_XVAR = Ismeretlen xvar: %s CVAR_NO_ACC = Nincs engedelyed a cvar-hoz +XVAR_NO_ACC = Nincs engedelyed a xvar-hoz CVAR_IS = Cvar "%s" is "%s" +XVAR_IS = Xvar "%s" is "%s" PROTECTED = PROTECTED SET_CVAR_TO = %s beallitva cvar %s to "%s" +SET_XVAR_TO = %s beallitva xvar %s to "%s" CVAR_CHANGED = Cvar "%s" atalitva "%s"-ra. +XVAR_CHANGED = Xvar "%s" atalitva "%s"-ra. LOADED_PLUGINS = Aktualis betoltott pluginok NAME = nev VERSION = verzio @@ -1207,11 +1292,16 @@ ADMIN_MAP_1 = ADMINAS: keicia mapa i %s ADMIN_MAP_2 = ADMINAS %s: keicia mapa i %s NO_MORE_CVARS = Negalima ikelti daugiau komandu su rcon prieimu! UNKNOWN_CVAR = Nezinoma komanda: %s +UNKNOWN_XVAR = Nezinoma komanda: %s CVAR_NO_ACC = Neturi teisiu siai komandai +XVAR_NO_ACC = Neturi teisiu siai komandai CVAR_IS = Komanda "%s" is "%s" +XVAR_IS = Komanda "%s" is "%s" PROTECTED = APSAUGOTA SET_CVAR_TO = %s nustato komanda %s i "%s" +SET_XVAR_TO = %s nustato komanda %s i "%s" CVAR_CHANGED = Komanda "%s" pakeista i "%s" +XVAR_CHANGED = Komanda "%s" pakeista i "%s" LOADED_PLUGINS = Uzkrauti pluginai NAME = vardas VERSION = versija @@ -1277,11 +1367,16 @@ ADMIN_MAP_1 = ADMIN: zmenil mapu na %s ADMIN_MAP_2 = ADMIN %s: zmenili mapu na %s NO_MORE_CVARS = Nemozem pridat viac cvars pre pristup rcon! UNKNOWN_CVAR = Neznamy cvar: %s +UNKNOWN_XVAR = Neznamy xvar: %s CVAR_NO_ACC = Nemas pristup k tomuto cvar +XVAR_NO_ACC = Nemas pristup k tomuto xvar CVAR_IS = Cvar "%s" je "%s" +XVAR_IS = Xvar "%s" je "%s" PROTECTED = CHRANENY SET_CVAR_TO = %s nastavil cvar %s na "%s" +SET_XVAR_TO = %s nastavil xvar %s na "%s" CVAR_CHANGED = Cvar "%s" zmeneny na "%s" +XVAR_CHANGED = Xvar "%s" zmeneny na "%s" LOADED_PLUGINS = Aktualne nacitane pluginy NAME = meno VERSION = verzia @@ -1347,11 +1442,16 @@ ADMIN_MAP_1 = ADMIN: ja smeni mapata vo %s ADMIN_MAP_2 = ADMIN %s: ja smeni mapata vo %s NO_MORE_CVARS = Ne e mozno da se dodadat uste komandi za RCON pristap! UNKNOWN_CVAR = Nepoznata komanda: %s +UNKNOWN_XVAR = Nepoznata komanda: %s CVAR_NO_ACC = Nemate pristap na ovaa komanda +XVAR_NO_ACC = Nemate pristap na ovaa komanda CVAR_IS = Komandata "%s" e "%s" +XVAR_IS = Komandata "%s" e "%s" PROTECTED = ZASTITENO SET_CVAR_TO = %s ja izvrsi komandata %s na "%s" +SET_XVAR_TO = %s ja izvrsi komandata %s na "%s" CVAR_CHANGED = Komandata "%s" e promeneta vo "%s" +XVAR_CHANGED = Komandata "%s" e promeneta vo "%s" LOADED_PLUGINS = Momentalno vcitani plagini NAME = ime VERSION = verzija @@ -1416,11 +1516,16 @@ ADMIN_MAP_1 = ADMIN: promjena mape na %s ADMIN_MAP_2 = ADMIN %s: mjenja mapu na %s NO_MORE_CVARS = Nije moguce dodati jos varijabli za RCON pristup! UNKNOWN_CVAR = Nepoznata varijabla: %s +UNKNOWN_XVAR = Nepoznata xvarijabla: %s CVAR_NO_ACC = Nemate pristup ovoj varijabli +XVAR_NO_ACC = Nemate pristup ovoj xvarijabli CVAR_IS = Varijabla "%s" je "%s" +XVAR_IS = Xvarijabla "%s" je "%s" PROTECTED = ZASTICENO SET_CVAR_TO = %s je postavio varijablu %s na "%s" +SET_XVAR_TO = %s je postavio xvarijablu %s na "%s" CVAR_CHANGED = Varijabla "%s" je promjenjena "%s" +XVAR_CHANGED = Xvarijabla "%s" je promjenjena "%s" LOADED_PLUGINS = Trenutno ucitanih pluginova NAME = ime VERSION = verzija @@ -1485,11 +1590,16 @@ ADMIN_MAP_1 = ADMIN: changelevel %s ADMIN_MAP_2 = ADMIN %s: changelevel %s NO_MORE_CVARS = Nije moguce dodati jos komandi za RCON pristup! UNKNOWN_CVAR = Nepoznata komanda: %s +UNKNOWN_XVAR = Nepoznata komanda: %s CVAR_NO_ACC = Nemate pristup ovoj komandi +XVAR_NO_ACC = Nemate pristup ovoj komandi CVAR_IS = Komanda "%s" je "%s" +XVAR_IS = Komanda "%s" je "%s" PROTECTED = ZASTICENO SET_CVAR_TO = %s je izvrsio komandu %s na "%s" +SET_XVAR_TO = %s je izvrsio komandu %s na "%s" CVAR_CHANGED = Komanda "%s" je promijenjena "%s" +XVAR_CHANGED = Komanda "%s" je promijenjena "%s" LOADED_PLUGINS = Trenutno ucitanih pluginova NAME = ime VERSION = verzija