From 0c82e09df1a2acba857b2856a43af4bb2fa5c38e Mon Sep 17 00:00:00 2001 From: Steve Dudenhoeffer Date: Thu, 24 May 2007 17:11:11 +0000 Subject: [PATCH] Added amb42 - different amx_show_activity values. --- plugins/adminchat.sma | 87 +++++++++-- plugins/admincmd.sma | 208 ++++++++++--------------- plugins/adminvote.sma | 95 ++++++------ plugins/cmdmenu.sma | 1 + plugins/include/amxmisc.inc | 299 ++++++++++++++++++++++++++++++++++-- plugins/lang/pausecfg.txt | 6 + plugins/ns/nscommands.sma | 48 +++--- plugins/plmenu.sma | 62 +++----- plugins/pluginmenu.sma | 50 ++---- plugins/telemenu.sma | 6 +- 10 files changed, 542 insertions(+), 320 deletions(-) diff --git a/plugins/adminchat.sma b/plugins/adminchat.sma index 7465edcd..53e53cad 100755 --- a/plugins/adminchat.sma +++ b/plugins/adminchat.sma @@ -43,6 +43,7 @@ new g_Colors[MAX_CLR][] = {"COL_WHITE", "COL_RED", "COL_GREEN", "COL_BLUE", "COL new g_Values[MAX_CLR][] = {{255, 255, 255}, {255, 0, 0}, {0, 255, 0}, {0, 0, 255}, {255, 255, 0}, {255, 0, 255}, {0, 255, 255}, {227, 96, 8}, {45, 89, 116}, {103, 44, 38}} new Float:g_Pos[4][] = {{0.0, 0.0}, {0.05, 0.55}, {-1.0, 0.2}, {-1.0, 0.7}} +new amx_show_activity; public plugin_init() { register_plugin("Admin Chat", AMXX_VERSION_STR, "AMXX Dev Team") @@ -55,6 +56,13 @@ public plugin_init() register_concmd("amx_psay", "cmdPsay", ADMIN_CHAT, " - sends private message") register_concmd("amx_tsay", "cmdTsay", ADMIN_CHAT, " - sends left side hud message to all players") register_concmd("amx_csay", "cmdTsay", ADMIN_CHAT, " - sends center hud message to all players") + + amx_show_activity = get_cvar_pointer("amx_show_activity"); + + if (amx_show_activity == 0) + { + amx_show_activity = register_cvar("amx_show_activity", "2"); + } } public cmdSayChat(id) @@ -123,13 +131,38 @@ public cmdSayChat(id) set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], g_Pos[i][0], verpos, 0, 6.0, 6.0, 0.5, 0.15, -1) - if (get_cvar_num("amx_show_activity") == 2) + switch ( get_pcvar_num(amx_show_activity) ) { - show_hudmessage(0, "%s : %s", name, message[i + n]) - client_print(0, print_notify, "%s : %s", name, message[i + n]) - } else { - show_hudmessage(0, "%s", message[i + n]) - client_print(0, print_notify, "%s", message[i + n]) + case 3, 4: + { + new maxpl = get_maxplayers(); + for (new pl = 1; pl <= maxpl; pl++) + { + if (is_user_connected(pl) && !is_user_bot(pl)) + { + if (is_user_admin(pl)) + { + show_hudmessage(pl, "%s : %s", name, message[i + n]) + client_print(pl, print_notify, "%s : %s", name, message[i + n]) + } + else + { + show_hudmessage(pl, "%s", message[i + n]) + client_print(pl, print_notify, "%s", message[i + n]) + } + } + } + } + case 2: + { + show_hudmessage(0, "%s : %s", name, message[i + n]) + client_print(0, print_notify, "%s : %s", name, message[i + n]) + } + default: + { + show_hudmessage(0, "%s", message[i + n]) + client_print(0, print_notify, "%s", message[i + n]) + } } return PLUGIN_HANDLED @@ -318,15 +351,41 @@ public cmdTsay(id, level, cid) userid = get_user_userid(id) set_hudmessage(g_Values[a][0], g_Values[a][1], g_Values[a][2], tsay ? 0.05 : -1.0, verpos, 0, 6.0, 6.0, 0.5, 0.15, -1) - if (get_cvar_num("amx_show_activity") == 2) + switch ( get_pcvar_num(amx_show_activity) ) { - show_hudmessage(0, "%s : %s", name, message[length]) - client_print(0, print_notify, "%s : %s", name, message[length]) - console_print(id, "%s : %s", name, message[length]) - } else { - show_hudmessage(0, "%s", message[length]) - client_print(0, print_notify, "%s", message[length]) - console_print(id, "%s", message[length]) + case 3, 4: + { + new maxpl = get_maxplayers(); + for (new pl = 1; pl <= maxpl; pl++) + { + if (is_user_connected(pl) && !is_user_bot(pl)) + { + if (is_user_admin(pl)) + { + show_hudmessage(pl, "%s : %s", name, message[length]) + client_print(pl, print_notify, "%s : %s", name, message[length]) + } + else + { + show_hudmessage(pl, "%s", message[length]) + client_print(pl, print_notify, "%s", message[length]) + } + } + } + console_print(id, "%s : %s", name, message[length]) + } + case 2: + { + show_hudmessage(0, "%s : %s", name, message[length]) + client_print(0, print_notify, "%s : %s", name, message[length]) + console_print(id, "%s : %s", name, message[length]) + } + default: + { + show_hudmessage(0, "%s", message[length]) + client_print(0, print_notify, "%s", message[length]) + console_print(id, "%s", message[length]) + } } log_amx("Chat: ^"%s<%d><%s><>^" %s ^"%s^"", name, userid, authid, cmd[4], message[length]) diff --git a/plugins/admincmd.sma b/plugins/admincmd.sma index 66e30e34..1036f1db 100755 --- a/plugins/admincmd.sma +++ b/plugins/admincmd.sma @@ -35,22 +35,26 @@ #include #include + new g_pauseCon new Float:g_pausAble new bool:g_Paused new bool:g_PauseAllowed = false new g_addCvar[] = "amx_cvar add %s" -new amx_show_activity; new pausable; new rcon_password; + public plugin_init() { register_plugin("Admin Commands", AMXX_VERSION_STR, "AMXX Dev Team") + register_dictionary("admincmd.txt") register_dictionary("common.txt") register_dictionary("adminhelp.txt") + + register_concmd("amx_kick", "cmdKick", ADMIN_KICK, " [reason]") register_concmd("amx_ban", "cmdBan", ADMIN_BAN, " [reason]") register_concmd("amx_banip", "cmdBanIP", ADMIN_BAN, " [reason]") @@ -75,12 +79,6 @@ public plugin_init() rcon_password=get_cvar_pointer("rcon_password"); pausable=get_cvar_pointer("pausable"); - amx_show_activity=get_cvar_pointer("amx_show_activity"); - - if (amx_show_activity==0) // cvar does not exist, register it - { - amx_show_activity=register_cvar("amx_show_activity", "2"); - } } @@ -127,12 +125,8 @@ public cmdKick(id, level, cid) 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) - - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_2", name, name2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_1", name2) - } + + show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2); if (is_user_bot(player)) server_cmd("kick #%d", userid2) @@ -168,12 +162,8 @@ public cmdUnban(id, level, cid) } get_user_name(id, name, 31) - - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_2", name, arg) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_UNBAN_1", arg) - } + + show_activity_key("ADMIN_UNBAN_1", "ADMIN_UNBAN_2", name, arg); get_user_authid(id, authid, 31) log_amx("Cmd: ^"%s<%d><%s><>^" unban ^"%s^"", name, get_user_userid(id), authid, arg) @@ -203,11 +193,7 @@ public cmdAddBan(id, level, cid) get_user_name(id, name, 31) - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_2", name, arg) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_ADDBAN_1", arg) - } + show_activity_key("ADMIN_ADDBAN_1", "ADMIN_ADDBAN_2", name, arg); get_user_authid(id, authid, 31) log_amx("Cmd: ^"%s<%d><%s><>^" ban ^"%s^" (minutes ^"%s^") (reason ^"%s^")", name, get_user_userid(id), authid, arg, minutes, reason) @@ -254,32 +240,30 @@ public cmdBan(id, level, cid) else server_cmd("kick #%d ^"%s %s^";wait;banid ^"%s^" ^"%s^";wait;writeid", userid2, banned, temp, minutes, authid2) - new activity = get_pcvar_num(amx_show_activity) - if (activity != 0) + + // Display the message to all clients + + new msg[256]; + new len; + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, msg[256], len - get_players(players, pnum, "c") - - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - len = format(msg, 255, "%L", players[i], "ADMIN") - - if (activity == 1) - len += copy(msg[len], 255-len, ":") - else - len += format(msg[len], 255-len, " %s:", name) - - len += format(msg[len], 255-len, " %L", players[i], "BAN") - len += format(msg[len], 255-len, " %s ", name2) - + len = formatex(msg, charsmax(msg), "%L", i, "BAN"); + len += formatex(msg[len], charsmax(msg) - len, " %s ", name2); if (nNum) - format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes) + { + formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes); + } else - format(msg[len], 255-len, "%L", players[i], "PERM") - - client_print(players[i], print_chat, "%s", msg) + { + formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM"); + } + show_activity_id(i, id, name, msg); } } + console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2) return PLUGIN_HANDLED @@ -299,7 +283,10 @@ public cmdBanIP(id, level, cid) new player = cmd_target(id, target, 9) if (!player) + { + player = cmd_target(id, target, 9); return PLUGIN_HANDLED + } new authid[32], name2[32], authid2[32], name[32] new userid2 = get_user_userid(player) @@ -326,32 +313,29 @@ public cmdBanIP(id, level, cid) else server_cmd("kick #%d ^"%s %s^";wait;addip ^"%s^" ^"%s^";wait;writeip", userid2, banned, temp, minutes, address) - new activity = get_pcvar_num(amx_show_activity) - if (activity != 0) + // Display the message to all clients + + new msg[256]; + new len; + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, msg[256], len - get_players(players, pnum, "c") - - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - len = format(msg, 255, "%L", players[i], "ADMIN") - - if (activity == 1) - len += copy(msg[len], 255-len, ":") - else - len += format(msg[len], 255-len, " %s:", name) - - len += format(msg[len], 255-len, " %L", players[i], "BAN") - len += format(msg[len], 255-len, " %s ", name2) - + len = formatex(msg, charsmax(msg), "%L", i, "BAN"); + len += formatex(msg[len], charsmax(msg) - len, " %s ", name2); if (nNum) - format(msg[len], 255-len, "%L", players[i], "FOR_MIN", minutes) + { + formatex(msg[len], charsmax(msg) - len, "%L", i, "FOR_MIN", minutes); + } else - format(msg[len], 255-len, "%L", players[i], "PERM") - - client_print(players[i], print_chat, "%s", msg) + { + formatex(msg[len], charsmax(msg) - len, "%L", i, "PERM"); + } + show_activity_id(i, id, name, msg); } } + console_print(id, "[AMXX] %L", id, "CLIENT_BANNED", name2) return PLUGIN_HANDLED @@ -382,11 +366,8 @@ public cmdSlay(id, level, cid) log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2) - } + show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2); + console_print(id, "[AMXX] %L", id, "CLIENT_SLAYED", name2) return PLUGIN_HANDLED @@ -420,11 +401,8 @@ public cmdSlap(id, level, cid) 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) - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_2", name, name2, damage) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_1", name2, damage) - } + show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, damage); + console_print(id, "[AMXX] %L", id, "CLIENT_SLAPED", name2, damage) return PLUGIN_HANDLED @@ -454,11 +432,7 @@ public cmdMap(id, level, cid) get_user_authid(id, authid, 31) get_user_name(id, name, 31) - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_2", name, arg) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_MAP_1", arg) - } + 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) @@ -545,29 +519,26 @@ public cmdCvar(id, level, cid) set_cvar_string(arg, arg2) - new activity = get_pcvar_num(amx_show_activity) - if (activity != 0) - { - new players[32], pnum, admin[64], cvar_val[64], len - get_players(players, pnum, "c") - - for (new i = 0; i < pnum; i++) - { - len = format(admin, 255, "%L", players[i], "ADMIN") - - if (activity == 1) - len += copy(admin[len], 255-len, ":") - else - len += format(admin[len], 255-len, " %s:", name) + // Display the message to all clients - if (get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(arg,"rcon_password")) - format(cvar_val, 63, "*** %L ***", players[i], "PROTECTED") + new cvar_val[64]; + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) + { + if (is_user_connected(i) && !is_user_bot(i)) + { + if (get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(arg, "rcon_password")) + { + formatex(cvar_val, charsmax(cvar_val), "*** %L ***", i, "PROTECTED"); + } else - copy(cvar_val, 63, arg2) - - client_print(players[i], print_chat, "%L", players[i], "SET_CVAR_TO", admin, arg, cvar_val) + { + copy(cvar_val, charsmax(cvar_val), arg2); + } + show_activity_id(i, id, name, "%L", i, "SET_CVAR_TO", "", arg, cvar_val); } } + console_print(id, "[AMXX] %L", id, "CVAR_CHANGED", arg, arg2) return PLUGIN_HANDLED @@ -699,11 +670,7 @@ public cmdCfg(id, level, cid) console_print(id, "[AMXX] Executing file ^"%s^"", arg) server_cmd("exec %s", arg) - switch(get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_2", name, arg) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_CONF_1", arg) - } + show_activity_key("ADMIN_CONF_1", "ADMIN_CONF_2", name, arg); return PLUGIN_HANDLED } @@ -759,25 +726,17 @@ public cmdPause(id, level, cid) console_print(id, "[AMXX] %L", id, g_Paused ? "UNPAUSING" : "PAUSING") - new activity = get_pcvar_num(amx_show_activity) - if (activity != 0) + // Display the message to all clients + + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, msg[128], len - get_players(players, pnum, "c") - - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - len = format(msg, 127, "%L", players[i], "ADMIN") - - if (activity == 1) - len += copy(msg[len], 127-len, ": ") - else - len += format(msg[len], 127-len, " %s: ", name) - - format(msg[len], 127-len, "%L", players[i], g_Paused ? "UNPAUSE" : "PAUSE") - client_print(players[i], print_chat, "%s server", msg) + show_activity_id(i, id, name, "%L server", i, g_Paused ? "UNPAUSE" : "PAUSE"); } } + g_pauseCon = id return PLUGIN_HANDLED @@ -927,11 +886,7 @@ public cmdLeave(id, level, cid) get_user_name(id, name, 31) 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]) - switch(get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_2", name, ltags[0], ltags[1], ltags[2], ltags[3]) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_LEAVE_1", 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]); return PLUGIN_HANDLED } @@ -960,11 +915,8 @@ public cmdNick(id, level, cid) 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) - switch (get_pcvar_num(amx_show_activity)) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_NICK_2", name, name2, arg2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_NICK_1", name2, arg2) - } + show_activity_key("ADMIN_NICK_1", "ADMIN_NICK_2", name, name2, arg2); + console_print(id, "[AMXX] %L", id, "CHANGED_NICK", name2, arg2) return PLUGIN_HANDLED diff --git a/plugins/adminvote.sma b/plugins/adminvote.sma index 5a10f93f..07588399 100755 --- a/plugins/adminvote.sma +++ b/plugins/adminvote.sma @@ -82,17 +82,20 @@ public cmdCancelVote(id, level, cid) get_user_authid(id, authid, 31) get_user_name(id, name, 31) log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid) - - new players[32], pnum, lTag[16], activity = get_cvar_num("amx_show_activity") - get_players(players, pnum, "c") - - for (new i = 0; i < pnum;i ++) + + + new maxpl=get_maxplayers(); + new msg[256]; + for (new i = 1; i <= maxpl; i++) { - format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER") - switch (activity) + if (is_user_connected(i) && !is_user_bot(i)) { - case 2: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_2", lTag, name) - case 1: client_print(players[i], print_chat, "%L", LANG_PLAYER, "ADMIN_CANC_VOTE_1", lTag) + // HACK: ADMIN_CANC_VOTE_{1,2} keys were designed very poorly. Remove all : and %s in it. + LookupLangKey(msg, charsmax(msg), "ADMIN_CANC_VOTE_1", i); + replace_all(msg, charsmax(msg), "%s", ""); + replace_all(msg, charsmax(msg), ":", ""); + trim(msg); + show_activity_id(i, id, name, msg); } } @@ -311,22 +314,18 @@ public cmdVoteMap(id, level, cid) else log_amx("Vote: ^"%s<%d><%s><>^" vote maps (map#1 ^"%s^") (map#2 ^"%s^") (map#3 ^"%s^") (map#4 ^"%s^")", name, get_user_userid(id), authid, g_optionName[0], g_optionName[1], g_optionName[2], g_optionName[3]) - new lTag[16], activity = get_cvar_num("amx_show_activity") - - if (activity > 0) + new maxpl=get_maxplayers(); + new msg[256]; + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum - - get_players(players, pnum, "c") - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER") - - switch (activity) - { - case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_2", lTag, name) - case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_MAP_1", lTag) - } + // HACK: ADMIN_VOTE_MAP_{1,2} keys were designed very poorly. Remove all : and %s in it. + LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_MAP_1", i); + replace_all(msg, charsmax(msg), "%s", ""); + replace_all(msg, charsmax(msg), ":", ""); + trim(msg); + show_activity_id(i, id, name, msg); } } @@ -386,22 +385,18 @@ public cmdVote(id, level, cid) get_user_name(id, name, 31) log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1]) - new activity = get_cvar_num("amx_show_activity") - - if (activity > 0) + new maxpl=get_maxplayers(); + new msg[256]; + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, lTag[16] - - get_players(players, pnum, "c") - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER") - - switch (activity) - { - case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_2", lTag, name) - case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_CUS_1", lTag) - } + // HACK: ADMIN_VOTE_CUS_{1,2} keys were designed very poorly. Remove all : and %s in it. + LookupLangKey(msg, charsmax(msg), "ADMIN_VOTE_CUS_1", i); + replace_all(msg, charsmax(msg), "%s", ""); + replace_all(msg, charsmax(msg), ":", ""); + trim(msg); + show_activity_id(i, id, name, msg); } } @@ -502,7 +497,6 @@ public cmdVoteKickBan(id, level, cid) { get_user_authid(player, g_optionName[0], sizeof(g_optionName[])-1); - server_print("g_optionName==^"%s^"",g_optionName[0]); // Do the same check that's in plmenu to determine if this should be an IP ban instead if (equal("4294967295", g_optionName[0]) || equal("HLTV", g_optionName[0]) @@ -526,22 +520,21 @@ public cmdVoteKickBan(id, level, cid) get_user_name(id, name, 31) log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg) - new activity = get_cvar_num("amx_show_activity") - if (activity > 0) + new maxpl=get_maxplayers(); + new msg[256]; + new right[256]; + new dummy[1]; + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, lTag[16] - - get_players(players, pnum, "c") - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - format(lTag, 15, "%L", players[i], is_user_admin(id) ? "ADMIN" : "PLAYER") - format(lKickBan, 15, "%L", players[i], voteban ? "BAN" : "KICK") + formatex(lKickBan, charsmax(lKickBan), "%L", i, voteban ? "BAN" : "KICK"); - switch (activity) - { - case 2: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_2", lTag, name, lKickBan, arg) - case 1: client_print(players[i], print_chat, "%L", players[i], "ADMIN_VOTE_FOR_1", lTag, lKickBan, arg) - } + // HACK: ADMIN_VOTE_FOR{1,2} keys are really weird. Tokenize and ignore the text before the : + LookupLangKey(msg, charsmax(msg), "ADMIN_CANC_VOTE_1", i); + strtok(msg, dummy, 0, right, charsmax(right), ':'); + trim(right); + show_activity_id(i, id, name, right, lKickBan, arg); } } diff --git a/plugins/cmdmenu.sma b/plugins/cmdmenu.sma index 04e8f789..2db380ec 100755 --- a/plugins/cmdmenu.sma +++ b/plugins/cmdmenu.sma @@ -90,6 +90,7 @@ new g_menuLayer[33] new g_coloredMenus + public plugin_init() { register_plugin("Commands Menu", AMXX_VERSION_STR, "AMXX Dev Team") diff --git a/plugins/include/amxmisc.inc b/plugins/include/amxmisc.inc index 4db2d4a3..d8bfc7cd 100755 --- a/plugins/include/amxmisc.inc +++ b/plugins/include/amxmisc.inc @@ -172,27 +172,308 @@ stock cmd_target(id,const arg[],flags = 1) return player; } -stock show_activity( id, const name[], any:... ) +/** + * Standard method to show activity to clients connected to the server. + * This depends on the amx_show_activity cvar. See documentation for more details. + * + * @param id The user id of the person doing the action. + * @param name The name of the person doing the action. + * @param fmt The format string to display. Do not put the "ADMIN:" prefix in this. + */ +stock show_activity( id, const name[], const fmt[], any:... ) { + static __amx_show_activity; + if (__amx_show_activity == 0) + { + __amx_show_activity = get_cvar_pointer("amx_show_activity"); + + // if still not found, then register the cvar as a dummy + if (__amx_show_activity == 0) + { + __amx_show_activity = register_cvar("amx_show_activity", "2"); + } + } +#if defined AMXMOD_BCOMPAT new buffer[128]; format_args( buffer , 127 , 2 ); - switch(get_cvar_num("amx_show_activity")) +#else + new prefix[10]; + if (is_user_admin(id)) + { + copy(prefix, charsmax(prefix), "ADMIN"); + } + else + { + copy(prefix, charsmax(prefix), "PLAYER"); + } + new buffer[512]; + vformat(buffer, charsmax(buffer), fmt, 3); +#endif + switch(get_pcvar_num(__amx_show_activity)) { - case 2: #if defined AMXMOD_BCOMPAT + case 2: // show name to all + { client_print(0, print_chat, "%s %s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), name, buffer); -#else - client_print(0, print_chat, "%L %s: %s", id, is_user_admin(id) ? "ADMIN" : "PLAYER" , name , buffer ); -#endif - case 1: -#if defined AMXMOD_BCOMPAT + } + case 1: // hide name to all + { client_print(0, print_chat, "%s: %s", is_user_admin(id) ? SIMPLE_T("ADMIN") : SIMPLE_T("PLAYER"), buffer); + } #else - client_print(0, print_chat, "%L: %s", id, is_user_admin(id) ? "ADMIN" : "PLAYER", buffer ); + case 5: // hide name only to admins, show nothing to normal users + { + new __maxclients=get_maxplayers(); + + + for (new i=1; i<__maxclients; i++) + { + if (is_user_connected(i)) + { + if (is_user_admin(i)) + { + client_print(i, print_chat, "%L: %s", i, prefix, buffer); + } + } + } + } + case 4: // show name only to admins, show nothing to normal users + { + new __maxclients=get_maxplayers(); + + for (new i=1; i<__maxclients; i++) + { + if (is_user_connected(i)) + { + if (is_user_admin(i)) + { + client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer); + } + } + } + } + case 3: // show name only to admins, hide name from normal users + { + new __maxclients=get_maxplayers(); + + for (new i=1; i<__maxclients; i++) + { + if (is_user_connected(i)) + { + if (is_user_admin(i)) + { + client_print(i, print_chat, "%L %s: %s", i, prefix, name, buffer); + } + else + { + client_print(i, print_chat, "%L: %s", i, prefix, buffer); + } + } + } + } + case 2: // show name to all + { + client_print(0, print_chat, "%L %s: %s", LANG_PLAYER, prefix , name , buffer ); + } + case 1: // hide name to all + { + client_print(0, print_chat, "%L: %s", LANG_PLAYER, prefix, buffer ); + } #endif } } +/** + * Standard method to show activity to one single client. + * This is useful for messages that get pieced together by many language keys. + * This depends on the amx_show_activity cvar. See documentation for more details. + * + * @param idtarget The user id of the person to display to. 0 is invalid. + * @param idadmin The user id of the person doing the action. + * @param name The name of the person doing the action. + * @param fmt The format string to display. Do not put the "ADMIN:" prefix in this. + */ +stock show_activity_id(idtarget, idadmin, const name[], const fmt[], any:...) +{ + if (idtarget == 0 || + !is_user_connected(idtarget) ) + { + return; + } + + static __amx_show_activity; + if (__amx_show_activity == 0) + { + __amx_show_activity = get_cvar_pointer("amx_show_activity"); + + // if still not found, then register the cvar as a dummy + if (__amx_show_activity == 0) + { + __amx_show_activity = register_cvar("amx_show_activity", "2"); + } + } + + static prefix[10]; + if (is_user_admin(idadmin)) + { + copy(prefix, charsmax(prefix), "ADMIN"); + } + else + { + copy(prefix, charsmax(prefix), "PLAYER"); + } + + static buffer[512]; + vformat(buffer, charsmax(buffer), fmt, 5); + + + switch(get_pcvar_num(__amx_show_activity)) + { + case 5: // hide name only to admins, show nothing to normal users + { + if ( is_user_admin(idtarget) ) + { + client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer); + } + } + case 4: // show name only to admins, show nothing to normal users + { + if ( is_user_admin(idtarget) ) + { + client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer); + } + } + case 3: // show name only to admins, hide name from normal users + { + if ( is_user_admin(idtarget) ) + { + client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer); + } + else + { + client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer); + } + } + case 2: // show name to all + { + client_print(idtarget, print_chat, "%L %s: %s", idtarget, prefix, name, buffer); + } + case 1: // hide name to all + { + client_print(idtarget, print_chat, "%L: %s", idtarget, prefix, buffer); + } + } +} +/** + * Standard method to show activity to one single client with normal language keys. + * These keys need to be in the format of standard AMXX keys: + * eg: ADMIN_KICK_1 = ADMIN: kick %s + * ADMIN_KICK_2 = ADMIN %s: kick %s + * This depends on the amx_show_activity cvar. See documentation for more details. + * + * @param KeyWithoutName The language key that does not have the name field. + * @param KeyWithName The language key that does have the name field. + * @param __AdminName The name of the person doing the action. + * @extra Pass any extra format arguments for the language key in the variable arguments list. + */ +stock show_activity_key(const KeyWithoutName[], const KeyWithName[], const ___AdminName[], any:...) +{ +// The variable gets used via vformat, but the compiler doesn't know that, so it still cries. +#pragma unused ___AdminName + static __amx_show_activity; + if (__amx_show_activity == 0) + { + __amx_show_activity = get_cvar_pointer("amx_show_activity"); + + // if still not found, then register the cvar as a dummy + if (__amx_show_activity == 0) + { + __amx_show_activity = register_cvar("amx_show_activity", "2"); + } + } + + new buffer[512]; + new keyfmt[256]; + new i; + + new __maxclients=get_maxplayers(); + + switch( get_pcvar_num(__amx_show_activity) ) + { + case 5: // hide name to admins, display nothing to normal players + while (i++ < __maxclients) + { + if ( is_user_connected(i) ) + { + if ( is_user_admin(i) ) + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i); + + // skip the "adminname" argument if not showing name + vformat(buffer, charsmax(buffer), keyfmt, 4); + client_print(i, print_chat, "%s", buffer); + } + } + } + case 4: // show name only to admins, display nothing to normal players + while (i++ < __maxclients) + { + if ( is_user_connected(i) ) + { + if ( is_user_admin(i) ) + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i); + vformat(buffer, charsmax(buffer), keyfmt, 3); + client_print(i, print_chat, "%s", buffer); + } + } + } + case 3: // show name only to admins, hide name from normal users + while (i++ < __maxclients) + { + if ( is_user_connected(i) ) + { + if ( is_user_admin(i) ) + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i); + vformat(buffer, charsmax(buffer), keyfmt, 3); + } + else + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i); + + // skip the "adminname" argument if not showing name + vformat(buffer, charsmax(buffer), keyfmt, 4); + } + client_print(i, print_chat, "%s", buffer); + } + } + case 2: // show name to all users + while (i++ < __maxclients) + { + if ( is_user_connected(i) ) + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithName, i); + vformat(buffer, charsmax(buffer), keyfmt, 3); + client_print(i, print_chat, "%s", buffer); + } + } + case 1: // hide name from all users + while (i++ < __maxclients) + { + if ( is_user_connected(i) ) + { + LookupLangKey(keyfmt, charsmax(keyfmt), KeyWithoutName, i); + + // skip the "adminname" argument if not showing name + vformat(buffer, charsmax(buffer), keyfmt, 4); + client_print(i, print_chat, "%s", buffer); + } + } + + } +} + stock colored_menus() { new mod_name[32]; diff --git a/plugins/lang/pausecfg.txt b/plugins/lang/pausecfg.txt index ea66f481..4012626d 100755 --- a/plugins/lang/pausecfg.txt +++ b/plugins/lang/pausecfg.txt @@ -13,6 +13,7 @@ PAUSED_PLUGIN = Paused %d plugin PAUSED_PLUGINS = Paused %d plugins UNPAUSED_PLUGIN = Unpaused %d plugin UNPAUSED_PLUGINS = Unpaused %d plugins +CANT_UNPAUSE_PLUGIN = Plugin "%s" is stopped and cannot be unpaused. CANT_MARK_MORE = Can't mark more plugins as unpauseable! PAUSE_LOADED = Pause Plugins: Loaded plugins STOPPED = stopped @@ -32,6 +33,10 @@ COM_PAUSE_SAVE = ^tsave - saves a list of stopped plugins COM_PAUSE_CLEAR = ^tclear - clears a list of stopped plugins COM_PAUSE_LIST = ^tlist [id] - lists plugins COM_PAUSE_ADD = ^tadd - marks a plugin as unpauseable +SAVE_PAUSED = Save paused +COM_PAUSE_SAVE_PAUSED = ^tsave - saves a list of paused plugins +COM_PAUSE_CLEAR_PAUSED = ^tclear - clears a list of paused plugins + [de] PAUSE_COULDNT_FIND = Konnte kein Plugin finden, dass mit "%s" uebereinstimmt @@ -102,6 +107,7 @@ COM_PAUSE_SAVE = ^tsave - snima listu zaustavljenih pluginova COM_PAUSE_CLEAR = ^tclear - prazni listu zaustavljenih pluginova COM_PAUSE_LIST = ^tlist [id] - lista pluginove COM_PAUSE_ADD = ^tadd <title> - zakljucava plugin +SAVE_STOPPED = Sacuvaj stopirane [tr] PAUSE_COULDNT_FIND = "%s" Buna benzer bir plugin bulunamadi diff --git a/plugins/ns/nscommands.sma b/plugins/ns/nscommands.sma index 244113ab..3d7ac332 100755 --- a/plugins/ns/nscommands.sma +++ b/plugins/ns/nscommands.sma @@ -174,10 +174,9 @@ public cmdRandom(id,level,cid) { get_user_authid(id,auth,31); get_user_authid(player,auth_targ,31); log_amx("Cmd: ^"%s<%d><%s><>^" random ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: random %s",name,name_targ); - case 1: client_print(0,print_chat,"ADMIN: random %s",name_targ); - } + + show_activity(id, name, "random %s", name_targ); + client_cmd(player, "%s", g_AutoAssignAck); } else { @@ -198,10 +197,9 @@ public cmdRandom(id,level,cid) { get_user_name(id,name,31); get_user_authid(id,auth,31); log_amx("Cmd: ^"%s<%d><%s><>^" random all",name,get_user_userid(id),auth); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: random all",name); - case 1: client_print(0,print_chat,"ADMIN: random all"); - } + + show_activity(id, name, "random all"); + randomStep(1); } else { client_print(id,print_chat,"[AMXX] There is nobody in the readyroom."); @@ -242,10 +240,9 @@ public cmdReadyRoom(id,level,cid) { get_user_authid(id,auth,31); get_user_authid(player,auth_targ,31); log_amx("Cmd: ^"%s<%d><%s><>^" ready room ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: ready room %s",name,name_targ); - case 1: client_print(0,print_chat,"ADMIN: ready room %s",name_targ); - } + + show_activity(id, name, "ready room %s", name_targ); + client_cmd(player, "%s", g_ReadyRoomAck); } else { @@ -264,10 +261,9 @@ public cmdReadyRoom(id,level,cid) { get_user_name(id,name,31); get_user_authid(id,auth,31); log_amx("Cmd: ^"%s<%d><%s><>^" ready room all",name,get_user_userid(id),auth); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: ready room all",name); - case 1: client_print(0,print_chat,"ADMIN: ready room all"); - } + + show_activity(id, name, "ready room all"); + rrStep(1); } else { client_print(id,print_chat,"[AMXX] There is nobody on a team."); @@ -311,10 +307,9 @@ public cmdTeamTwo(id,level,cid) { get_user_authid(id,auth,31); get_user_authid(player,auth_targ,31); log_amx("Cmd: ^"%s<%d><%s><>^" alien ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: alien %s",name,name_targ); - case 1: client_print(0,print_chat,"ADMIN: alien %s",name_targ); - } + + show_activity(id, name, "alien %s", name_targ); + client_cmd(player, "%s", g_TeamTwoAck); } return PLUGIN_HANDLED_MAIN; @@ -340,10 +335,9 @@ public cmdTeamOne(id,level,cid) { get_user_authid(id,auth,31); get_user_authid(player,auth_targ,31); log_amx("Cmd: ^"%s<%d><%s><>^" marine ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: marine %s",name,name_targ); - case 1: client_print(0,print_chat,"ADMIN: marine %s",name_targ); - } + + show_activity(id, name, "marine %s", name_targ); + client_cmd(player, "%s", g_TeamOneAck); } return PLUGIN_HANDLED_MAIN; @@ -365,10 +359,8 @@ public cmdUnComm(id,level,cid) { get_user_authid(id,auth,31); get_user_authid(comm,auth_targ,31); log_amx("Cmd: ^"%s<%d><%s><>^" uncomm ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(comm),auth_targ); - switch (get_cvar_num("amx_show_activity")) { - case 2: client_print(0,print_chat,"ADMIN %s: uncomm %s",name,name_targ); - case 1: client_print(0,print_chat,"ADMIN: uncomm %s",name_targ); - } + + show_activity(id, name, "uncomm %s", name_targ); } else { client_print(id,print_chat,"[AMXX] There is no commander to eject."); diff --git a/plugins/plmenu.sma b/plugins/plmenu.sma index c10e5857..4532029f 100755 --- a/plugins/plmenu.sma +++ b/plugins/plmenu.sma @@ -152,33 +152,22 @@ public actionBanMenu(id, key) log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id]) - switch (get_cvar_num("amx_show_activity")) + if (g_menuSettings[id]==0) // permanent { - case 2: + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - if (g_menuSettings[id]==0) // permanent - { - client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "PERM"); - } - else - { - new tempTime[32]; - formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); - client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); - } + show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "PERM"); } - case 1: + } + else + { + new tempTime[32]; + formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - if (g_menuSettings[id]==0) // permanent - { - client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "PERM"); - } - else - { - new tempTime[32]; - formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); - client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); - } + show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime); } } /* ---------- check for Steam ID added by MistaGee -------------------- @@ -328,20 +317,12 @@ public actionSlapMenu(id, key) if (g_menuOption[id]) { log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, g_menuSettings[id], name2, get_user_userid(player), authid2) - - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_2", name, name2, g_menuSettings[id]) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAP_1", name2, g_menuSettings[id]) - } + + show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]); } else { log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_2", name, name2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_SLAY_1", name2) - } + show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2); } if (g_menuOption[id]) @@ -469,12 +450,9 @@ public actionKickMenu(id, key) log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2) - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_2", name, name2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_KICK_1", name2) - } + show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2); + server_cmd("kick #%d", userid2) server_exec() @@ -575,11 +553,7 @@ public actionTeamMenu(id, key) log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_menuOption[id] ? "TERRORIST" : "CT") - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TRANSF_2", name, name2, g_menuOption[id] ? "TERRORIST" : "CT") - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TRANSF_1", name2, g_menuOption[id] ? "TERRORIST" : "CT") - } + show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_menuOption[id] ? "TERRORIST" : "CT"); if (g_cstrike) { diff --git a/plugins/pluginmenu.sma b/plugins/pluginmenu.sma index 24a967a2..4a56acd4 100644 --- a/plugins/pluginmenu.sma +++ b/plugins/pluginmenu.sma @@ -34,9 +34,6 @@ #include <amxmodx> #include <amxmisc> -// Temporary define for having users test on their core. -// This will ensure that the build will work on 1.76. -#define BUILD_FOR_176 new DisabledCallback; @@ -148,9 +145,8 @@ stock DisplayPluginMenu(id,const MenuText[], const Handler[], const Command[], c } } } -#if !defined BUILD_FOR_176 + menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y"); -#endif menu_setprop(Menu,MPROP_EXIT,MEXIT_ALL); menu_display(id,Menu,0); @@ -404,11 +400,7 @@ public CommandChangeCvar(id) // Changed to set_cvar_* for 1.76 tests new pointer=CurrentCvar[id]; -#if defined BUILD_FOR_176 - set_cvar_string(CurrentCvarName[id],Args); -#else set_pcvar_string(CurrentCvar[id],Args); -#endif client_print(id,print_chat,"[AMXX] Cvar ^"%s^" changed to ^"%s^"",CurrentCvarName[id],Args); @@ -420,42 +412,24 @@ public CommandChangeCvar(id) get_user_name(id,Name,sizeof(Name)-1); get_user_authid(id,AuthID,sizeof(AuthID)-1); - // TODO: Additional amx_show_activity settings log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", Name, get_user_userid(id), AuthID, CurrentCvarName[id], Args); - new activity = get_cvar_num("amx_show_activity"); - - if (activity != 0) + new cvar_val[64]; + new maxpl = get_maxplayers(); + for (new i = 1; i <= maxpl; i++) { - new players[32], pnum, admin[64], cvar_val[64], len; - get_players(players, pnum, "c"); - - for (new i = 0; i < pnum; i++) + if (is_user_connected(i) && !is_user_bot(i)) { - len = format(admin, 255, "%L", players[i], "ADMIN"); - - if (activity == 1) + if (get_pcvar_flags(pointer) & FCVAR_PROTECTED || equali(Args, "rcon_password")) { - len += copy(admin[len], 255-len, ":"); + formatex(cvar_val, charsmax(cvar_val), "*** %L ***", i, "PROTECTED"); } else { - len += format(admin[len], 255-len, " %s:", Name); + copy(cvar_val, charsmax(cvar_val), Args); } - - if (get_pcvar_flags(pointer) & FCVAR_PROTECTED || - equali(CurrentCvarName[id],"rcon_password") || - equali(CurrentCvarName[id],"amx_sql_",8)) - { - format(cvar_val, 63, "*** %L ***", players[i], "PROTECTED"); - } - else - { - copy(cvar_val, 63, Args); - } - - client_print(players[i], print_chat, "%L", players[i], "SET_CVAR_TO", admin, CurrentCvarName[id], cvar_val); + show_activity_id(i, id, Name, "%L", i, "SET_CVAR_TO", "", CurrentCvarName[id], cvar_val); } } console_print(id, "[AMXX] %L", id, "CVAR_CHANGED", CurrentCvarName[id], Args); @@ -591,9 +565,7 @@ public DisplayCvarMenu(id, plid, page) } menu_setprop(Menu,MPROP_EXIT,MEXIT_ALL); -#if !defined BUILD_FOR_176 menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y"); -#endif menu_display(id,Menu,page); } @@ -739,9 +711,7 @@ stock DisplaySpecificCommand(id,cid) menu_additem(Menu,"Execute with parameters.",CommandName,_,EnabledCallback); menu_additem(Menu,"Execute with no parameters.",CommandName,_,EnabledCallback); -#if !defined BUILD_FOR_176 menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y"); -#endif menu_display(id,Menu,0); } @@ -917,9 +887,7 @@ public DisplayCmdMenu(id, plid, page) } } } -#if !defined BUILD_FOR_176 menu_setprop(Menu,MPROP_NUMBER_COLOR,"\y"); -#endif menu_display(id,Menu,page); } diff --git a/plugins/telemenu.sma b/plugins/telemenu.sma index ca4057d8..d2d0b7a9 100755 --- a/plugins/telemenu.sma +++ b/plugins/telemenu.sma @@ -105,11 +105,7 @@ public actionTelMenu(id, key) log_amx("Cmd: ^"%s<%d><%s><>^" teleport ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) - switch (get_cvar_num("amx_show_activity")) - { - case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TELEPORT_2", name, name2) - case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TELEPORT_1", name2) - } + show_activity_key("ADMIN_TELEPORT_1", "ADMIN_TELEPORT_2", name, name2); displayTelMenu(id, g_menuPosition[id]) }