Added admin indentifier (red asterisk) to all menus that contain a user list at30358

This commit is contained in:
Scott Ehlert 2006-06-05 22:32:00 +00:00
parent 011c9fa45c
commit ba87258a3d
4 changed files with 789 additions and 672 deletions

View File

@ -54,148 +54,167 @@ new g_clcmdNum
new g_coloredMenus new g_coloredMenus
public plugin_init() { public plugin_init()
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team") {
register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("plmenu.txt") register_dictionary("plmenu.txt")
register_dictionary("common.txt") register_dictionary("common.txt")
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu") register_clcmd("amx_kickmenu", "cmdKickMenu", ADMIN_KICK, "- displays kick menu")
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu") register_clcmd("amx_banmenu", "cmdBanMenu", ADMIN_BAN, "- displays ban menu")
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay 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_teammenu", "cmdTeamMenu", ADMIN_LEVEL_A, "- displays team menu")
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds 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("Ban Menu"), 1023, "actionBanMenu")
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu") register_menucmd(register_menuid("Kick Menu"), 1023, "actionKickMenu")
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu") register_menucmd(register_menuid("Slap/Slay Menu"), 1023, "actionSlapMenu")
register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu") register_menucmd(register_menuid("Team Menu"), 1023, "actionTeamMenu")
register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") register_menucmd(register_menuid("Client Cmds Menu"), 1023, "actionClcmdMenu")
g_coloredMenus = colored_menus() g_coloredMenus = colored_menus()
new clcmds_ini_file[64] new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63) get_configsdir(clcmds_ini_file, 63)
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
} }
/* Ban menu */ /* Ban menu */
public actionBanMenu(id,key) { public actionBanMenu(id, key)
switch (key) { {
case 7: { switch (key)
++g_menuOption[id] {
g_menuOption[id] %= 3 case 7:
{
++g_menuOption[id]
g_menuOption[id] %= 3
switch(g_menuOption[id]){ switch(g_menuOption[id])
case 0: g_menuSettings[id] = 0 {
case 1: g_menuSettings[id] = 5 case 0: g_menuSettings[id] = 0
case 2: g_menuSettings[id] = 60 case 1: g_menuSettings[id] = 5
} case 2: g_menuSettings[id] = 60
}
displayBanMenu(id,g_menuPosition[id]) displayBanMenu(id, g_menuPosition[id])
} }
case 8: displayBanMenu(id,++g_menuPosition[id])
case 9: displayBanMenu(id,--g_menuPosition[id])
default: {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32],authid2[32] case 8: displayBanMenu(id, ++g_menuPosition[id])
get_user_name(player,name2,31) case 9: displayBanMenu(id, --g_menuPosition[id])
get_user_authid(id,authid,31)
get_user_authid(player,authid2,31)
get_user_name(id,name,31)
new userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", default:
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] ) {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
switch (get_cvar_num("amx_show_activity")) { new name[32], name2[32], authid[32], authid2[32]
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2) get_user_name(player, name2, 31)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2) get_user_authid(id, authid, 31)
} get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
new userid2 = get_user_userid(player)
if (equal("4294967295",authid2)) { /* lan */ 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])
new ipa[32]
get_user_ip(player,ipa,31,1)
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
}
else
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
server_exec() switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_1", name2)
}
displayBanMenu(id,g_menuPosition[id]) if (equal("4294967295", authid2))
} {
} new ipa[32]
return PLUGIN_HANDLED get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
}
else
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
server_exec()
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
} }
displayBanMenu(id,pos) { displayBanMenu(id,pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id],g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody,511, 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 )))
"\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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
if (end > g_menuPlayersNum[id]) if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id] end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a)
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) { if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
++b {
if ( g_coloredMenus ) ++b
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else
len += format(menuBody[len],511-len,"#. %s^n",name)
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
if ( g_menuSettings[id] ) if (g_coloredMenus)
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id] ) len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_PERM" ) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
keys |= (1<<b)
if (end != g_menuPlayersNum[id]) { if (is_user_admin(i))
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") }
}
show_menu(id,keys,menuBody,-1,"Ban Menu") if (g_menuSettings[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Ban Menu")
} }
public cmdBanMenu(id,level,cid) { public cmdBanMenu(id,level,cid)
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 1 g_menuOption[id] = 1
g_menuSettings[id] = 5 g_menuSettings[id] = 5
displayBanMenu(id,g_menuPosition[id] = 0) displayBanMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Slap/Slay */ /* Slap/Slay */
@ -261,75 +280,79 @@ public actionSlapMenu(id,key) {
} }
displaySlapMenu(id,pos) { displaySlapMenu(id,pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id],g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32], team[8] new name[32], team[8]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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 )))
"\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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
if (end > g_menuPlayersNum[id]) if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id] end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a) {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i,name,31) get_user_name(i,name,31)
get_user_team(i,team,7) get_user_team(i,team,7)
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) { if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
++b {
if ( g_coloredMenus ) ++b
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,team)
else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
}
else
{
keys |= (1<<b)
len += format(menuBody[len],511-len, g_coloredMenus ? if (g_coloredMenus)
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team) len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
} else
} len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else {
keys |= (1<<b)
if ( g_menuOption[id] ) if (is_user_admin(i))
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAP_WITH_DMG",g_menuSettings[id] ) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
else else
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAY") len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
}
}
if (end != g_menuPlayersNum[id]) { if (g_menuOption[id])
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, "^n8. %L^n",id, "SLAP_WITH_DMG", g_menuSettings[id])
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Slap/Slay Menu") if (end != g_menuPlayersNum[id]) {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
} }
public cmdSlapMenu(id,level,cid) public cmdSlapMenu(id,level,cid)
{ {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 0 g_menuOption[id] = 0
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 */ /* Kick */
@ -366,62 +389,70 @@ public actionKickMenu(id,key)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayKickMenu(id,pos) { displayKickMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id],g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 8 new start = pos * 8
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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 )))
"\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 end = start + 8
new keys = MENU_KEY_0 new keys = MENU_KEY_0
if (end > g_menuPlayersNum[id]) if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id] end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a)
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
if ( access(i,ADMIN_IMMUNITY) ) { if (access(i, ADMIN_IMMUNITY))
++b {
if ( g_coloredMenus ) ++b
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else
len += format(menuBody[len],511-len,"#. %s^n",name)
} if (g_coloredMenus)
else { len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
keys |= (1<<b) else
len += format(menuBody[len],511-len,"%d. %s^n",++b,name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} } else {
} keys |= (1<<b)
if (end != g_menuPlayersNum[id]) { if (is_user_admin(i))
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") }
}
show_menu(id,keys,menuBody,-1,"Kick Menu") if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Kick Menu")
} }
public cmdKickMenu(id,level,cid) { public cmdKickMenu(id, level, cid)
if (cmd_access(id,level,cid,1)) {
displayKickMenu(id,g_menuPosition[id] = 0) if (cmd_access(id, level, cid, 1))
displayKickMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Team menu */ /* Team menu */
@ -459,69 +490,77 @@ public actionTeamMenu(id,key) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayTeamMenu(id,pos) { displayTeamMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id], g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i, iteam new i, iteam
new name[32], team[8] new name[32], team[8]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )))
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n",
id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
if (end > g_menuPlayersNum[id]) if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id] end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a)
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) i = g_menuPlayers[id][a]
iteam = get_user_team(i,team,7) get_user_name(i, name, 31)
iteam = get_user_team(i, team, 7)
if ( (iteam == (g_menuOption[id] ? 1 : 2)) || access(i,ADMIN_IMMUNITY) ) { if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY))
++b {
if ( g_coloredMenus ) ++b
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,team)
else
len += format(menuBody[len],511-len,"#. %s %s^n",name,team)
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len, g_coloredMenus ?
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,team)
}
}
len += format(menuBody[len],511-len,"^n8. %L^n",id,"TRANSF_TO",g_menuOption[id] ? "Allies" : "Axis" ) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team)
else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else {
keys |= (1<<b)
if (end != g_menuPlayersNum[id]) if (is_user_admin(i))
{ len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") else
keys |= MENU_KEY_9 len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
} }
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") }
show_menu(id,keys,menuBody,-1,"Team Menu") len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_menuOption[id] ? "Allies" : "Axis")
if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Team Menu")
} }
public cmdTeamMenu(id,level,cid) { public cmdTeamMenu(id, level, cid)
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED {
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 0 g_menuOption[id] = 0
displayTeamMenu(id,g_menuPosition[id] = 0) displayTeamMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Client cmds menu */ /* Client cmds menu */
@ -562,101 +601,113 @@ public actionClcmdMenu(id,key) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayClcmdMenu(id,pos) { displayClcmdMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id],g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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 )))
"\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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
if (end > g_menuPlayersNum[id]) if (end > g_menuPlayersNum[id])
end = g_menuPlayersNum[id] end = g_menuPlayersNum[id]
for (new a = start; a < end; ++a) { for (new a = start; a < end; ++a)
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) { if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
++b {
if ( g_coloredMenus ) ++b
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name)
else
len += format(menuBody[len],511-len,"#. %s^n",name)
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
if ( g_menuSelectNum[id] ) if (g_coloredMenus)
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] ) len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len],511-len,"^n8. %L^n",id,"NO_CMDS") len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
keys |= (1<<b)
if (end != g_menuPlayersNum[id]) { if (is_user_admin(i))
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") }
}
show_menu(id,keys,menuBody,-1,"Client Cmds Menu") if (g_menuSelectNum[id])
len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
if (end != g_menuPlayersNum[id])
{
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
} }
public cmdClcmdMenu(id,level,cid) { public cmdClcmdMenu(id, level, cid)
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new flags = get_user_flags(id) new flags = get_user_flags(id)
g_menuSelectNum[id] = 0 g_menuSelectNum[id] = 0
for (new a = 0; a < g_clcmdNum; ++a) for (new a = 0; a < g_clcmdNum; ++a)
if (g_clcmdMisc[a][0] & flags) if (g_clcmdMisc[a][0] & flags)
g_menuSelect[id][g_menuSelectNum[id]++] = a g_menuSelect[id][g_menuSelectNum[id]++] = a
g_menuOption[id] = 0 g_menuOption[id] = 0
displayClcmdMenu(id,g_menuPosition[id] = 0) displayClcmdMenu(id,g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
load_settings( szFilename[] ) { load_settings(szFilename[])
if ( !file_exists ( szFilename ) ) {
return 0 if (!file_exists(szFilename))
return 0
new text[256], szFlags[32], szAccess[32] new text[256], szFlags[32], szAccess[32]
new a, pos = 0 new a, pos = 0
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) ) { while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
if ( text[0] == ';' ) continue {
if (text[0] == ';') continue
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 , if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 ) {
{ while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) { {
// do nothing // do nothing
} }
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags ) g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess ) g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
g_clcmdNum++ g_clcmdNum++
} }
} }
return 1
return 1
} }

