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,7 +54,8 @@ new g_clcmdNum
new g_coloredMenus
public plugin_init() {
public plugin_init()
{
register_plugin("Players Menu", AMXX_VERSION_STR, "AMXX Dev Team")
register_dictionary("plmenu.txt")
@ -82,13 +83,17 @@ public plugin_init() {
/* Ban menu */
public actionBanMenu(id,key) {
switch (key) {
case 7: {
public actionBanMenu(id, key)
{
switch (key)
{
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 2: g_menuSettings[id] = 60
@ -96,9 +101,12 @@ public actionBanMenu(id,key) {
displayBanMenu(id, g_menuPosition[id])
}
case 8: displayBanMenu(id, ++g_menuPosition[id])
case 9: displayBanMenu(id, --g_menuPosition[id])
default: {
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32], authid2[32]
@ -108,15 +116,16 @@ public actionBanMenu(id,key) {
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^")",
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
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")) {
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)
}
if (equal("4294967295",authid2)) { /* lan */
if (equal("4294967295", authid2))
{
new ipa[32]
get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
@ -129,11 +138,14 @@ public actionBanMenu(id,key) {
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayBanMenu(id,pos) {
if (pos < 0) return
displayBanMenu(id,pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -146,9 +158,7 @@ displayBanMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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 )))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -156,19 +166,25 @@ displayBanMenu(id,pos) {
if (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)
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) {
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
@ -178,16 +194,19 @@ displayBanMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
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
}
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, "Ban Menu")
}
public cmdBanMenu(id,level,cid) {
public cmdBanMenu(id,level,cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -261,8 +280,10 @@ public actionSlapMenu(id,key) {
}
displaySlapMenu(id,pos) {
if (pos < 0) return
displaySlapMenu(id,pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -275,9 +296,7 @@ displaySlapMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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 )))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -290,19 +309,21 @@ displaySlapMenu(id,pos) {
get_user_name(i,name,31)
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)
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
{
} 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)
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)
}
}
@ -315,14 +336,16 @@ displaySlapMenu(id,pos) {
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, "Slap/Slay Menu")
}
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_menuSettings[id] = 0
@ -366,8 +389,10 @@ public actionKickMenu(id,key)
return PLUGIN_HANDLED
}
displayKickMenu(id,pos) {
if (pos < 0) return
displayKickMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -380,9 +405,7 @@ displayKickMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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 )))
new end = start + 8
new keys = MENU_KEY_0
@ -390,34 +413,42 @@ displayKickMenu(id,pos) {
if (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)
if ( access(i,ADMIN_IMMUNITY) ) {
if (access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
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
}
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")
}
public cmdKickMenu(id,level,cid) {
public cmdKickMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayKickMenu(id, g_menuPosition[id] = 0)
@ -459,8 +490,10 @@ public actionTeamMenu(id,key) {
return PLUGIN_HANDLED
}
displayTeamMenu(id,pos) {
if (pos < 0) return
displayTeamMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -473,9 +506,7 @@ displayTeamMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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 )))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -483,22 +514,27 @@ displayTeamMenu(id,pos) {
if (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)
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)
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 {
} 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)
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)
}
}
@ -509,13 +545,16 @@ displayTeamMenu(id,pos) {
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, "Team Menu")
}
public cmdTeamMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdTeamMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 0
@ -562,8 +601,10 @@ public actionClcmdMenu(id,key) {
return PLUGIN_HANDLED
}
displayClcmdMenu(id,pos) {
if (pos < 0) return
displayClcmdMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id],g_menuPlayersNum[id])
@ -576,9 +617,7 @@ displayClcmdMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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 )))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -586,19 +625,25 @@ displayClcmdMenu(id,pos) {
if (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)
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) {
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
@ -608,16 +653,19 @@ displayClcmdMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
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
}
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, "Client Cmds Menu")
}
public cmdClcmdMenu(id,level,cid) {
public cmdClcmdMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -636,20 +684,22 @@ public cmdClcmdMenu(id,level,cid) {
return PLUGIN_HANDLED
}
load_settings( szFilename[] ) {
load_settings(szFilename[])
{
if (!file_exists(szFilename))
return 0
new text[256], szFlags[32], szAccess[32]
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 ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
if (parse(text, g_clcmdName[g_clcmdNum], 31, 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
}
@ -658,5 +708,6 @@ load_settings( szFilename[] ) {
g_clcmdNum++
}
}
return 1
}

View File

@ -34,9 +34,6 @@
#include <amxmodx>
#include <amxmisc>
/** skip autoloading since it's optional */
#define AMXMODX_NOAUTOLOAD
#include <cstrike>
new g_menuPosition[33]
@ -222,6 +219,10 @@ displayBanMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
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)
}
}
@ -381,6 +382,10 @@ displaySlapMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else {
keys |= (1<<b)
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,6 +495,10 @@ displayKickMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
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)
}
}
@ -626,6 +635,10 @@ displayTeamMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
} else {
keys |= (1<<b)
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)
}
}
@ -743,6 +756,10 @@ displayClcmdMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
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)
}
}

View File

@ -157,6 +157,10 @@ displayTelMenu(id, pos)
len += format(menuBody[len], 511-len, "#. %s^n", name)
} else {
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)
}
}

