From cfc92ca3db115d6227acbea4b5c43460932562d6 Mon Sep 17 00:00:00 2001 From: Freeman-AM Date: Fri, 30 Jan 2015 00:57:45 +0100 Subject: [PATCH] Plmenu: small update: formatex, semicolon, missing things, remove useless TABs --- plugins/plmenu.sma | 827 ++++++++++++++++++++++----------------------- 1 file changed, 412 insertions(+), 415 deletions(-) diff --git a/plugins/plmenu.sma b/plugins/plmenu.sma index b9d00917..b49e78e5 100755 --- a/plugins/plmenu.sma +++ b/plugins/plmenu.sma @@ -19,25 +19,27 @@ #include #include -new g_menuPosition[MAX_PLAYERS] -new g_menuPlayers[MAX_PLAYERS][32] -new g_menuPlayersNum[MAX_PLAYERS] -new g_menuOption[MAX_PLAYERS] -new g_menuSettings[MAX_PLAYERS] +#pragma semicolon 1 -new g_menuSelect[MAX_PLAYERS][64] -new g_menuSelectNum[MAX_PLAYERS] +new g_menuPosition[MAX_PLAYERS]; +new g_menuPlayers[MAX_PLAYERS][32]; +new g_menuPlayersNum[MAX_PLAYERS]; +new g_menuOption[MAX_PLAYERS]; +new g_menuSettings[MAX_PLAYERS]; + +new g_menuSelect[MAX_PLAYERS][64]; +new g_menuSelectNum[MAX_PLAYERS]; #define MAX_CLCMDS 24 -new g_clcmdName[MAX_CLCMDS][32] -new g_clcmdCmd[MAX_CLCMDS][64] -new g_clcmdMisc[MAX_CLCMDS][2] -new g_clcmdNum +new g_clcmdName[MAX_CLCMDS][32]; +new g_clcmdCmd[MAX_CLCMDS][64]; +new g_clcmdMisc[MAX_CLCMDS][2]; +new g_clcmdNum; -new g_coloredMenus -new g_cstrike = 0 -new g_fakemeta = 0, m_iMenu, m_bTeamChanged, Menu_ChooseAppearance +new g_coloredMenus; +new g_cstrike = 0; +new g_fakemeta = 0, m_iMenu, m_bTeamChanged, Menu_ChooseAppearance; new Array:g_bantimes; new Array:g_slapsettings; @@ -46,54 +48,53 @@ new g_CSTeamNames[3][] = { "TERRORIST", "CT", "SPECTATOR" -} +}; new g_CSTeamNumbers[3][] = { "1", "2", "6" -} +}; new g_CSTeamiNumbers[3] = { 1, 2, 3 -} +}; -new g_CSPlayerCanSwitchFromSpec[MAX_PLAYERS] -new g_transferingAdmin +new g_CSPlayerCanSwitchFromSpec[MAX_PLAYERS]; +new g_transferingAdmin; -new allow_spectators, mp_limitteams +new allow_spectators, mp_limitteams; new p_amx_tempban_maxtime; new Trie:g_tempBans; -new g_silent[33] +new g_silent[MAX_PLAYERS]; public plugin_natives() { - set_module_filter("module_filter") - set_native_filter("native_filter") + set_module_filter("module_filter"); + set_native_filter("native_filter"); } public plugin_init() { - register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team") - register_dictionary("common.txt") - register_dictionary("admincmd.txt") - register_dictionary("plmenu.txt") + register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team"); + register_dictionary("common.txt"); + register_dictionary("admincmd.txt"); + register_dictionary("plmenu.txt"); - register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu") - register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN|ADMIN_BAN_TEMP, "- displays ban menu") - register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu") - register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu") - register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu") + register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu"); + register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN|ADMIN_BAN_TEMP, "- displays ban menu"); + register_clcmd("amx_slapmenu", "cmdSlapMenu", ADMIN_SLAY, "- displays slap/slay menu"); + register_clcmd("amx_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu"); + register_clcmd("amx_clcmdmenu", "cmdClcmdMenu", ADMIN_LEVEL_A, "- displays client cmds menu"); + + register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu"); + register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu"); + register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu"); + register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu"); + register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu"); - register_menucmd(register_menuid("Ban Menu"), 1023, "actionBanMenu") - register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu") - register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu") - register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu") - register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu") - - g_bantimes = ArrayCreate(); // Load up the old default values ArrayPushCell(g_bantimes, 0); @@ -103,54 +104,52 @@ public plugin_init() ArrayPushCell(g_bantimes, 30); ArrayPushCell(g_bantimes, 45); ArrayPushCell(g_bantimes, 60); - - + g_slapsettings = ArrayCreate(); // Old default values ArrayPushCell(g_slapsettings, 0); // slap 0 damage ArrayPushCell(g_slapsettings, 1); ArrayPushCell(g_slapsettings, 5); ArrayPushCell(g_slapsettings, 0); // Last option is ignored - it is slay - - + register_srvcmd("amx_plmenu_bantimes", "plmenu_setbantimes"); register_srvcmd("amx_plmenu_slapdmg", "plmenu_setslapdmg"); - g_coloredMenus = colored_menus() + g_coloredMenus = colored_menus(); - new clcmds_ini_file[64] - get_configsdir(clcmds_ini_file, charsmax(clcmds_ini_file)) - format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file) - load_settings(clcmds_ini_file) + new clcmds_ini_file[64]; + get_configsdir(clcmds_ini_file, charsmax(clcmds_ini_file)); + format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file); + load_settings(clcmds_ini_file); if (LibraryExists("cstrike", LibType_Library)) - g_cstrike = 1 + g_cstrike = 1; if (LibraryExists("fakemeta", LibType_Library)) { - g_fakemeta = 1 - m_iMenu = 205 - m_bTeamChanged = 501 - Menu_ChooseAppearance = 3 + g_fakemeta = 1; + m_iMenu = 205; + m_bTeamChanged = 501; + Menu_ChooseAppearance = 3; } - - new modname[9] - get_modname(modname, charsmax(modname)) + + new modname[9]; + get_modname(modname, charsmax(modname)); if( equal(modname, "cstrike") || equal(modname, "czero") ) { - register_event("TeamInfo", "Event_TeamInfo", "a", "2=TERRORIST", "2=CT") - register_event("TextMsg", "Event_TextMsg", "b", "1=4", "2=#Only_1_Team_Change") + register_event("TeamInfo", "Event_TeamInfo", "a", "2=TERRORIST", "2=CT"); + register_event("TextMsg", "Event_TextMsg", "b", "1=4", "2=#Only_1_Team_Change"); } - - allow_spectators = get_cvar_pointer("allow_spectators") - mp_limitteams = get_cvar_pointer("mp_limitteams") + + allow_spectators = get_cvar_pointer("allow_spectators"); + mp_limitteams = get_cvar_pointer("mp_limitteams"); } public plugin_cfg() { - new x = get_xvar_id("g_tempBans") + new x = get_xvar_id("g_tempBans"); if( x ) { - g_tempBans = Trie:get_xvar_num(x) + g_tempBans = Trie:get_xvar_num(x); } new amx_tempban_maxtime[] = "amx_tempban_maxtime"; p_amx_tempban_maxtime = get_cvar_pointer(amx_tempban_maxtime); @@ -165,64 +164,63 @@ public plmenu_setbantimes() { new buff[32]; new args = read_argc(); - + if (args <= 1) { server_print("usage: amx_plmenu_bantimes [time2] [time3] ..."); server_print(" use time of 0 for permanent."); - + return; } - + ArrayClear(g_bantimes); - + for (new i = 1; i < args; i++) { read_argv(i, buff, charsmax(buff)); - + ArrayPushCell(g_bantimes, str_to_num(buff)); - } - } + public plmenu_setslapdmg() { new buff[32]; new args = read_argc(); - + if (args <= 1) { server_print("usage: amx_plmenu_slapdmg [dmg2] [dmg3] ..."); server_print(" slay is automatically set for the last value."); - + return; } - + ArrayClear(g_slapsettings); - + for (new i = 1; i < args; i++) { read_argv(i, buff, charsmax(buff)); - + ArrayPushCell(g_slapsettings, str_to_num(buff)); - } ArrayPushCell(g_slapsettings, 0); // compensate for slay } + public module_filter(const module[]) { if (equali(module, "cstrike") || equali(module, "fakemeta")) - return PLUGIN_HANDLED - - return PLUGIN_CONTINUE + return PLUGIN_HANDLED; + + return PLUGIN_CONTINUE; } public native_filter(const name[], index, trap) { if (!trap) - return PLUGIN_HANDLED - - return PLUGIN_CONTINUE + return PLUGIN_HANDLED; + + return PLUGIN_CONTINUE; } /* Ban menu */ @@ -234,36 +232,36 @@ public actionBanMenu(id, key) case 7: { /* BEGIN OF CHANGES BY MISTAGEE ADDED A FEW MORE OPTIONS */ - - ++g_menuOption[id] + + ++g_menuOption[id]; g_menuOption[id] %= ArraySize(g_bantimes); g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]); - displayBanMenu(id, g_menuPosition[id]) + displayBanMenu(id, g_menuPosition[id]); } - case 8: displayBanMenu(id, ++g_menuPosition[id]) - case 9: displayBanMenu(id, --g_menuPosition[id]) + case 8: displayBanMenu(id, ++g_menuPosition[id]); + case 9: displayBanMenu(id, --g_menuPosition[id]); default: { - new banTime = g_menuSettings[id] + new banTime = g_menuSettings[id]; if( ~get_user_flags(id) & ( ADMIN_BAN | ADMIN_RCON ) && (banTime <= 0 || banTime > get_pcvar_num(p_amx_tempban_maxtime)) ) { console_print(id, "%L", id, "NO_ACC_COM"); - displayBanMenu(id, g_menuPosition[id]) - return PLUGIN_HANDLED + displayBanMenu(id, g_menuPosition[id]); + return PLUGIN_HANDLED; } - new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] - new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32] - - get_user_name(player, name2, charsmax(name2)) - get_user_authid(id, authid, charsmax(authid)) - get_user_authid(player, authid2, charsmax(authid2)) - get_user_name(id, name, charsmax(name)) - - new userid2 = get_user_userid(player) - - log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, banTime) + new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]; + new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]; + + get_user_name(player, name2, charsmax(name2)); + get_user_authid(id, authid, charsmax(authid)); + get_user_authid(player, authid2, charsmax(authid2)); + get_user_name(id, name, charsmax(name)); + + new userid2 = get_user_userid(player); + + log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, banTime); if ( !banTime ) // permanent { @@ -275,7 +273,7 @@ public actionBanMenu(id, key) else { new tempTime[32]; - formatex(tempTime,charsmax(tempTime),"%d",banTime); + num_to_str(banTime, tempTime, charsmax(tempTime)); for (new i = 1; i <= MaxClients; i++) { show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime); @@ -283,109 +281,109 @@ public actionBanMenu(id, key) } /* ---------- check for Steam ID added by MistaGee -------------------- IF AUTHID == 4294967295 OR VALVE_ID_LAN OR HLTV, BAN PER IP TO NOT BAN EVERYONE */ - + if (equal("4294967295", authid2) || equal("HLTV", authid2) || equal("STEAM_ID_LAN", authid2) || equali("VALVE_ID_LAN", authid2)) { /* END OF MODIFICATIONS BY MISTAGEE */ - new ipa[32] - get_user_ip(player, ipa, charsmax(ipa), 1) - - server_cmd("addip %d %s;writeip", banTime, ipa) + new ipa[32]; + get_user_ip(player, ipa, charsmax(ipa), 1); + + server_cmd("addip %d %s;writeip", banTime, ipa); if( g_tempBans ) { - TrieSetString(g_tempBans, ipa, authid) + TrieSetString(g_tempBans, ipa, authid); } } else { - server_cmd("banid %d #%d kick;writeid", banTime, userid2) + server_cmd("banid %d #%d kick;writeid", banTime, userid2); if( g_tempBans ) { - TrieSetString(g_tempBans, authid2, authid) + TrieSetString(g_tempBans, authid2, authid); } } - server_exec() + server_exec(); - displayBanMenu(id, g_menuPosition[id]) + displayBanMenu(id, g_menuPosition[id]); } } - - return PLUGIN_HANDLED + + return PLUGIN_HANDLED; } displayBanMenu(id, pos) { if (pos < 0) - return + return; - get_players(g_menuPlayers[id], g_menuPlayersNum[id]) + get_players(g_menuPlayers[id], g_menuPlayersNum[id]); - new menuBody[512] - new b = 0 - new i - new name[MAX_NAME_LENGTH] - new start = pos * 7 + new menuBody[512]; + new b = 0; + new i; + new name[MAX_NAME_LENGTH]; + new start = pos * 7; if (start >= g_menuPlayersNum[id]) - start = pos = g_menuPosition[id] = 0 + start = pos = g_menuPosition[id] = 0; - new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) - new end = start + 7 - new keys = MENU_KEY_0|MENU_KEY_8 + new len = formatex(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))); + new end = start + 7; + new keys = MENU_KEY_0|MENU_KEY_8; if (end > g_menuPlayersNum[id]) - end = g_menuPlayersNum[id] + end = g_menuPlayersNum[id]; for (new a = start; a < end; ++a) { - i = g_menuPlayers[id][a] - get_user_name(i, name, charsmax(name)) + i = g_menuPlayers[id][a]; + get_user_name(i, name, charsmax(name)); if (is_user_bot(i) || (access(i, ADMIN_IMMUNITY) && i != id)) { - ++b - + ++b; + if (g_coloredMenus) - len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name); else - len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name); } else { - keys |= (1< 0) { g_menuSettings[id] = ArrayGetCell(g_bantimes, g_menuOption[id]); @@ -393,11 +391,11 @@ public cmdBanMenu(id, level, cid) else { // should never happen, but failsafe - g_menuSettings[id] = 0 + g_menuSettings[id] = 0; } - displayBanMenu(id, g_menuPosition[id] = 0) + displayBanMenu(id, g_menuPosition[id] = 0); - return PLUGIN_HANDLED + return PLUGIN_HANDLED; } /* Slap/Slay */ @@ -408,143 +406,143 @@ public actionSlapMenu(id, key) { case 7: { - ++g_menuOption[id] - + ++g_menuOption[id]; + g_menuOption[id] %= ArraySize(g_slapsettings); - + g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]); - + displaySlapMenu(id, g_menuPosition[id]); } - case 8: displaySlapMenu(id, ++g_menuPosition[id]) - case 9: displaySlapMenu(id, --g_menuPosition[id]) + case 8: displaySlapMenu(id, ++g_menuPosition[id]); + case 9: displaySlapMenu(id, --g_menuPosition[id]); default: { - new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] - new name2[MAX_NAME_LENGTH] - - get_user_name(player, name2, charsmax(name2)) + new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]; + new name2[MAX_NAME_LENGTH]; + + get_user_name(player, name2, charsmax(name2)); if (!is_user_alive(player)) { - client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2) - displaySlapMenu(id, g_menuPosition[id]) - return PLUGIN_HANDLED + client_print(id, print_chat, "%L", id, "CANT_PERF_DEAD", name2); + displaySlapMenu(id, g_menuPosition[id]); + return PLUGIN_HANDLED; } - new authid[32], authid2[32], name[MAX_NAME_LENGTH] + new authid[32], authid2[32], name[MAX_NAME_LENGTH]; - get_user_authid(id, authid, charsmax(authid)) - get_user_authid(player, authid2, charsmax(authid2)) - get_user_name(id, name, charsmax(name)) + get_user_authid(id, authid, charsmax(authid)); + get_user_authid(player, authid2, charsmax(authid2)); + get_user_name(id, name, charsmax(name)); new aSize = ArraySize(g_slapsettings); if (aSize > 1 && g_menuOption[id] < aSize -1) { - 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) + 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); show_activity_key("ADMIN_SLAP_1", "ADMIN_SLAP_2", name, name2, g_menuSettings[id]); - - user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0) + + user_slap(player, (get_user_health(player) > g_menuSettings[id]) ? g_menuSettings[id] : 0); } else { // aSize == 1 or g_menuOption[id] == aSize - 1 // last option - log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2) - + log_amx("Cmd: ^"%s<%d><%s><>^" slay ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2); + show_activity_key("ADMIN_SLAY_1", "ADMIN_SLAY_2", name, name2); - - user_kill(player) + + user_kill(player); } - displaySlapMenu(id, g_menuPosition[id]) + displaySlapMenu(id, g_menuPosition[id]); } } - - return PLUGIN_HANDLED + + return PLUGIN_HANDLED; } displaySlapMenu(id, pos) { if (pos < 0) - return + return; - get_players(g_menuPlayers[id], g_menuPlayersNum[id]) + get_players(g_menuPlayers[id], g_menuPlayersNum[id]); - new menuBody[512] - new b = 0 - new i - new name[MAX_NAME_LENGTH], team[4] - new start = pos * 7 + new menuBody[512]; + new b = 0; + new i; + new name[MAX_NAME_LENGTH], team[4]; + new start = pos * 7; if (start >= g_menuPlayersNum[id]) - start = pos = g_menuPosition[id] = 0 + start = pos = g_menuPosition[id] = 0; - new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) - new end = start + 7 - new keys = MENU_KEY_0|MENU_KEY_8 + new len = formatex(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))); + new end = start + 7; + new keys = MENU_KEY_0|MENU_KEY_8; if (end > g_menuPlayersNum[id]) - end = g_menuPlayersNum[id] + end = g_menuPlayersNum[id]; for (new a = start; a < end; ++a) { - i = g_menuPlayers[id][a] - get_user_name(i, name, charsmax(name)) - + i = g_menuPlayers[id][a]; + get_user_name(i, name, charsmax(name)); + if (g_cstrike) { if (cs_get_user_team(i) == CS_TEAM_T) { - copy(team, charsmax(team), "TE") + copy(team, charsmax(team), "TE"); } else if (cs_get_user_team(i) == CS_TEAM_CT) { - copy(team, charsmax(team), "CT") + copy(team, charsmax(team), "CT"); } else { - get_user_team(i, team, charsmax(team)) + get_user_team(i, team, charsmax(team)); } } else { - get_user_team(i, team, charsmax(team)) + get_user_team(i, team, charsmax(team)); } if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id)) { - ++b - + ++b; + if (g_coloredMenus) - len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s\R%s^n\w", b, name, team) + len += formatex(menuBody[len], charsmax(menuBody) - len, "\d%d. %s\R%s^n\w", b, name, team); else - len += format(menuBody[len], charsmax(menuBody) - len, "#. %s %s^n", name, team) + len += formatex(menuBody[len], charsmax(menuBody) - len, "#. %s %s^n", name, team); } else { - keys |= (1< 0) { g_menuSettings[id] = ArrayGetCell(g_slapsettings, g_menuOption[id]); @@ -552,12 +550,12 @@ public cmdSlapMenu(id, level, cid) else { // should never happen, but failsafe - g_menuSettings[id] = 0 + g_menuSettings[id] = 0; } - displaySlapMenu(id, g_menuPosition[id] = 0) + displaySlapMenu(id, g_menuPosition[id] = 0); - return PLUGIN_HANDLED + return PLUGIN_HANDLED; } /* Kick */ @@ -566,114 +564,113 @@ public actionKickMenu(id, key) { switch (key) { - case 8: displayKickMenu(id, ++g_menuPosition[id]) - case 9: displayKickMenu(id, --g_menuPosition[id]) + case 8: displayKickMenu(id, ++g_menuPosition[id]); + case 9: displayKickMenu(id, --g_menuPosition[id]); default: { - new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key] - new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] - - get_user_authid(id, authid, charsmax(authid)) - get_user_authid(player, authid2, charsmax(authid2)) - get_user_name(id, name, charsmax(name)) - get_user_name(player, name2, charsmax(name2)) - - new userid2 = get_user_userid(player) + new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]; + new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]; - log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2) + get_user_authid(id, authid, charsmax(authid)); + get_user_authid(player, authid2, charsmax(authid2)); + get_user_name(id, name, charsmax(name)); + get_user_name(player, name2, charsmax(name2)); + + new userid2 = get_user_userid(player); + + log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", name, get_user_userid(id), authid, name2, userid2, authid2); show_activity_key("ADMIN_KICK_1", "ADMIN_KICK_2", name, name2); - - server_cmd("kick #%d", userid2) - server_exec() + server_cmd("kick #%d", userid2); + server_exec(); - displayKickMenu(id, g_menuPosition[id]) + displayKickMenu(id, g_menuPosition[id]); } } - return PLUGIN_HANDLED + return PLUGIN_HANDLED; } displayKickMenu(id, pos) { if (pos < 0) - return + return; - get_players(g_menuPlayers[id], g_menuPlayersNum[id]) + get_players(g_menuPlayers[id], g_menuPlayersNum[id]); - new menuBody[512] - new b = 0 - new i - new name[MAX_NAME_LENGTH] - new start = pos * 8 + new menuBody[512]; + new b = 0; + new i; + new name[MAX_NAME_LENGTH]; + new start = pos * 8; if (start >= g_menuPlayersNum[id]) - start = pos = g_menuPosition[id] = 0 + start = pos = g_menuPosition[id] = 0; - new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0))) - new end = start + 8 - new keys = MENU_KEY_0 + new len = formatex(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0))); + new end = start + 8; + new keys = MENU_KEY_0; if (end > g_menuPlayersNum[id]) - end = g_menuPlayersNum[id] + end = g_menuPlayersNum[id]; for (new a = start; a < end; ++a) { - i = g_menuPlayers[id][a] - get_user_name(i, name, charsmax(name)) + i = g_menuPlayers[id][a]; + get_user_name(i, name, charsmax(name)); if (access(i, ADMIN_IMMUNITY) && i != id) { - ++b - + ++b; + if (g_coloredMenus) - len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name); else - len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name); } else { - keys |= (1<<%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_CSTeamNames[destTeamSlot]) + new destTeamSlot = (g_menuOption[id] % 3); + + 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_CSTeamNames[destTeamSlot]); show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[destTeamSlot]); - + if( destTeamSlot == 2 ) { if ( g_fakemeta ) @@ -748,167 +745,167 @@ public actionTeamMenu(id, key) { if (is_user_alive(player) && (!g_silent[id] || destTeamSlot == 2)) { - new deaths = cs_get_user_deaths(player) - user_kill(player, 1) - cs_set_user_deaths(player, deaths) + new deaths = cs_get_user_deaths(player); + user_kill(player, 1); + cs_set_user_deaths(player, deaths); } - - cs_set_user_team(player, destTeamSlot + 1) + + cs_set_user_team(player, destTeamSlot + 1); } else { if (is_user_alive(player) && (!g_silent[id] || destTeamSlot == 2)) { - user_kill(player, 1) + user_kill(player, 1); } if( g_fakemeta ) { set_pdata_bool(player, m_bTeamChanged, true); } - new limit_setting + new limit_setting; if( mp_limitteams ) { - limit_setting = get_pcvar_num(mp_limitteams) - - set_pcvar_num(mp_limitteams, 0) + limit_setting = get_pcvar_num(mp_limitteams); + + set_pcvar_num(mp_limitteams, 0); } if( destTeamSlot == 2 ) { - new Float:allow_spectators_setting + new Float:allow_spectators_setting; if( allow_spectators ) { - allow_spectators_setting = get_pcvar_float(allow_spectators) + allow_spectators_setting = get_pcvar_float(allow_spectators); if( allow_spectators_setting != 1.0 ) - set_pcvar_float(allow_spectators, 1.0) + set_pcvar_float(allow_spectators, 1.0); } - engclient_cmd(player, "jointeam", g_CSTeamNumbers[destTeamSlot]) + engclient_cmd(player, "jointeam", g_CSTeamNumbers[destTeamSlot]); if( allow_spectators && allow_spectators_setting != 1.0 ) - set_pcvar_float(allow_spectators, allow_spectators_setting) + set_pcvar_float(allow_spectators, allow_spectators_setting); } else { - engclient_cmd(player, "jointeam", g_CSTeamNumbers[destTeamSlot]) - engclient_cmd(player, "joinclass", "1") + engclient_cmd(player, "jointeam", g_CSTeamNumbers[destTeamSlot]); + engclient_cmd(player, "joinclass", "1"); } if( mp_limitteams && limit_setting != 0 ) { - set_pcvar_num(mp_limitteams, limit_setting) + set_pcvar_num(mp_limitteams, limit_setting); } } if( g_cstrike ) { - cs_reset_user_model(player) + cs_reset_user_model(player); } if( g_fakemeta ) { set_pdata_bool(player, m_bTeamChanged, true); } - g_transferingAdmin = 0 - displayTeamMenu(id, g_menuPosition[id]) + g_transferingAdmin = 0; + displayTeamMenu(id, g_menuPosition[id]); } } - - return PLUGIN_HANDLED + + return PLUGIN_HANDLED; } displayTeamMenu(id, pos) { if (pos < 0) - return + return; - get_players(g_menuPlayers[id], g_menuPlayersNum[id]) + get_players(g_menuPlayers[id], g_menuPlayersNum[id]); - new menuBody[512] - new b = 0 - new i, iteam - new name[MAX_NAME_LENGTH], team[4] - new start = pos * 6 + new menuBody[512]; + new b = 0; + new i, iteam; + new name[MAX_NAME_LENGTH], team[4]; + new start = pos * 6; if (start >= g_menuPlayersNum[id]) - start = pos = g_menuPosition[id] = 0 + start = pos = g_menuPosition[id] = 0; - new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0))) - new end = start + 6 - new keys = MENU_KEY_0|MENU_KEY_7|MENU_KEY_8 + new len = formatex(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 6 + ((g_menuPlayersNum[id] % 6) ? 1 : 0))); + new end = start + 6; + new keys = MENU_KEY_0|MENU_KEY_7|MENU_KEY_8; if (end > g_menuPlayersNum[id]) - end = g_menuPlayersNum[id] + end = g_menuPlayersNum[id]; for (new a = start; a < end; ++a) { - i = g_menuPlayers[id][a] - get_user_name(i, name, charsmax(name)) - + i = g_menuPlayers[id][a]; + get_user_name(i, name, charsmax(name)); + if (g_cstrike) { - iteam = _:cs_get_user_team(i) - + iteam = _:cs_get_user_team(i); + if (iteam == 1) { - copy(team, charsmax(team), "TE") + copy(team, charsmax(team), "TE"); } else if (iteam == 2) { - copy(team, charsmax(team), "CT") + copy(team, charsmax(team), "CT"); } else if (iteam == 3) { copy(team, charsmax(team), "SPE"); // iteam = 6; // oO WTF is this ?? fixed g_CSTeamiNumbers. } else { - iteam = get_user_team(i, team, charsmax(team)) + iteam = get_user_team(i, team, charsmax(team)); } } else { - iteam = get_user_team(i, team, charsmax(team)) + iteam = get_user_team(i, team, charsmax(team)); } if( !iteam ) { - iteam = 3 // fix get_user_team returning 0 on spectators + iteam = 3; // fix get_user_team returning 0 on spectators } if ((iteam == g_CSTeamiNumbers[g_menuOption[id] % 3]) || (access(i, ADMIN_IMMUNITY) && i != id)) { - ++b - + ++b; + if (g_coloredMenus) - len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s\R%s^n\w", b, name, team) + len += formatex(menuBody[len], charsmax(menuBody) - len, "\d%d. %s\R%s^n\w", b, name, team); else - len += format(menuBody[len], charsmax(menuBody) - len, "#. %s %s^n", name, team) + len += formatex(menuBody[len], charsmax(menuBody) - len, "#. %s %s^n", name, team); } else { - keys |= (1<= g_menuPlayersNum[id]) - start = pos = g_menuPosition[id] = 0 + start = pos = g_menuPosition[id] = 0; - new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) - new end = start + 7 - new keys = MENU_KEY_0|MENU_KEY_8 + new len = formatex(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))); + new end = start + 7; + new keys = MENU_KEY_0|MENU_KEY_8; if (end > g_menuPlayersNum[id]) - end = g_menuPlayersNum[id] + end = g_menuPlayersNum[id]; for (new a = start; a < end; ++a) { - i = g_menuPlayers[id][a] - get_user_name(i, name, charsmax(name)) + i = g_menuPlayers[id][a]; + get_user_name(i, name, charsmax(name)); if (!g_menuSelectNum[id] || (access(i, ADMIN_IMMUNITY) && i != id)) { - ++b - + ++b; + if (g_coloredMenus) - len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, name); else - len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name) + len += formatex(menuBody[len], charsmax(menuBody) - len, "#. %s^n", name); } else { - keys |= (1< 3) { @@ -1060,11 +1057,11 @@ load_settings(szFilename[]) // do nothing } - g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags) - g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess) - g_clcmdNum++ + g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags); + g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess); + g_clcmdNum++; } } - return 1 + return 1; }