View File

@ -34,9 +34,6 @@
#include <amxmodx> #include <amxmodx>
#include <amxmisc> #include <amxmisc>
/** skip autoloading since it's optional */
#define AMXMODX_NOAUTOLOAD
#include <cstrike> #include <cstrike>
new g_menuPosition[33] new g_menuPosition[33]
@ -221,7 +218,11 @@ displayBanMenu(id, pos)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
} }
} }
@ -381,7 +382,11 @@ displaySlapMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
} }
} }
@ -490,7 +495,11 @@ displayKickMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
} }
} }
@ -626,7 +635,11 @@ displayTeamMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, team)
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
} }
} }
@ -740,10 +753,14 @@ displayClcmdMenu(id, pos)
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
} }
} }

View File

@ -157,7 +157,11 @@ displayTelMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], 511-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
} }
} }

View File

@ -54,150 +54,168 @@ new g_clcmdNum
new g_coloredMenus new g_coloredMenus
new g_teamNames[5][] = { "", "Blue","Red","Yellow","Green" } new g_teamNames[5][] = {"", "Blue", "Red", "Yellow", "Green"}
public plugin_init() { public plugin_init()
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team") {
register_plugin("Players Menu",AMXX_VERSION_STR,"AMXX Dev Team")
register_dictionary("plmenu.txt") register_dictionary("plmenu.txt")
register_dictionary("common.txt") register_dictionary("common.txt")
register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu") register_clcmd("amx_kickmenu","cmdKickMenu",ADMIN_KICK,"- displays kick menu")
register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu") register_clcmd("amx_banmenu","cmdBanMenu",ADMIN_BAN,"- displays ban menu")
register_clcmd("amx_slapmenu","cmdSlapMenu",ADMIN_SLAY,"- displays slap/slay 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_teammenu","cmdTeamMenu",ADMIN_LEVEL_A,"- displays team menu")
register_clcmd("amx_clcmdmenu","cmdClcmdMenu",ADMIN_LEVEL_A,"- displays client cmds 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("Ban Menu"),1023,"actionBanMenu")
register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu") register_menucmd(register_menuid("Kick Menu"),1023,"actionKickMenu")
register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu") register_menucmd(register_menuid("Slap/Slay Menu"),1023,"actionSlapMenu")
register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu") register_menucmd(register_menuid("Team Menu"),1023,"actionTeamMenu")
register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu") register_menucmd(register_menuid("Client Cmds Menu"),1023,"actionClcmdMenu")
g_coloredMenus = colored_menus() g_coloredMenus = colored_menus()
new clcmds_ini_file[64] new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63) get_configsdir(clcmds_ini_file, 63)
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
} }
/* Ban menu */ /* Ban menu */
public actionBanMenu(id,key) { public actionBanMenu(id, key)
switch (key) { {
case 7: { switch (key)
++g_menuOption[id] {
g_menuOption[id] %= 3 case 7:
{
++g_menuOption[id]
g_menuOption[id] %= 3
switch(g_menuOption[id]){ switch(g_menuOption[id])
case 0: g_menuSettings[id] = 0 {
case 1: g_menuSettings[id] = 5 case 0: g_menuSettings[id] = 0
case 2: g_menuSettings[id] = 60 case 1: g_menuSettings[id] = 5
} case 2: g_menuSettings[id] = 60
}
displayBanMenu(id,g_menuPosition[id]) displayBanMenu(id, g_menuPosition[id])
} }
case 8: displayBanMenu(id,++g_menuPosition[id])
case 9: displayBanMenu(id,--g_menuPosition[id])
default: {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32],authid2[32] case 8: displayBanMenu(id, ++g_menuPosition[id])
get_user_name(player,name2,31) case 9: displayBanMenu(id, --g_menuPosition[id])
get_user_authid(id,authid,31)
get_user_authid(player,authid2,31)
get_user_name(id,name,31)
new userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", default:
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] ) {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
switch (get_cvar_num("amx_show_activity")) { new name[32], name2[32], authid[32], authid2[32]
case 2: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_2",name,name2) get_user_name(player, name2, 31)
case 1: client_print(0,print_chat,"%L",LANG_PLAYER,"ADMIN_BAN_1",name2) get_user_authid(id, authid, 31)
} get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
new userid2 = get_user_userid(player)
if (equal("4294967295",authid2)) { /* lan */ 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])
new ipa[32]
get_user_ip(player,ipa,31,1)
server_cmd("addip %d %s;writeip",g_menuSettings[id],ipa)
}
else
server_cmd("banid %d #%d kick;writeid",g_menuSettings[id],userid2)
server_exec() switch (get_cvar_num("amx_show_activity"))
{
case 2: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_2", name, name2)
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_BAN_1", name2)
}
displayBanMenu(id,g_menuPosition[id]) if (equal("4294967295", authid2))
} {
} new ipa[32]
return PLUGIN_HANDLED get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
}
else
server_cmd("banid %d #%d kick;writeid", g_menuSettings[id], userid2)
server_exec()
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
} }
displayBanMenu(id,pos) { displayBanMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id], g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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)))
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", new end = start + 7
id,"BAN_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) new keys = MENU_KEY_0|MENU_KEY_8
new end = start + 7 if (end > g_menuPlayersNum[id])
new keys = MENU_KEY_0|MENU_KEY_8 end = g_menuPlayersNum[id]
if (end > g_menuPlayersNum[id]) for (new a = start; a < end; ++a)
end = g_menuPlayersNum[id] {
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
for (new a = start; a < end; ++a) { if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) ++b
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) { if (g_coloredMenus)
++b len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
if ( g_coloredMenus ) else
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len], 511-len, "#. %s^n", name)
else } else {
len += format(menuBody[len],511-len,"#. %s^n",name) keys |= (1<<b)
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
if ( g_menuSettings[id] ) if (is_user_admin(i))
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id] ) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len],511-len,"^n8. %L^n", id, "BAN_PERM" ) len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
}
}
if (end != g_menuPlayersNum[id]) { if (g_menuSettings[id])
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Ban Menu") if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Ban Menu")
} }
public cmdBanMenu(id,level,cid) { public cmdBanMenu(id, level, cid)
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 1 g_menuOption[id] = 1
g_menuSettings[id] = 5 g_menuSettings[id] = 5
displayBanMenu(id,g_menuPosition[id] = 0) displayBanMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Slap/Slay */ /* Slap/Slay */
@ -262,76 +280,80 @@ public actionSlapMenu(id,key) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displaySlapMenu(id, pos)
{
if (pos < 0)
return
displaySlapMenu(id,pos) { get_players(g_menuPlayers[id], g_menuPlayersNum[id])
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) new menuBody[512]
new b = 0
new i
new name[32]
new start = pos * 7
new menuBody[512] if (start >= g_menuPlayersNum[id])
new b = 0 start = pos = g_menuPosition[id] = 0
new i
new name[32]
new start = pos * 7
if (start >= g_menuPlayersNum[id]) new len = format(menuBody, 511, 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)))
start = pos = g_menuPosition[id] = 0 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
new len = format(menuBody,511, g_coloredMenus ? if (end > g_menuPlayersNum[id])
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", end = g_menuPlayersNum[id]
id,"SLAP_SLAY_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7 for (new a = start; a < end; ++a)
new keys = MENU_KEY_0|MENU_KEY_8 {
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
new iteam = get_user_team(i)
if (end > g_menuPlayersNum[id]) if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
end = g_menuPlayersNum[id] {
++b
for (new a = start; a < end; ++a) { if (g_coloredMenus)
i = g_menuPlayers[id][a] len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
get_user_name(i,name,31) else
new iteam = get_user_team(i) len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam])
} else {
keys |= (1<<b)
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) { if (is_user_admin(i))
++b len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam])
if ( g_coloredMenus ) else
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w", b,name,g_teamNames[iteam]) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam])
else }
len += format(menuBody[len],511-len,"#. %s %s^n",name,g_teamNames[iteam]) }
}
else
{
keys |= (1<<b)
len += format(menuBody[len],511-len, g_coloredMenus ? if (g_menuOption[id])
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,g_teamNames[iteam]) len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
} else
} len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
if ( g_menuOption[id] ) if (end != g_menuPlayersNum[id])
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAP_WITH_DMG",g_menuSettings[id] ) {
else format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
len += format(menuBody[len],511-len,"^n8. %L^n",id,"SLAY") keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
if (end != g_menuPlayersNum[id]) { show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Slap/Slay Menu")
} }
public cmdSlapMenu(id,level,cid) public cmdSlapMenu(id, level, cid)
{ {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 0 g_menuOption[id] = 0
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 */ /* Kick */
@ -368,62 +390,69 @@ public actionKickMenu(id,key)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayKickMenu(id,pos) { displayKickMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id], g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 8 new start = pos * 8
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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)))
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", new end = start + 8
id,"KICK_MENU",pos+1,( g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0 )) ) new keys = MENU_KEY_0
new end = start + 8 if (end > g_menuPlayersNum[id])
new keys = MENU_KEY_0 end = g_menuPlayersNum[id]
if (end > g_menuPlayersNum[id]) for (new a = start; a < end; ++a)
end = g_menuPlayersNum[id] {
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
for (new a = start; a < end; ++a) { if (access(i, ADMIN_IMMUNITY))
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) ++b
if ( access(i,ADMIN_IMMUNITY) ) { if (g_coloredMenus)
++b len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
if ( g_coloredMenus ) else
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len], 511-len, "#. %s^n", name)
else } else {
len += format(menuBody[len],511-len,"#. %s^n",name) keys |= (1<<b)
} if (is_user_admin(i))
else { len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
keys |= (1<<b) else
len += format(menuBody[len],511-len,"%d. %s^n",++b,name) len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
} }
} }
if (end != g_menuPlayersNum[id]) { if (end != g_menuPlayersNum[id])
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") {
keys |= MENU_KEY_9 format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
} keys |= MENU_KEY_9
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") }
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Kick Menu") show_menu(id, keys, menuBody, -1, "Kick Menu")
} }
public cmdKickMenu(id,level,cid) { public cmdKickMenu(id, level, cid)
if (cmd_access(id,level,cid,1)) {
displayKickMenu(id,g_menuPosition[id] = 0) if (cmd_access(id, level, cid, 1))
displayKickMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Team menu */ /* Team menu */
@ -465,70 +494,76 @@ public actionTeamMenu(id,key) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayTeamMenu(id, pos)
{
if (pos < 0)
return
displayTeamMenu(id,pos) { get_players(g_menuPlayers[id], g_menuPlayersNum[id])
if (pos < 0) return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) new menuBody[512]
new b = 0
new i, iteam
new name[32]
new start = pos * 7
new menuBody[512] if (start >= g_menuPlayersNum[id])
new b = 0 start = pos = g_menuPosition[id] = 0
new i, iteam
new name[32]
new start = pos * 7
if (start >= g_menuPlayersNum[id]) new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
start = pos = g_menuPosition[id] = 0 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
new len = format(menuBody,511, g_coloredMenus ? if (end > g_menuPlayersNum[id])
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", end = g_menuPlayersNum[id]
id,"TEAM_MENU",pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) )
new end = start + 7 for (new a = start; a < end; ++a)
new keys = MENU_KEY_0|MENU_KEY_8 {
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
iteam = get_user_team(i)
if (end > g_menuPlayersNum[id]) if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY))
end = g_menuPlayersNum[id] {
++b
for (new a = start; a < end; ++a) { if (g_coloredMenus)
i = g_menuPlayers[id][a] len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
get_user_name(i,name,31) else
iteam = get_user_team(i) len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam])
} else {
keys |= (1<<b)
if ( (iteam == g_menuOption[id]) || access(i,ADMIN_IMMUNITY) ) { if (is_user_admin(i))
++b len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam])
if ( g_coloredMenus ) else
len += format(menuBody[len],511-len,"\d%d. %s\R%s^n\w",b,name,g_teamNames[iteam]) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam])
else }
len += format(menuBody[len],511-len,"#. %s %s^n",name,g_teamNames[iteam]) }
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len, g_coloredMenus ?
"%d. %s\y\R%s^n\w" : "%d. %s %s^n",++b,name,g_teamNames[iteam])
}
}
len += format(menuBody[len],511-len,"^n8. %L^n",id,"TRANSF_TO",g_teamNames[g_menuOption[id]] ) len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_menuOption[id] ? "TERRORIST" : "CT")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT") else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Team Menu") show_menu(id, keys, menuBody, -1, "Team Menu")
} }
public cmdTeamMenu(id,level,cid) { public cmdTeamMenu(id, level, cid)
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED {
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 1 g_menuOption[id] = 0
displayTeamMenu(id,g_menuPosition[id] = 0) displayTeamMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
/* Client cmds menu */ /* Client cmds menu */
@ -569,102 +604,112 @@ public actionClcmdMenu(id,key) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
displayClcmdMenu(id,pos) { displayClcmdMenu(id, pos)
if (pos < 0) return {
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id]) get_players(g_menuPlayers[id], g_menuPlayersNum[id])
new menuBody[512] new menuBody[512]
new b = 0 new b = 0
new i new i
new name[32] new name[32]
new start = pos * 7 new start = pos * 7
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody,511, g_coloredMenus ? new len = format(menuBody, 511, 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)))
"\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", new end = start + 7
id, "CL_CMD_MENU", pos+1,( g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0 )) ) new keys = MENU_KEY_0|MENU_KEY_8
new end = start + 7 if (end > g_menuPlayersNum[id])
new keys = MENU_KEY_0|MENU_KEY_8 end = g_menuPlayersNum[id]
if (end > g_menuPlayersNum[id]) for (new a = start; a < end; ++a)
end = g_menuPlayersNum[id] {
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
for (new a = start; a < end; ++a) { if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
i = g_menuPlayers[id][a] {
get_user_name(i,name,31) ++b
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) { if (g_coloredMenus)
++b len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
if ( g_coloredMenus ) else
len += format(menuBody[len],511-len,"\d%d. %s^n\w",b,name) len += format(menuBody[len], 511-len, "#. %s^n", name)
else } else {
len += format(menuBody[len],511-len,"#. %s^n",name) keys |= (1<<b)
}
else {
keys |= (1<<b)
len += format(menuBody[len],511-len,"%d. %s^n",++b,name)
}
}
if ( g_menuSelectNum[id] ) if (is_user_admin(i))
len += format(menuBody[len],511-len,"^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]] ) len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len],511-len,"^n8. %L^n",id,"NO_CMDS") len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name)
}
}
if (end != g_menuPlayersNum[id]) { if (g_menuSelectNum[id])
format(menuBody[len],511-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
keys |= MENU_KEY_9 else
} len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
else format(menuBody[len],511-len,"^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id,keys,menuBody,-1,"Client Cmds Menu") if (end != g_menuPlayersNum[id])
{
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
} }
public cmdClcmdMenu(id,level,cid) { public cmdClcmdMenu(id, level, cid)
if (!cmd_access(id,level,cid,1)) {
return PLUGIN_HANDLED if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
new flags = get_user_flags(id) new flags = get_user_flags(id)
g_menuSelectNum[id] = 0 g_menuSelectNum[id] = 0
for (new a = 0; a < g_clcmdNum; ++a) for (new a = 0; a < g_clcmdNum; ++a)
if (g_clcmdMisc[a][0] & flags) if (g_clcmdMisc[a][0] & flags)
g_menuSelect[id][g_menuSelectNum[id]++] = a g_menuSelect[id][g_menuSelectNum[id]++] = a
g_menuOption[id] = 0 g_menuOption[id] = 0
displayClcmdMenu(id,g_menuPosition[id] = 0) displayClcmdMenu(id, g_menuPosition[id] = 0)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
load_settings( szFilename[] ) { load_settings(szFilename[])
if ( !file_exists ( szFilename ) ) {
return 0 if (!file_exists(szFilename))
return 0
new text[256], szFlags[32], szAccess[32] new text[256], szFlags[32], szAccess[32]
new a, pos = 0 new a, pos = 0
while ( g_clcmdNum < MAX_CLCMDS && read_file (szFilename,pos++,text,255,a) ) { while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a))
if ( text[0] == ';' ) continue {
if (text[0] == ';') continue
if ( parse( text , g_clcmdName[g_clcmdNum] , 31 , if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3)
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 ) {
{ while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^""))
while ( replace( g_clcmdCmd[ g_clcmdNum ] ,63,"\'","^"") ) { {
// do nothing // do nothing
} }
g_clcmdMisc[ g_clcmdNum ][1] = read_flags ( szFlags ) g_clcmdMisc[g_clcmdNum][1] = read_flags(szFlags)
g_clcmdMisc[ g_clcmdNum ][0] = read_flags ( szAccess ) g_clcmdMisc[g_clcmdNum][0] = read_flags(szAccess)
g_clcmdNum++ g_clcmdNum++
} }
} }
return 1 return 1
} }