Plmenu: replace len hardcoded content by charsmax

This commit is contained in:
Freeman-AM 2014-10-08 21:49:00 +02:00
parent 91dfec4ef7
commit 0a4cd13622

View File

@ -59,8 +59,8 @@ public plugin_init()
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, charsmax(clcmds_ini_file))
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
} }
@ -117,10 +117,10 @@ public actionBanMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32] new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
new userid2 = get_user_userid(player) 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])
@ -136,7 +136,7 @@ public actionBanMenu(id, key)
else else
{ {
new tempTime[32]; new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); formatex(tempTime,charsmax(tempTime),"%d",g_menuSettings[id]);
client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime);
} }
} }
@ -149,7 +149,7 @@ public actionBanMenu(id, key)
else else
{ {
new tempTime[32]; new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); formatex(tempTime,charsmax(tempTime),"%d",g_menuSettings[id]);
client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime);
} }
} }
@ -158,7 +158,7 @@ public actionBanMenu(id, key)
if (equal("4294967295", authid2)) if (equal("4294967295", authid2))
{ {
new ipa[32] new ipa[32]
get_user_ip(player, ipa, 31, 1) get_user_ip(player, ipa, charsmax(ipa), 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa) server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
if( g_tempBans ) if( g_tempBans )
{ {
@ -199,7 +199,7 @@ displayBanMenu(id,pos)
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 ? "\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,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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -210,38 +210,38 @@ displayBanMenu(id,pos)
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, charsmax(name))
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY)) if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSettings[id]) if (g_menuSettings[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM") len += format(menuBody[len], charsmax(menuBody)-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") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Ban Menu") show_menu(id, keys, menuBody, -1, "Ban Menu")
} }
@ -278,7 +278,7 @@ public actionSlapMenu(id,key) {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name2[MAX_NAME_LENGTH] new name2[MAX_NAME_LENGTH]
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
if (!is_user_alive(player)) { if (!is_user_alive(player)) {
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2) client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
@ -288,9 +288,9 @@ public actionSlapMenu(id,key) {
new authid[32],authid2[32], name[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH]
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
if ( g_menuOption[id] ) { if ( g_menuOption[id] ) {
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
@ -337,7 +337,7 @@ displaySlapMenu(id,pos)
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 ? "\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, 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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -347,38 +347,38 @@ displaySlapMenu(id,pos)
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,charsmax(name))
get_user_team(i,team,7) get_user_team(i,team,charsmax(team))
if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY)) if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s\R%s^n\w", b, name, team)
else else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) 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) len += format(menuBody[len], charsmax(menuBody)-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, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team)
} }
} }
if (g_menuOption[id]) if (g_menuOption[id])
len += format(menuBody[len], 511-len, "^n8. %L^n",id, "SLAP_WITH_DMG", g_menuSettings[id]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n",id, "SLAP_WITH_DMG", g_menuSettings[id])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY") len += format(menuBody[len], charsmax(menuBody)-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") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu") show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
} }
@ -407,10 +407,10 @@ public actionKickMenu(id,key)
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
new userid2 = get_user_userid(player) new userid2 = get_user_userid(player)
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
@ -446,7 +446,7 @@ displayKickMenu(id, pos)
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 ? "\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, 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 end = start + 8
new keys = MENU_KEY_0 new keys = MENU_KEY_0
@ -457,33 +457,33 @@ displayKickMenu(id, pos)
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, charsmax(name))
if (access(i, ADMIN_IMMUNITY)) if (access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-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") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Kick Menu") show_menu(id, keys, menuBody, -1, "Kick Menu")
} }
@ -509,10 +509,10 @@ public actionTeamMenu(id,key) {
default: { default: {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "Allies" : "Axis" ) name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_menuOption[id] ? "Allies" : "Axis" )
@ -547,7 +547,7 @@ displayTeamMenu(id, pos)
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 ? "\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, 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] / 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
@ -558,36 +558,36 @@ displayTeamMenu(id, pos)
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, charsmax(name))
iteam = get_user_team(i, team, 7) iteam = get_user_team(i, team, charsmax(team))
if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY)) if ((iteam == (g_menuOption[id] ? 1 : 2)) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s\R%s^n\w", b, name, team)
else else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) 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) len += format(menuBody[len], charsmax(menuBody)-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, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-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") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "TRANSF_TO", g_menuOption[id] ? "Allies" : "Axis")
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], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Team Menu") show_menu(id, keys, menuBody, -1, "Team Menu")
} }
@ -620,13 +620,13 @@ public actionClcmdMenu(id,key) {
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1] new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
if (is_user_connected(player)) { if (is_user_connected(player)) {
new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32] new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32]
copy(command,63,g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]]) copy(command,charsmax(command),g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player,authid,31) get_user_authid(player,authid,charsmax(authid))
get_user_name(player,name,31) get_user_name(player,name,charsmax(name))
num_to_str(get_user_userid(player),userid,31) num_to_str(get_user_userid(player),userid,charsmax(userid))
replace(command,63,"%userid%",userid) replace(command,charsmax(command),"%userid%",userid)
replace(command,63,"%authid%",authid) replace(command,charsmax(command),"%authid%",authid)
replace(command,63,"%name%",name) replace(command,charsmax(command),"%name%",name)
if (flags & 1) { if (flags & 1) {
server_cmd("%s", command) server_cmd("%s", command)
server_exec() server_exec()
@ -658,7 +658,7 @@ displayClcmdMenu(id, pos)
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 ? "\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, 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 end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -669,38 +669,38 @@ displayClcmdMenu(id, pos)
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, charsmax(name))
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY)) if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSelectNum[id]) if (g_menuSelectNum[id])
len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS") len += format(menuBody[len], charsmax(menuBody)-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") format(menuBody[len],charsmax(menuBody)-len,"^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Client Cmds Menu") show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
} }
@ -733,13 +733,13 @@ load_settings(szFilename[])
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, charsmax(text), a))
{ {
if (text[0] == ';') continue 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], charsmax(g_clcmdName), g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd), szFlags, charsmax(szFlags), szAccess, charsmax(szAccess)) > 3)
{ {
while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^"")) while (replace(g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd), "\'", "^""))
{ {
// do nothing // do nothing
} }