diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 6a3428fd..7621b865 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -214,7 +214,7 @@ public cmdKick(id, level, cid) return PLUGIN_HANDLED new arg[32] - read_argv(1, arg, 31) + read_argv(1, arg, charsmax(arg)) new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF) if (!player) @@ -222,12 +222,12 @@ public cmdKick(id, level, cid) new authid[32], authid2[32], name2[32], name[32], userid2, reason[32] - get_user_authid(id, authid, 31) - get_user_authid(player, authid2, 31) - get_user_name(player, name2, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_name(player, name2, charsmax(name2)) + get_user_name(id, name, charsmax(name)) userid2 = get_user_userid(player) - read_argv(2, reason, 31) + read_argv(2, reason, charsmax(reason)) remove_quotes(reason) log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^" (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, reason) @@ -256,7 +256,7 @@ public cmdUnban(id, level, cid) new arg[32], authid[32], name[32] - read_argv(1, arg, 31) + read_argv(1, arg, charsmax(arg)) if (contain(arg, ".") != -1) { @@ -267,11 +267,11 @@ public cmdUnban(id, level, cid) console_print(id, "[AMXX] %L", id, "AUTHID_REMOVED", arg) } - get_user_name(id, name, 31) + get_user_name(id, name, charsmax(name)) show_activity_key("ADMIN_UNBAN_1", "ADMIN_UNBAN_2", name, arg); - get_user_authid(id, authid, 31) + get_user_authid(id, authid, charsmax(authid)) log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", name, get_user_userid(id), authid, arg) return PLUGIN_HANDLED @@ -302,9 +302,9 @@ public cmdAddBan(id, level, cid) new arg[32], authid[32], name[32], minutes[32], reason[32] - read_argv(1, arg, 31) - read_argv(2, minutes, 31) - read_argv(3, reason, 31) + read_argv(1, arg, charsmax(arg)) + read_argv(2, minutes, charsmax(minutes)) + read_argv(3, reason, charsmax(reason)) if (!(get_user_flags(id) & ADMIN_RCON)) @@ -396,11 +396,11 @@ public cmdAddBan(id, level, cid) console_print(id, "[AMXX] Authid ^"%s^" added to ban list", arg) } - get_user_name(id, name, 31) + get_user_name(id, name, charsmax(name)) show_activity_key("ADMIN_ADDBAN_1", "ADMIN_ADDBAN_2", name, arg); - get_user_authid(id, authid, 31) + get_user_authid(id, authid, charsmax(authid)) log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, arg, minutes, reason) return PLUGIN_HANDLED @@ -413,9 +413,9 @@ public cmdBan(id, level, cid) new target[32], minutes[8], reason[64] - read_argv(1, target, 31) - read_argv(2, minutes, 7) - read_argv(3, reason, 63) + read_argv(1, target, charsmax(target)) + read_argv(2, minutes, charsmax(minutes)) + read_argv(3, reason, charsmax(reason)) new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF) @@ -425,20 +425,20 @@ public cmdBan(id, level, cid) new authid[32], name2[32], authid2[32], name[32] new userid2 = get_user_userid(player) - get_user_authid(player, authid2, 31) - get_user_authid(id, authid, 31) - get_user_name(player, name2, 31) - get_user_name(id, name, 31) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(player, name2, charsmax(name2)) + get_user_name(id, name, charsmax(name)) log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason) new temp[64], banned[16], nNum = str_to_num(minutes) if (nNum) - format(temp, 63, "%L", player, "FOR_MIN", minutes) + formatex(temp, charsmax(temp), "%L", player, "FOR_MIN", minutes) else - format(temp, 63, "%L", player, "PERM") + formatex(temp, charsmax(temp), "%L", player, "PERM") - format(banned, 15, "%L", player, "BANNED") + formatex(banned, charsmax(banned), "%L", player, "BANNED") if (reason[0]) server_cmd("kick #%d ^"%s (%s %s)^";wait;banid %s %s;wait;writeid", userid2, reason, banned, temp, minutes, authid2) @@ -450,27 +450,27 @@ public cmdBan(id, level, cid) new msg[256]; new len; - new maxpl = get_maxplayers(); - for (new i = 1; i <= maxpl; i++) + new players[32], pnum, plr + get_players(players, pnum, "ch") + for (new i; i 0) - { - formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason); - } - show_activity_id(i, id, name, msg); + len += formatex(msg[len], charsmax(msg) - len, "%L", plr, "FOR_MIN", minutes); } + else + { + len += formatex(msg[len], charsmax(msg) - len, "%L", plr, "PERM"); + } + if (strlen(reason) > 0) + { + formatex(msg[len], charsmax(msg) - len, " (%L: %s)", plr, "REASON", reason); + } + show_activity_id(plr, id, name, msg); } console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2) @@ -485,9 +485,9 @@ public cmdBanIP(id, level, cid) new target[32], minutes[8], reason[64] - read_argv(1, target, 31) - read_argv(2, minutes, 7) - read_argv(3, reason, 63) + read_argv(1, target, charsmax(target)) + read_argv(2, minutes, charsmax(minutes)) + read_argv(3, reason, charsmax(reason)) new player = cmd_target(id, target, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_NO_BOTS | CMDTARGET_ALLOW_SELF) @@ -502,22 +502,22 @@ public cmdBanIP(id, level, cid) new authid[32], name2[32], authid2[32], name[32] new userid2 = get_user_userid(player) - get_user_authid(player, authid2, 31) - get_user_authid(id, authid, 31) - get_user_name(player, name2, 31) - get_user_name(id, name, 31) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(player, name2, charsmax(name2)) + get_user_name(id, name, charsmax(name)) log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, name2, userid2, authid2, minutes, reason) new temp[64], banned[16], nNum = str_to_num(minutes) if (nNum) - format(temp, 63, "%L", player, "FOR_MIN", minutes) + formatex(temp, charsmax(temp), "%L", player, "FOR_MIN", minutes) else - format(temp, 63, "%L", player, "PERM") + formatex(temp, charsmax(temp), "%L", player, "PERM") format(banned, 15, "%L", player, "BANNED") new address[32] - get_user_ip(player, address, 31, 1) + get_user_ip(player, address, charsmax(address), 1) if (reason[0]) server_cmd("kick #%d ^"%s (%s %s)^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, reason, banned, temp, minutes, address) @@ -528,27 +528,27 @@ public cmdBanIP(id, level, cid) new msg[256]; new len; - new maxpl = get_maxplayers(); - for (new i = 1; i <= maxpl; i++) + new players[32], pnum, plr + get_players(players, pnum, "ch") + for (new i; i 0) - { - formatex(msg[len], charsmax(msg) - len, " (%L: %s)", i, "REASON", reason); - } - show_activity_id(i, id, name, msg); + formatex(msg[len], charsmax(msg) - len, "%L", plr, "FOR_MIN", minutes); } + else + { + formatex(msg[len], charsmax(msg) - len, "%L", plr, "PERM"); + } + if (strlen(reason) > 0) + { + formatex(msg[len], charsmax(msg) - len, " (%L: %s)", plr, "REASON", reason); + } + show_activity_id(plr, id, name, msg); } console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2) @@ -563,7 +563,7 @@ public cmdSlay(id, level, cid) new arg[32] - read_argv(1, arg, 31) + read_argv(1, arg, charsmax(arg)) new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE) @@ -574,10 +574,10 @@ public cmdSlay(id, level, cid) new authid[32], name2[32], authid2[32], name[32] - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) - get_user_authid(player, authid2, 31) - get_user_name(player, name2, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_name(player, name2, charsmax(name2)) log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) @@ -595,7 +595,7 @@ public cmdSlap(id, level, cid) new arg[32] - read_argv(1, arg, 31) + read_argv(1, arg, charsmax(arg)) new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF | CMDTARGET_ONLY_ALIVE) if (!player) @@ -603,16 +603,16 @@ public cmdSlap(id, level, cid) new spower[32], authid[32], name2[32], authid2[32], name[32] - read_argv(2, spower, 31) + read_argv(2, spower, charsmax(spower)) new damage = clamp( str_to_num(spower), 0) user_slap(player, damage) - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) - get_user_authid(player, authid2, 31) - get_user_name(player, name2, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_name(player, name2, charsmax(name2)) log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, damage, name2, get_user_userid(player), authid2) @@ -634,7 +634,7 @@ public cmdMap(id, level, cid) return PLUGIN_HANDLED new arg[32] - new arglen = read_argv(1, arg, 31) + new arglen = read_argv(1, arg, charsmax(arg)) if (!is_map_valid(arg)) { @@ -644,15 +644,15 @@ public cmdMap(id, level, cid) new authid[32], name[32] - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) show_activity_key("ADMIN_MAP_1", "ADMIN_MAP_2", name, arg); log_amx("Cmd: ^"%s<%d><%s><>^" changelevel ^"%s^"", name, get_user_userid(id), authid, arg) new _modName[10] - get_modname(_modName, 9) + get_modname(_modName, charsmax(_modName)) if (!equal(_modName, "zp")) { @@ -711,8 +711,8 @@ public cmdCvar(id, level, cid) new arg[32], arg2[64] - read_argv(1, arg, 31) - read_argv(2, arg2, 63) + read_argv(1, arg, charsmax(arg)) + read_argv(2, arg2, charsmax(arg2)) new pointer; @@ -749,38 +749,37 @@ public cmdCvar(id, level, cid) if (read_argc() < 3) { - get_pcvar_string(pointer, arg2, 63) + get_pcvar_string(pointer, arg2, charsmax(arg2)) console_print(id, "[AMXX] %L", id, "CVAR_IS", arg, arg2) return PLUGIN_HANDLED } new authid[32], name[32] - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", name, get_user_userid(id), authid, arg, arg2) - set_cvar_string(arg, arg2) + set_pcvar_string(pointer, arg2) // Display the message to all clients new cvar_val[64]; - new maxpl = get_maxplayers(); - for (new i = 1; i <= maxpl; i++) + new players[32], pnum, plr + get_players(players, pnum, "ch") + for (new i; i 1) { - read_argv(1,Temp,sizeof(Temp)-1); + read_argv(1,Temp,charsmax(Temp)); StartPLID=str_to_num(Temp)-1; // zero-based } @@ -832,7 +831,7 @@ public cmdPlugins(id, level, cid) new i=StartPLID; while (i <%s><>^" execute cfg (file ^"%s^")", name, get_user_userid(id), authid, arg) @@ -935,7 +934,7 @@ public cmdLBack() new paused[25] format(paused, 24, "%L", g_pauseCon, g_Paused ? "UNPAUSED" : "PAUSED") - set_cvar_float("pausable", g_pausAble) + set_pcvar_float(pausable, g_pausAble) console_print(g_pauseCon, "[AMXX] Server %s", paused) g_PauseAllowed = false @@ -954,8 +953,8 @@ public cmdPause(id, level, cid) new authid[32], name[32], slayer = id - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) if (pausable!=0) { g_pausAble = get_pcvar_float(pausable) @@ -970,7 +969,7 @@ public cmdPause(id, level, cid) return PLUGIN_HANDLED } - set_cvar_float("pausable", 1.0) + set_pcvar_float(pausable, 1.0) g_PauseAllowed = true client_cmd(slayer, "pause;pauseAck") @@ -980,13 +979,11 @@ public cmdPause(id, level, cid) // Display the message to all clients - new maxpl = get_maxplayers(); - for (new i = 1; i <= maxpl; i++) + new players[32], pnum + get_players(players, pnum, "ch") + for (new i; i<%s><>^" server console (cmdline ^"%s^")", name, get_user_userid(id), authid, arg) @@ -1041,32 +1038,33 @@ public cmdWho(id, level, cid) if (!cmd_access(id, level, cid, 1)) return PLUGIN_HANDLED - new players[32], inum, cl_on_server[64], authid[32], name[32], flags, sflags[32] + new players[32], inum, cl_on_server[64], authid[32], name[32], flags, sflags[32], plr new lImm[16], lRes[16], lAccess[16], lYes[16], lNo[16] - format(lImm, 15, "%L", id, "IMMU") - format(lRes, 15, "%L", id, "RESERV") - format(lAccess, 15, "%L", id, "ACCESS") - format(lYes, 15, "%L", id, "YES") - format(lNo, 15, "%L", id, "NO") + formatex(lImm, charsmax(lImm), "%L", id, "IMMU") + formatex(lRes, charsmax(lRes), "%L", id, "RESERV") + formatex(lAccess, charsmax(lAccess), "%L", id, "ACCESS") + formatex(lYes, charsmax(lYes), "%L", id, "YES") + formatex(lNo, charsmax(lNo), "%L", id, "NO") get_players(players, inum) - format(cl_on_server, 63, "%L", id, "CLIENTS_ON_SERVER") + format(cl_on_server, charsmax(cl_on_server), "%L", id, "CLIENTS_ON_SERVER") console_print(id, "^n%s:^n # %-16.15s %-20s %-8s %-4.3s %-4.3s %s", cl_on_server, "nick", "authid", "userid", lImm, lRes, lAccess) for (new a = 0; a < inum; ++a) { - get_user_authid(players[a], authid, 31) - get_user_name(players[a], name, 31) - flags = get_user_flags(players[a]) - get_flags(flags, sflags, 31) - console_print(id, "%2d %-16.15s %-20s %-8d %-6.5s %-6.5s %s", players[a], name, authid, - get_user_userid(players[a]), (flags&ADMIN_IMMUNITY) ? lYes : lNo, (flags&ADMIN_RESERVATION) ? lYes : lNo, sflags) + plr = players[a] + get_user_authid(plr, authid, charsmax(authid)) + get_user_name(plr, name, charsmax(name)) + flags = get_user_flags(plr) + get_flags(flags, sflags, charsmax(sflags)) + console_print(id, "%2d %-16.15s %-20s %-8d %-6.5s %-6.5s %s", plr, name, authid, + get_user_userid(plr), (flags&ADMIN_IMMUNITY) ? lYes : lNo, (flags&ADMIN_RESERVATION) ? lYes : lNo, sflags) } console_print(id, "%L", id, "TOTAL_NUM", inum) - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) log_amx("Cmd: ^"%s<%d><%s><>^" ask for players list", name, get_user_userid(id), authid) return PLUGIN_HANDLED @@ -1092,7 +1090,7 @@ public cmdLeave(id, level, cid) for (new a = 1; a < 5; ++a) { if (a < argnum) - read_argv(a, ltags[ltagsnum++], 31) + read_argv(a, ltags[ltagsnum++], charsmax(ltags[])) else ltags[ltagsnum++][0] = 0 } @@ -1103,7 +1101,7 @@ public cmdLeave(id, level, cid) { if (!is_user_connected(b) && !is_user_connecting(b)) continue - get_user_name(b, nick, 31) + get_user_name(b, nick, charsmax(nick)) ires = hasTag(nick, ltags, ltagsnum) if (ires != -1) @@ -1124,7 +1122,7 @@ public cmdLeave(id, level, cid) server_cmd("kick #%d", get_user_userid(b)) else { - format(lReason, 127, "%L", b, "YOU_DROPPED") + formatex(lReason, charsmax(lReason), "%L", b, "YOU_DROPPED") server_cmd("kick #%d ^"%s^"", get_user_userid(b), lReason) } count++ @@ -1134,8 +1132,8 @@ public cmdLeave(id, level, cid) new authid[32], name[32] - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) log_amx("Kick: ^"%s<%d><%s><>^" leave some group (tag1 ^"%s^") (tag2 ^"%s^") (tag3 ^"%s^") (tag4 ^"%s^")", name, get_user_userid(id), authid, ltags[0], ltags[1], ltags[2], ltags[3]) show_activity_key("ADMIN_LEAVE_1", "ADMIN_LEAVE_2", name, ltags[0], ltags[1], ltags[2], ltags[3]); @@ -1150,20 +1148,20 @@ public cmdNick(id, level, cid) new arg1[32], arg2[32], authid[32], name[32], authid2[32], name2[32] - read_argv(1, arg1, 31) - read_argv(2, arg2, 31) + read_argv(1, arg1, charsmax(arg1)) + read_argv(2, arg2, charsmax(arg2)) new player = cmd_target(id, arg1, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF) if (!player) return PLUGIN_HANDLED - get_user_authid(id, authid, 31) - get_user_name(id, name, 31) - get_user_authid(player, authid2, 31) - get_user_name(player, name2, 31) + get_user_authid(id, authid, charsmax(authid)) + get_user_name(id, name, charsmax(name)) + get_user_authid(player, authid2, charsmax(authid2)) + get_user_name(player, name2, charsmax(name2)) - client_cmd(player, "name ^"%s^"", arg2) + set_user_info(player, "name", arg2) log_amx("Cmd: ^"%s<%d><%s><>^" change nick to ^"%s^" ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, arg2, name2, get_user_userid(player), authid2)