View File

@ -56,7 +56,8 @@ new g_coloredMenus
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_dictionary("plmenu.txt")
@ -84,13 +85,17 @@ public plugin_init() {
/* Ban menu */
public actionBanMenu(id,key) {
switch (key) {
case 7: {
public actionBanMenu(id, key)
{
switch (key)
{
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 2: g_menuSettings[id] = 60
@ -98,9 +103,12 @@ public actionBanMenu(id,key) {
displayBanMenu(id, g_menuPosition[id])
}
case 8: displayBanMenu(id, ++g_menuPosition[id])
case 9: displayBanMenu(id, --g_menuPosition[id])
default: {
default:
{
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[32], name2[32], authid[32], authid2[32]
@ -110,15 +118,16 @@ public actionBanMenu(id,key) {
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^")",
name,get_user_userid(id),authid, name2,userid2,authid2, g_menuSettings[id] )
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")) {
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)
}
if (equal("4294967295",authid2)) { /* lan */
if (equal("4294967295", authid2))
{
new ipa[32]
get_user_ip(player, ipa, 31, 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
@ -131,11 +140,14 @@ public actionBanMenu(id,key) {
displayBanMenu(id, g_menuPosition[id])
}
}
return PLUGIN_HANDLED
}
displayBanMenu(id,pos) {
if (pos < 0) return
displayBanMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -148,29 +160,32 @@ displayBanMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
if (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)
if ( is_user_bot(i) || access(i,ADMIN_IMMUNITY) ) {
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
@ -180,16 +195,19 @@ displayBanMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM")
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
}
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, "Ban Menu")
}
public cmdBanMenu(id,level,cid) {
public cmdBanMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -262,9 +280,10 @@ public actionSlapMenu(id,key) {
return PLUGIN_HANDLED
}
displaySlapMenu(id,pos) {
if (pos < 0) return
displaySlapMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -277,34 +296,34 @@ displaySlapMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
if (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)
new iteam = get_user_team(i)
if ( !is_user_alive(i) || access(i,ADMIN_IMMUNITY) ) {
if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam])
}
else
{
} 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])
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, g_teamNames[iteam])
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam])
}
}
@ -313,18 +332,21 @@ displaySlapMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
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
}
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, "Slap/Slay Menu")
}
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_menuSettings[id] = 0
@ -368,8 +390,10 @@ public actionKickMenu(id,key)
return PLUGIN_HANDLED
}
displayKickMenu(id,pos) {
if (pos < 0) return
displayKickMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -382,44 +406,49 @@ displayKickMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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)))
new end = start + 8
new keys = MENU_KEY_0
if (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)
if ( access(i,ADMIN_IMMUNITY) ) {
if (access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
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
}
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")
}
public cmdKickMenu(id,level,cid) {
public cmdKickMenu(id, level, cid)
{
if (cmd_access(id, level, cid, 1))
displayKickMenu(id, g_menuPosition[id] = 0)
@ -465,9 +494,10 @@ public actionTeamMenu(id,key) {
return PLUGIN_HANDLED
}
displayTeamMenu(id,pos) {
if (pos < 0) return
displayTeamMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -480,51 +510,56 @@ displayTeamMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
if (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)
iteam = get_user_team(i)
if ( (iteam == g_menuOption[id]) || access(i,ADMIN_IMMUNITY) ) {
if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam])
}
else {
} 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])
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, g_teamNames[iteam])
else
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])
{
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, "Team Menu")
}
public cmdTeamMenu(id,level,cid) {
if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED
public cmdTeamMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
g_menuOption[id] = 1
g_menuOption[id] = 0
displayTeamMenu(id, g_menuPosition[id] = 0)
@ -569,8 +604,10 @@ public actionClcmdMenu(id,key) {
return PLUGIN_HANDLED
}
displayClcmdMenu(id,pos) {
if (pos < 0) return
displayClcmdMenu(id, pos)
{
if (pos < 0)
return
get_players(g_menuPlayers[id], g_menuPlayersNum[id])
@ -583,29 +620,32 @@ displayClcmdMenu(id,pos) {
if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0
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 )) )
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)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
if (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)
if ( !g_menuSelectNum[id] || access(i,ADMIN_IMMUNITY) ) {
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name)
else
len += format(menuBody[len], 511-len, "#. %s^n", name)
}
else {
} else {
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)
}
}
@ -615,16 +655,19 @@ displayClcmdMenu(id,pos) {
else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS")
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
}
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, "Client Cmds Menu")
}
public cmdClcmdMenu(id,level,cid) {
public cmdClcmdMenu(id, level, cid)
{
if (!cmd_access(id, level, cid, 1))
return PLUGIN_HANDLED
@ -643,20 +686,22 @@ public cmdClcmdMenu(id,level,cid) {
return PLUGIN_HANDLED
}
load_settings( szFilename[] ) {
load_settings(szFilename[])
{
if (!file_exists(szFilename))
return 0
new text[256], szFlags[32], szAccess[32]
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 ( parse( text , g_clcmdName[g_clcmdNum] , 31 ,
g_clcmdCmd[g_clcmdNum] ,63,szFlags,31,szAccess,31 ) > 3 )
if (parse(text, g_clcmdName[g_clcmdNum], 31, 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
}