Merge pull request #89 from skyrim/code/charsmax-magic-nums

Replaced sizeof(str)-1 and magic nums with charsmax
This commit is contained in:
Vincent Herbet 2014-07-30 10:07:07 +02:00
commit 2b93228076
13 changed files with 413 additions and 409 deletions

View File

@ -101,7 +101,7 @@ public plugin_init()
remove_user_flags(0, read_flags("z")) // Remove 'user' flag from server rights
new configsDir[64]
get_configsdir(configsDir, 63)
get_configsdir(configsDir, charsmax(configsDir))
server_cmd("exec %s/amxx.cfg", configsDir) // Execute main configuration file
server_cmd("exec %s/sql.cfg", configsDir)
@ -131,7 +131,7 @@ public addadminfn(id, level, cid)
if (read_argc() >= 5)
{
new t_arg[16]
read_argv(4, t_arg, 15)
read_argv(4, t_arg, charsmax(t_arg))
if (equali(t_arg, "steam") || equali(t_arg, "steamid") || equali(t_arg, "auth"))
{
@ -154,7 +154,7 @@ public addadminfn(id, level, cid)
}
new arg[33]
read_argv(1, arg, 32)
read_argv(1, arg, charsmax(arg))
new player = -1
if (idtype & ADMIN_STEAM)
@ -170,7 +170,7 @@ public addadminfn(id, level, cid)
for (new _i=0; _i<_num; _i++)
{
_pv = _players[_i]
get_user_authid(_pv, _steamid, sizeof(_steamid)-1)
get_user_authid(_pv, _steamid, charsmax(_steamid))
if (!_steamid[0])
continue
if (equal(_steamid, arg))
@ -229,44 +229,45 @@ public addadminfn(id, level, cid)
}
new flags[64]
read_argv(2, flags, 63)
read_argv(2, flags, charsmax(flags))
new password[64]
if (read_argc() >= 4)
read_argv(3, password, 63)
if (read_argc() >= 4) {
read_argv(3, password, charsmax(password))
}
new auth[33]
new Comment[MAX_NAME_LENGTH]; // name of player to pass to comment field
if (idtype & ADMIN_LOOKUP)
{
get_user_name(player, Comment, sizeof(Comment)-1)
get_user_name(player, Comment, charsmax(Comment))
if (idtype & ADMIN_STEAM)
{
get_user_authid(player, auth, 32)
get_user_authid(player, auth, charsmax(auth))
}
else if (idtype & ADMIN_IPADDR)
{
get_user_ip(player, auth, 32, 1)
get_user_ip(player, auth, charsmax(auth), 1)
}
else if (idtype & ADMIN_NAME)
{
get_user_name(player, auth, 32)
get_user_name(player, auth, charsmax(auth))
}
} else {
copy(auth, 32, arg)
copy(auth, charsmax(auth), arg)
}
new type[16], len
if (idtype & ADMIN_STEAM)
len += format(type[len], 15-len, "c")
len += format(type[len], charsmax(type) - len, "c")
else if (idtype & ADMIN_IPADDR)
len += format(type[len], 15-len, "d")
len += format(type[len], charsmax(type) - len, "d")
if (strlen(password) > 0)
len += format(type[len], 15-len, "a")
len += format(type[len], charsmax(type) - len, "a")
else
len += format(type[len], 15-len, "e")
len += format(type[len], charsmax(type) - len, "e")
AddAdmin(id, auth, flags, password, type, Comment)
cmdReload(id, ADMIN_CFG, 0)
@ -274,7 +275,7 @@ public addadminfn(id, level, cid)
if (player > 0)
{
new name[MAX_NAME_LENGTH]
get_user_info(player, "name", name, 31)
get_user_info(player, "name", name, charsmax(name))
accessUser(player, name)
}
@ -287,7 +288,7 @@ AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
new error[128], errno
new Handle:info = SQL_MakeStdTuple()
new Handle:sql = SQL_Connect(info, errno, error, 127)
new Handle:sql = SQL_Connect(info, errno, error, charsmax(error))
if (sql == Empty_Handle)
{
@ -296,8 +297,8 @@ AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
#endif
// Make sure that the users.ini file exists.
new configsDir[64]
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/users.ini", configsDir)
get_configsdir(configsDir, charsmax(configsDir))
format(configsDir, charsmax(configsDir), "%s/users.ini", configsDir)
if (!file_exists(configsDir))
{
@ -311,7 +312,7 @@ AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
new line_steamid[SIZE + 1], line_password[SIZE + 1], line_accessflags[SIZE + 1], line_flags[SIZE + 1], parsedParams
// <name|ip|steamid> <password> <access flags> <account flags>
while ((line = read_file(configsDir, line, textline, 255, len)))
while ((line = read_file(configsDir, line, textline, charsmax(textline), len)))
{
if (len == 0 || equal(textline, ";", 1))
continue // comment line
@ -333,11 +334,11 @@ AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
if (comment[0]==0)
{
formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
formatex(linetoadd, charsmax(linetoadd), "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^"", auth, password, accessflags, flags)
}
else
{
formatex(linetoadd, 511, "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", auth, password, accessflags, flags, comment)
formatex(linetoadd, charsmax(linetoadd), "^r^n^"%s^" ^"%s^" ^"%s^" ^"%s^" ; %s", auth, password, accessflags, flags, comment)
}
console_print(id, "Adding:^n%s", linetoadd)
@ -348,13 +349,13 @@ AddAdmin(id, auth[], accessflags[], password[], flags[], comment[]="")
new table[32]
get_cvar_string("amx_sql_table", table, 31)
get_cvar_string("amx_sql_table", table, charsmax(table))
new Handle:query = SQL_PrepareQuery(sql, "SELECT * FROM `%s` WHERE (`auth` = '%s')", table, auth)
if (!SQL_Execute(query))
{
SQL_QueryError(query, error, 127)
SQL_QueryError(query, error, charsmax(error))
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
console_print(id, "[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
} else if (SQL_NumResults(query)) {
@ -380,8 +381,8 @@ public delayed_load()
{
new configFile[128], curMap[64], configDir[128]
get_configsdir(configDir, sizeof(configDir)-1)
get_mapname(curMap, sizeof(curMap)-1)
get_configsdir(configDir, charsmax(configDir))
get_mapname(curMap, charsmax(curMap))
new i=0;
@ -391,7 +392,7 @@ public delayed_load()
{
// this map has a prefix
curMap[i]='^0';
formatex(configFile, sizeof(configFile)-1, "%s/maps/prefix_%s.cfg", configDir, curMap);
formatex(configFile, charsmax(configFile), "%s/maps/prefix_%s.cfg", configDir, curMap);
if (file_exists(configFile))
{
@ -399,10 +400,10 @@ public delayed_load()
}
}
get_mapname(curMap, sizeof(curMap)-1)
get_mapname(curMap, charsmax(curMap))
formatex(configFile, sizeof(configFile)-1, "%s/maps/%s.cfg", configDir, curMap)
formatex(configFile, charsmax(configFile), "%s/maps/%s.cfg", configDir, curMap)
if (file_exists(configFile))
{
@ -425,7 +426,7 @@ loadSettings(szFilename[])
while (!feof(File))
{
fgets(File,Text,sizeof(Text)-1);
fgets(File, Text, charsmax(Text));
trim(Text);
@ -441,7 +442,7 @@ loadSettings(szFilename[])
Password[0]=0;
// not enough parameters
if (parse(Text,AuthData,sizeof(AuthData)-1,Password,sizeof(Password)-1,Access,sizeof(Access)-1,Flags,sizeof(Flags)-1) < 2)
if (parse(Text,AuthData,charsmax(AuthData),Password,charsmax(Password),Access,charsmax(Access),Flags,charsmax(Flags)) < 2)
{
continue;
}
@ -472,11 +473,11 @@ public adminSql()
new table[32], error[128], type[12], errno
new Handle:info = SQL_MakeStdTuple()
new Handle:sql = SQL_Connect(info, errno, error, 127)
new Handle:sql = SQL_Connect(info, errno, error, charsmax(error))
get_cvar_string("amx_sql_table", table, 31)
get_cvar_string("amx_sql_table", table, charsmax(table))
SQL_GetAffinity(type, 11)
SQL_GetAffinity(type, charsmax(type))
if (sql == Empty_Handle)
{
@ -485,8 +486,8 @@ public adminSql()
//backup to users.ini
new configsDir[64]
get_configsdir(configsDir, 63)
format(configsDir, 63, "%s/users.ini", configsDir)
get_configsdir(configsDir, charsmax(configsDir))
format(configsDir, charsmax(configsDir), "%s/users.ini", configsDir)
loadSettings(configsDir) // Load admins accounts
return PLUGIN_HANDLED
@ -509,7 +510,7 @@ public adminSql()
if (!SQL_Execute(query))
{
SQL_QueryError(query, error, 127)
SQL_QueryError(query, error, charsmax(error))
server_print("[AMXX] %L", LANG_SERVER, "SQL_CANT_LOAD_ADMINS", error)
} else if (!SQL_NumResults(query)) {
server_print("[AMXX] %L", LANG_SERVER, "NO_ADMINS")
@ -530,10 +531,10 @@ public adminSql()
while (SQL_MoreResults(query))
{
SQL_ReadResult(query, qcolAuth, AuthData, sizeof(AuthData)-1);
SQL_ReadResult(query, qcolPass, Password, sizeof(Password)-1);
SQL_ReadResult(query, qcolAccess, Access, sizeof(Access)-1);
SQL_ReadResult(query, qcolFlags, Flags, sizeof(Flags)-1);
SQL_ReadResult(query, qcolAuth, AuthData, charsmax(AuthData));
SQL_ReadResult(query, qcolPass, Password, charsmax(Password));
SQL_ReadResult(query, qcolAccess, Access, charsmax(Access));
SQL_ReadResult(query, qcolFlags, Flags, charsmax(Flags));
admins_push(AuthData,Password,read_flags(Access),read_flags(Flags));
@ -572,8 +573,8 @@ public cmdReload(id, level, cid)
#if !defined USING_SQL
new filename[128]
get_configsdir(filename, 127)
format(filename, 63, "%s/users.ini", filename)
get_configsdir(filename, charsmax(filename))
format(filename, charsmax(filename), "%s/users.ini", filename)
AdminCount = 0;
loadSettings(filename); // Re-Load admins accounts
@ -608,7 +609,7 @@ public cmdReload(id, level, cid)
for (new i=0; i<num; i++)
{
pv = players[i]
get_user_name(pv, name, 31)
get_user_name(pv, name, charsmax(name))
accessUser(pv, name)
}
@ -632,7 +633,7 @@ getAccess(id, name[], authid[], ip[], password[])
for (new i = 0; i < Count; ++i)
{
Flags=admins_lookup(i,AdminProp_Flags);
admins_lookup(i,AdminProp_Auth,AuthData,sizeof(AuthData)-1);
admins_lookup(i,AdminProp_Auth,AuthData,charsmax(AuthData));
if (Flags & FLAG_AUTHID)
{
@ -708,7 +709,7 @@ getAccess(id, name[], authid[], ip[], password[])
result |= 8
new sflags[32]
get_flags(Access, sflags, 31)
get_flags(Access, sflags, charsmax(sflags))
set_user_flags(id, Access)
log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
@ -716,7 +717,7 @@ getAccess(id, name[], authid[], ip[], password[])
else
{
admins_lookup(index,AdminProp_Password,Password,sizeof(Password)-1);
admins_lookup(index,AdminProp_Password,Password,charsmax(Password));
if (equal(password, Password))
{
@ -724,7 +725,7 @@ getAccess(id, name[], authid[], ip[], password[])
set_user_flags(id, Access)
new sflags[32]
get_flags(Access, sflags, 31)
get_flags(Access, sflags, charsmax(sflags))
log_amx("Login: ^"%s<%d><%s><>^" became an admin (account ^"%s^") (access ^"%s^") (address ^"%s^")", name, get_user_userid(id), authid, AuthData, sflags, ip)
}
@ -748,11 +749,11 @@ getAccess(id, name[], authid[], ip[], password[])
{
new defaccess[32]
get_pcvar_string(amx_default_access, defaccess, 31)
get_pcvar_string(amx_default_access, defaccess, charsmax(defaccess))
if (!strlen(defaccess))
{
copy(defaccess, 32, "z")
copy(defaccess, charsmax(defaccess), "z")
}
new idefaccess = read_flags(defaccess)
@ -773,20 +774,20 @@ accessUser(id, name[] = "")
new userip[32], userauthid[32], password[32], passfield[32], username[32]
get_user_ip(id, userip, 31, 1)
get_user_authid(id, userauthid, 31)
get_user_ip(id, userip, charsmax(userip), 1)
get_user_authid(id, userauthid, charsmax(userauthid))
if (name[0])
{
copy(username, 31, name)
copy(username, charsmax(username), name)
}
else
{
get_user_name(id, username, 31)
get_user_name(id, username, charsmax(username))
}
get_pcvar_string(amx_password_field, passfield, 31)
get_user_info(id, passfield, password, 31)
get_pcvar_string(amx_password_field, passfield, charsmax(passfield))
get_user_info(id, passfield, password, charsmax(password))
new result = getAccess(id, username, userauthid, userip, password)
@ -823,8 +824,8 @@ public client_infochanged(id)
new newname[MAX_NAME_LENGTH], oldname[MAX_NAME_LENGTH]
get_user_name(id, oldname, 31)
get_user_info(id, "name", newname, 31)
get_user_name(id, oldname, charsmax(oldname))
get_user_info(id, "name", newname, charsmax(newname))
if (g_CaseSensitiveName[id])
{

View File

@ -79,8 +79,8 @@ public cmdCancelVote(id, level, cid)
{
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
log_amx("Vote: ^"%s<%d><%s><>^" cancel vote session", name, get_user_userid(id), authid)
new msg[256];
@ -173,7 +173,7 @@ public checkVotes()
return PLUGIN_CONTINUE
}
g_execLen = format(g_Execute, 255, g_Answer, g_optionName[best]) + 1
g_execLen = format(g_Execute, charsmax(g_Execute), g_Answer, g_optionName[best]) + 1
if (g_execResult)
{
@ -183,14 +183,14 @@ public checkVotes()
{
new menuBody[512], lTheResult[32], lYes[16], lNo[16]
format(lTheResult, 31, "%L", g_voteCaller, "THE_RESULT")
format(lYes, 15, "%L", g_voteCaller, "YES")
format(lNo, 15, "%L", g_voteCaller, "NO")
format(lTheResult, charsmax(lTheResult), "%L", g_voteCaller, "THE_RESULT")
format(lYes, charsmax(lYes), "%L", g_voteCaller, "YES")
format(lNo, charsmax(lNo), "%L", g_voteCaller, "NO")
new len = format(menuBody, 511, g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%s: \w%s^n^n" : "%s: %s^n^n", lTheResult, g_Execute)
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
format(menuBody[len], 511 - len, "^n1. %s^n2. %s", lYes, lNo)
len += format(menuBody[len], charsmax(menuBody) - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", g_voteCaller, "WANT_CONTINUE")
format(menuBody[len], charsmax(menuBody) - len, "^n1. %s^n2. %s", lYes, lNo)
show_menu(g_voteCaller, 0x03, menuBody, 10, "The result: ")
set_task(10.0, "autoRefuse", 4545454)
}
@ -202,11 +202,11 @@ public checkVotes()
for (i = 0; i < pnum; i++)
{
format(lVotingSuccess, 31, "%L", players[i], "VOTING_SUCCESS")
format(lVotingSuccess, charsmax(lVotingSuccess), "%L", players[i], "VOTING_SUCCESS")
client_print(players[i], print_chat, "%L", players[i], "VOTING_RES_3", lVotingSuccess, iResult, iRatio, g_Execute)
}
format(lVotingSuccess, 31, "%L", "en", "VOTING_SUCCESS")
format(lVotingSuccess, charsmax(lVotingSuccess), "%L", "en", "VOTING_SUCCESS")
log_amx("Vote: %s (got ^"%d^") (needed ^"%d^") (result ^"%s^")", lVotingSuccess, iResult, iRatio, g_Execute)
return PLUGIN_CONTINUE
@ -217,7 +217,7 @@ public voteCount(id, key)
if (get_cvar_num("amx_vote_answers"))
{
new name[MAX_NAME_LENGTH]
get_user_name(id, name, 31)
get_user_name(id, name, charsmax(name))
if (g_yesNoVote)
client_print(0, print_chat, "%L", LANG_PLAYER, key ? "VOTED_AGAINST" : "VOTED_FOR", name)
@ -268,7 +268,7 @@ public cmdVoteMap(id, level, cid)
{
new lMaps[16]
format(lMaps, 15, "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
format(lMaps, charsmax(lMaps), "%L", id, (argc == 2) ? "MAP_IS" : "MAPS_ARE")
console_print(id, "%L", id, "GIVEN_NOT_VALID", lMaps)
return PLUGIN_HANDLED
}
@ -279,33 +279,33 @@ public cmdVoteMap(id, level, cid)
if (g_validMaps > 1)
{
keys = MENU_KEY_0
len = format(menu_msg, 255, g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
len = format(menu_msg, charsmax(menu_msg), g_coloredMenus ? "\y%L: \w^n^n" : "%L: ^n^n", LANG_SERVER, "CHOOSE_MAP")
new temp[128]
for (new a = 0; a < g_validMaps; ++a)
{
format(temp, 127, "%d. %s^n", a+1, g_optionName[a])
len += copy(menu_msg[len], 255-len, temp)
format(temp, charsmax(temp), "%d. %s^n", a+1, g_optionName[a])
len += copy(menu_msg[len], charsmax(menu_msg) - len, temp)
keys |= (1<<a)
}
format(menu_msg[len], 255-len, "^n0. %L", LANG_SERVER, "NONE")
format(menu_msg[len], charsmax(menu_msg) - len, "^n0. %L", LANG_SERVER, "NONE")
g_yesNoVote = 0
} else {
new lChangeMap[32], lYes[16], lNo[16]
format(lChangeMap, 31, "%L", LANG_SERVER, "CHANGE_MAP_TO")
format(lYes, 15, "%L", LANG_SERVER, "YES")
format(lNo, 15, "%L", LANG_SERVER, "NO")
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
format(lChangeMap, charsmax(lChangeMap), "%L", LANG_SERVER, "CHANGE_MAP_TO")
format(lYes, charsmax(lYes), "%L", LANG_SERVER, "YES")
format(lNo, charsmax(lNo), "%L", LANG_SERVER, "NO")
format(menu_msg, charsmax(menu_msg), g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lChangeMap, g_optionName[0], lYes, lNo)
keys = MENU_KEY_1|MENU_KEY_2
g_yesNoVote = 1
}
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
if (argc == 2)
log_amx("Vote: ^"%s<%d><%s><>^" vote map (map ^"%s^")", name, get_user_userid(id), authid, g_optionName[0])
@ -360,7 +360,7 @@ public cmdVote(id, level, cid)
}
new quest[48]
read_argv(1, quest, 47)
read_argv(1, quest, charsmax(quest))
trim(quest);
@ -374,13 +374,13 @@ public cmdVote(id, level, cid)
for (new i=0;i<4 && (i+2)<count;i++)
{
read_argv(i+2, g_optionName[i], sizeof(g_optionName[])-1);
read_argv(i+2, g_optionName[i], charsmax(g_optionName[]));
}
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
log_amx("Vote: ^"%s<%d><%s><>^" vote custom (question ^"%s^") (option#1 ^"%s^") (option#2 ^"%s^")", name, get_user_userid(id), authid, quest, g_optionName[0], g_optionName[1])
new msg[256];
@ -399,7 +399,7 @@ public cmdVote(id, level, cid)
new menu_msg[512], lVote[16]
format(lVote, 15, "%L", LANG_SERVER, "VOTE")
format(lVote, charsmax(lVote), "%L", LANG_SERVER, "VOTE")
count-=2;
if (count>4)
@ -413,11 +413,11 @@ public cmdVote(id, level, cid)
keys |= (1<<i);
}
new len=formatex(menu_msg, sizeof(menu_msg)-1, g_coloredMenus ? "\y%s: %s\w^n^n" : "%s: %s^n^n", lVote, quest);
new len=formatex(menu_msg, charsmax(menu_msg), g_coloredMenus ? "\y%s: %s\w^n^n" : "%s: %s^n^n", lVote, quest);
for (new i=0;i<count;i++)
{
len+=formatex(menu_msg[len], sizeof(menu_msg) - 1 - len ,"%d. %s^n",i+1,g_optionName[i]);
len+=formatex(menu_msg[len], charsmax(menu_msg) - len ,"%d. %s^n",i+1,g_optionName[i]);
}
g_execResult = false
@ -425,8 +425,8 @@ public cmdVote(id, level, cid)
set_cvar_float("amx_last_voting", get_gametime() + vote_time)
g_voteRatio = get_cvar_float("amx_vote_ratio")
replace_all(quest,sizeof(quest)-1,"%","");
format(g_Answer, 127, "%s - %%s", quest)
replace_all(quest, charsmax(quest), "%", "");
format(g_Answer, charsmax(g_Answer), "%s - %%s", quest)
show_menu(0, keys, menu_msg, floatround(vote_time), "Vote: ")
set_task(vote_time, "checkVotes", 99889988)
g_voteCaller = id
@ -457,11 +457,11 @@ public cmdVoteKickBan(id, level, cid)
new cmd[32]
read_argv(0, cmd, 31)
read_argv(0, cmd, charsmax(cmd))
new voteban = equal(cmd, "amx_voteban")
new arg[32]
read_argv(1, arg, 31)
read_argv(1, arg, charsmax(arg))
new player = cmd_target(id, arg, CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
@ -472,7 +472,7 @@ public cmdVoteKickBan(id, level, cid)
{
new imname[32]
get_user_name(player, imname, 31)
get_user_name(player, imname, charsmax(imname))
console_print(id, "%L", id, "ACTION_PERFORMED", imname)
return PLUGIN_HANDLED
}
@ -480,19 +480,19 @@ public cmdVoteKickBan(id, level, cid)
new keys = MENU_KEY_1|MENU_KEY_2
new menu_msg[256], lYes[16], lNo[16], lKickBan[16]
format(lYes, 15, "%L", LANG_SERVER, "YES")
format(lNo, 15, "%L", LANG_SERVER, "NO")
format(lKickBan, 15, "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
format(lYes, charsmax(lYes), "%L", LANG_SERVER, "YES")
format(lNo, charsmax(lNo), "%L", LANG_SERVER, "NO")
format(lKickBan, charsmax(lKickBan), "%L", LANG_SERVER, voteban ? "BAN" : "KICK")
ucfirst(lKickBan)
get_user_name(player, arg, 31)
format(menu_msg, 255, g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
format(menu_msg, charsmax(menu_msg), g_coloredMenus ? "\y%s %s?\w^n^n1. %s^n2. %s" : "%s %s?^n^n1. %s^n2. %s", lKickBan, arg, lYes, lNo)
g_yesNoVote = 1
new bool:ipban=false;
if (voteban)
{
get_user_authid(player, g_optionName[0], sizeof(g_optionName[])-1);
get_user_authid(player, g_optionName[0], charsmax(g_optionName[]));
// Do the same check that's in plmenu to determine if this should be an IP ban instead
if (equal("4294967295", g_optionName[0])
@ -500,7 +500,7 @@ public cmdVoteKickBan(id, level, cid)
|| equal("STEAM_ID_LAN", g_optionName[0])
|| equali("VALVE_ID_LAN", g_optionName[0]))
{
get_user_ip(player, g_optionName[0], sizeof(g_optionName[])-1, 1);
get_user_ip(player, g_optionName[0], charsmax(g_optionName[]), 1);
ipban=true;
}
@ -508,13 +508,13 @@ public cmdVoteKickBan(id, level, cid)
}
else
{
num_to_str(get_user_userid(player), g_optionName[0], 31)
num_to_str(get_user_userid(player), g_optionName[0], charsmax(g_optionName[]))
}
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
log_amx("Vote: ^"%s<%d><%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg)
new msg[256];

View File

@ -101,16 +101,16 @@ public plugin_init()
register_dictionary("common.txt")
new configsDir[64], config[64]
get_configsdir(configsDir, 63)
get_configsdir(configsDir, charsmax(configsDir))
for (new a = 0; a < MAX_CMDS_LAYERS; ++a)
{
new MenuName[64]
format(MenuName, 63, "%L", "en", g_cmdMenuName[a])
format(MenuName, charsmax(MenuName), "%L", "en", g_cmdMenuName[a])
register_menucmd(register_menuid(MenuName), 1023, "actionCmdMenu")
register_clcmd(g_cmdMenuCmd[a], "cmdCmdMenu", ADMIN_MENU, g_cmdMenuHelp[a])
format(config, 63, "%s/%s", configsDir, g_cmdMenuCfg[a])
format(config, charsmax(config), "%s/%s", configsDir, g_cmdMenuCfg[a])
loadCmdSettings(config, a)
}
@ -118,7 +118,7 @@ public plugin_init()
register_clcmd("amx_cvarmenu", "cmdCvarMenu", ADMIN_CVAR, "- displays cvars menu")
new cvars_ini_file[64];
format(cvars_ini_file, 63, "%s/%s", configsDir, "cvars.ini");
format(cvars_ini_file, charsmax(cvars_ini_file), "%s/%s", configsDir, "cvars.ini");
loadCvarSettings(cvars_ini_file)
g_coloredMenus = colored_menus()
@ -128,8 +128,8 @@ public plugin_init()
public plugin_precache( )
{
new configsDir[64], config[64];
get_configsdir( configsDir, 63 );
formatex( config, 63, "%s/%s", configsDir, "speech.ini" );
get_configsdir(configsDir, charsmax(configsDir));
formatex( config, charsmax(config), "%s/%s", configsDir, "speech.ini" );
new fp = fopen( config, "rt" ); // Read file as text
@ -154,33 +154,33 @@ public plugin_precache( )
if ( len == 0 || szText[0] == ';' || szText[0] == '/' ) // Line is empty or a comment
continue;
parse( szText, szName, 31, szSound, 127 );
fieldNums = parse( szSound, field1, 31, field2, 63, field3, 63 );
parse( szText, szName, charsmax(szName), szSound, charsmax(szSound) );
fieldNums = parse( szSound, field1, charsmax(field1), field2, charsmax(field2), field3, charsmax(field3) );
if ( fieldNums == 2 && field1[0] == 's' ) // .wav (spk)
{
copy( szSound, 127, field2 );
copy( sndExt, 4, ".wav" );
copy( szSound, charsmax(szSound), field2 );
copy( sndExt, charsmax(sndExt), ".wav" );
}
else if ( fieldNums == 3 && field1[0] == 'm' && ( field2[0] == 'p' || field2[0] == 'l' ) ) // .mp3 (mp3 play | mp3 loop)
{
copy( szSound, 127, field3 );
copy( sndExt, 4, ".mp3" );
copy( szSound, charsmax(szSound), field3 );
copy( sndExt, charsmax(sndExt), ".mp3" );
}
else // WTH is this sound, drop it.
continue;
replace_all( szSound, 127, "\'", "" ); // Strips all ugly (and sometimes useless) \'
replace_all( szSound, charsmax(szSound), "\'", "" ); // Strips all ugly (and sometimes useless) \'
if ( szSound[0] == '/' )
replace( szSound, 127, "/", "" ); // Strip leading slash
replace( szSound, charsmax(szSound), "/", "" ); // Strip leading slash
if ( sndExt[1] == 'm' || ( ! equali( szSound, "vox", 3 ) && ! equali( szSound, "fvox", 4 ) && ! equali( szSound, "barney", 6 ) && ! equali( szSound, "hgrunt", 6 ) ) )
{
// SzSound is a mp3, or a custom wav (not a vox, fvox, or default sound from HL pak)
if ( !equali( szSound[strlen(szSound)-4], sndExt ) )
add( szSound, 127, sndExt ); // Add filetype extension if it isn't already specified
add( szSound, charsmax(szSound), sndExt ); // Add filetype extension if it isn't already specified
if ( sndExt[1] == 'w' )
format( szSound, 127, "sound/%s", szSound ); // spk basedir is $moddir/sound, but mp3 play is $moddir, fix this for the file_exists check
format( szSound, charsmax(szSound), "sound/%s", szSound ); // spk basedir is $moddir/sound, but mp3 play is $moddir, fix this for the file_exists check
if ( file_exists( szSound ) )
{
if ( sndExt[1] == 'm')
@ -189,7 +189,7 @@ public plugin_precache( )
}
else
{
replace( szSound, 127, "sound/", "" ); // wav, strip the leading sound/ we added for our file_exists check
replace( szSound, charsmax(szSound), "sound/", "" ); // wav, strip the leading sound/ we added for our file_exists check
precache_sound( szSound );
}
}
@ -242,7 +242,7 @@ displayCmdMenu(id, pos)
start = pos = g_menuPosition[id] = 0
new limit = (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8)))
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, g_cmdMenuName[g_menuLayer[id]], pos + 1, (limit == 0) ? 1 : limit)
new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, g_cmdMenuName[g_menuLayer[id]], pos + 1, (limit == 0) ? 1 : limit)
new end = start + 8
new keys = MENU_KEY_0
@ -254,27 +254,27 @@ displayCmdMenu(id, pos)
if (g_cmdCmd[g_menuSelect[id][a]][0] == '-')
{
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%s^n\w", g_cmdName[g_menuSelect[id][a]])
len += format(menuBody[len], charsmax(menuBody) - len, "\d%s^n\w", g_cmdName[g_menuSelect[id][a]])
else
len += format(menuBody[len], 511-len, "%s^n", g_cmdName[g_menuSelect[id][a]])
len += format(menuBody[len], charsmax(menuBody) - len, "%s^n", g_cmdName[g_menuSelect[id][a]])
++b
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_cmdName[g_menuSelect[id][a]])
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", ++b, g_cmdName[g_menuSelect[id][a]])
}
}
if (end != g_menuSelectNum[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
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
format(menuBody[len], charsmax(menuBody) - len, "^n0. %L", id, pos ? "BACK" : "EXIT")
new MenuName[64]
format(MenuName, 63, "%L", "en", g_cmdMenuName[g_menuLayer[id]])
format(MenuName, charsmax(MenuName), "%L", "en", g_cmdMenuName[g_menuLayer[id]])
show_menu(id, keys, menuBody, -1, MenuName)
}
@ -284,7 +284,7 @@ public cmdCmdMenu(id, level, cid)
return PLUGIN_HANDLED
new szCmd[32]
read_argv(0, szCmd, 31)
read_argv(0, szCmd, charsmax(szCmd))
new lvl = 0
while (lvl < MAX_CMDS_LAYERS)
@ -330,9 +330,9 @@ loadCmdSettings(szFilename[], level)
if (text[0] == ';') continue
c = d + g_cmdNum[level]
if (parse(text, g_cmdName[c], 31, g_cmdCmd[c], 63, szFlags, 31, szAccess, 31) > 3)
if (parse(text, g_cmdName[c], charsmax(g_cmdName[]), g_cmdCmd[c], charsmax(g_cmdCmd[]), szFlags, charsmax(szFlags), szAccess, charsmax(szAccess)) > 3)
{
while (replace(g_cmdCmd[c], 63, "\'", "^""))
while (replace(g_cmdCmd[c], charsmax(g_cmdCmd[]), "\'", "^""))
{
// do nothing
}
@ -359,7 +359,7 @@ public actionCvarMenu(id, key)
new option = g_menuSelect[id][g_menuPosition[id] * 8 + key]
new szValue[32]
get_cvar_string(g_cvarNames[option], szValue, 31)
get_cvar_string(g_cvarNames[option], szValue, charsmax(szValue))
new end = g_cvarMisc[option][2]
new start = g_cvarMisc[option][1]
@ -402,7 +402,7 @@ displayCvarMenu(id, pos)
if (start >= g_menuSelectNum[id])
start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\yCvars Menu\R%d/%d^n\w^n" : "Cvars Menu %d/%d^n^n", pos + 1, (g_menuSelectNum[id] / 8 + ((g_menuSelectNum[id] % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
@ -413,23 +413,23 @@ displayCvarMenu(id, pos)
for (new a = start; a < end; ++a)
{
get_cvar_string(g_cvarNames[g_menuSelect[id][a]], szValue, 31)
get_cvar_string(g_cvarNames[g_menuSelect[id][a]], szValue, charsmax(szValue))
keys |= (1<<b)
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "%d. %s\R%s^n\w", b, g_cvarNames[g_menuSelect[id][a]], szValue)
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s\R%s^n\w", b, g_cvarNames[g_menuSelect[id][a]], szValue)
else
len += format(menuBody[len], 511-len, "%d. %s %s^n", b, g_cvarNames[g_menuSelect[id][a]], szValue)
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s %s^n", b, g_cvarNames[g_menuSelect[id][a]], szValue)
}
if (end != g_menuSelectNum[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
}
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)
}
@ -460,15 +460,23 @@ loadCvarSettings(szFilename[])
new cvar_values = MAX_CVARS * 5
// a b c d
while (g_cvarNum < MAX_CVARS && read_file(szFilename, pos++, text, 255, a))
while (g_cvarNum < MAX_CVARS && read_file(szFilename, pos++, text, charsmax(text), a))
{
if (text[0] == ';') continue
inum = parse(text, g_cvarNames[g_cvarNum], 31,
szValues[0], 31, szValues[1], 31, szValues[2], 31,
szValues[3], 31, szValues[4], 31, szValues[5], 31,
szValues[6], 31, szValues[7], 31, szValues[8], 31,
szValues[9], 31, szValues[10], 31, szValues[11], 31)
inum = parse(text, g_cvarNames[g_cvarNum], charsmax(g_cvarNames[]),
szValues[0], charsmax(szValue[]),
szValues[1], charsmax(szValue[]),
szValues[2], charsmax(szValue[]),
szValues[3], charsmax(szValue[]),
szValues[4], charsmax(szValue[]),
szValues[5], charsmax(szValue[]),
szValues[6], charsmax(szValue[]),
szValues[7], charsmax(szValue[]),
szValues[8], charsmax(szValue[]),
szValues[9], charsmax(szValue[]),
szValues[10], charsmax(szValue[]),
szValues[11], charsmax(szValue[]))
inum -= 2
if (inum < 2) continue
@ -476,12 +484,12 @@ loadCvarSettings(szFilename[])
for (a = 0; a < inum && g_cvarCmdNum < cvar_values; ++a)
{
while (replace(szValues[a], 31, "\'", "^""))
while (replace(szValues[a], charsmax(szValue[]), "\'", "^""))
{
// do nothing
}
copy(g_cvarCmd[g_cvarCmdNum], 31, szValues[a])
copy(g_cvarCmd[g_cvarCmdNum], charsmax(g_cvarCmdNum[]), szValues[a])
g_cvarCmdNum++
}

View File

@ -44,8 +44,6 @@ new Array:g_Messages
new g_MessagesNum
new g_Current
#define charsof(%1) (sizeof(%1)-1)
new amx_freq_imessage;
public plugin_init()
@ -59,7 +57,7 @@ public plugin_init()
amx_freq_imessage=register_cvar("amx_freq_imessage", "10")
new lastinfo[8]
get_localinfo("lastinfomsg", lastinfo, 7)
get_localinfo("lastinfomsg", lastinfo, charsmax(lastinfo))
g_Current = str_to_num(lastinfo)
set_localinfo("lastinfomsg", "")
}
@ -78,13 +76,13 @@ public infoMessage()
new values[3];
new Message[384];
ArrayGetString(g_Messages, g_Current, Message, charsof(Message));
ArrayGetString(g_Messages, g_Current, Message, charsmax(Message));
ArrayGetArray(g_Values, g_Current, values);
new hostname[64];
get_cvar_string("hostname", hostname, 63);
replace(Message, 380, "%hostname%", hostname);
get_cvar_string("hostname", hostname, charsmax(hostname));
replace(Message, charsmax(Message), "%hostname%", hostname);
set_hudmessage(values[0], values[1], values[2], X_POS, Y_POS, 0, 0.5, HOLD_TIME, 2.0, 2.0, -1);
@ -105,14 +103,14 @@ public setMessage()
new Message[384];
remove_task(12345)
read_argv(1, Message, 380)
read_argv(1, Message, charsmax(Message))
while (replace(Message, 380, "\n", "^n")) {}
while (replace(Message, charsmax(Message), "\n", "^n")) {}
new mycol[12]
new vals[3];
read_argv(2, mycol, 11) // RRRGGGBBB
read_argv(2, mycol, charsmax(mycol)) // RRRGGGBBB
vals[2] = str_to_num(mycol[6])
mycol[6] = 0
@ -138,6 +136,6 @@ public plugin_end()
{
new lastinfo[8]
num_to_str(g_Current, lastinfo, 7)
num_to_str(g_Current, lastinfo, charsmax(lastinfo))
set_localinfo("lastinfomsg", lastinfo)
}

View File

@ -37,8 +37,6 @@
#define SELECTMAPS 5
#define charsof(%1) (sizeof(%1)-1)
new Array:g_mapName;
new g_mapNums;
@ -61,7 +59,7 @@ public plugin_init()
new MenuName[64]
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
format(MenuName, charsmax(MenuName), "%L", "en", "CHOOSE_NEXTM")
register_menucmd(register_menuid(MenuName), (-1^(-1<<(SELECTMAPS+2))), "countVote")
register_cvar("amx_extendmap_max", "90")
register_cvar("amx_extendmap_step", "15")
@ -69,15 +67,15 @@ public plugin_init()
if (cstrike_running())
register_event("TeamScore", "team_score", "a")
get_localinfo("lastMap", g_lastMap, 31)
get_localinfo("lastMap", g_lastMap, charsmax(g_lastMap))
set_localinfo("lastMap", "")
new maps_ini_file[64]
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
get_configsdir(maps_ini_file, charsmax(maps_ini_file));
format(maps_ini_file, charsmax(maps_ini_file), "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, 63)
get_cvar_string("mapcyclefile", maps_ini_file, charsmax(maps_ini_file))
if (loadSettings(maps_ini_file))
set_task(15.0, "voteNextmap", 987456, "", 0, "b")
@ -99,7 +97,7 @@ public checkVotes()
{
new mapname[32]
get_mapname(mapname, 31)
get_mapname(mapname, charsmax(mapname))
new Float:steptime = get_cvar_float("amx_extendmap_step")
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_EXT", steptime)
@ -111,12 +109,12 @@ public checkVotes()
new smap[32]
if (g_voteCount[b] && g_voteCount[SELECTMAPS + 1] <= g_voteCount[b])
{
ArrayGetString(g_mapName, g_nextName[b], smap, charsof(smap));
ArrayGetString(g_mapName, g_nextName[b], smap, charsmax(smap));
set_cvar_string("amx_nextmap", smap);
}
get_cvar_string("amx_nextmap", smap, 31)
get_cvar_string("amx_nextmap", smap, charsmax(smap))
client_print(0, print_chat, "%L", LANG_PLAYER, "CHO_FIN_NEXT", smap)
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
}
@ -126,14 +124,14 @@ public countVote(id, key)
if (get_cvar_float("amx_vote_answers"))
{
new name[MAX_NAME_LENGTH]
get_user_name(id, name, 31)
get_user_name(id, name, charsmax(name))
if (key == SELECTMAPS)
client_print(0, print_chat, "%L", LANG_PLAYER, "CHOSE_EXT", name)
else if (key < SELECTMAPS)
{
new map[32];
ArrayGetString(g_mapName, g_nextName[key], map, charsof(map));
ArrayGetString(g_mapName, g_nextName[key], map, charsmax(map));
client_print(0, print_chat, "%L", LANG_PLAYER, "X_CHOSE_X", name, map);
}
}
@ -189,7 +187,7 @@ public voteNextmap()
new menu[512], a, mkeys = (1<<SELECTMAPS + 1)
new pos = format(menu, 511, g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
new pos = format(menu, charsmax(menu), g_coloredMenus ? "\y%L:\w^n^n" : "%L:^n^n", LANG_SERVER, "CHOOSE_NEXTM")
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
for (g_mapVoteNum = 0; g_mapVoteNum < dmax; ++g_mapVoteNum)
@ -200,7 +198,7 @@ public voteNextmap()
if (++a >= g_mapNums) a = 0
g_nextName[g_mapVoteNum] = a
pos += format(menu[pos], 511, "%d. %a^n", g_mapVoteNum + 1, ArrayGetStringHandle(g_mapName, a));
pos += format(menu[pos], charsmax(menu), "%d. %a^n", g_mapVoteNum + 1, ArrayGetStringHandle(g_mapName, a));
mkeys |= (1<<g_mapVoteNum)
g_voteCount[g_mapVoteNum] = 0
}
@ -210,18 +208,18 @@ public voteNextmap()
g_voteCount[SELECTMAPS + 1] = 0
new mapname[32]
get_mapname(mapname, 31)
get_mapname(mapname, charsmax(mapname))
if ((winlimit + maxrounds) == 0 && (get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max")))
{
pos += format(menu[pos], 511, "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname)
pos += format(menu[pos], charsmax(menu), "%d. %L^n", SELECTMAPS + 1, LANG_SERVER, "EXTED_MAP", mapname)
mkeys |= (1<<SELECTMAPS)
}
format(menu[pos], 511, "%d. %L", SELECTMAPS+2, LANG_SERVER, "NONE")
format(menu[pos], charsmax(menu), "%d. %L", SELECTMAPS+2, LANG_SERVER, "NONE")
new MenuName[64]
format(MenuName, 63, "%L", "en", "CHOOSE_NEXTM")
format(MenuName, charsmax(MenuName), "%L", "en", "CHOOSE_NEXTM")
show_menu(0, mkeys, menu, 15, MenuName)
set_task(15.0, "checkVotes")
client_print(0, print_chat, "%L", LANG_SERVER, "TIME_CHOOSE")
@ -268,7 +266,7 @@ loadSettings(filename[])
new buff[256];
get_mapname(currentMap, 31)
get_mapname(currentMap, charsmax(currentMap))
new fp=fopen(filename,"r");
@ -277,9 +275,9 @@ loadSettings(filename[])
buff[0]='^0';
szText[0]='^0';
fgets(fp, buff, charsof(buff));
fgets(fp, buff, charsmax(buff));
parse(buff, szText, charsof(szText));
parse(buff, szText, charsmax(szText));
if (szText[0] != ';' &&
@ -302,7 +300,7 @@ public team_score()
{
new team[2]
read_data(1, team, 1)
read_data(1, team, charsmax(team))
g_teamScore[(team[0]=='C') ? 0 : 1] = read_data(2)
}
@ -310,6 +308,6 @@ public plugin_end()
{
new current_map[32]
get_mapname(current_map, 31)
get_mapname(current_map, charsmax(current_map))
set_localinfo("lastMap", current_map)
}

View File

@ -65,14 +65,14 @@ public plugin_init()
g_mapName=ArrayCreate(32);
new maps_ini_file[64];
get_configsdir(maps_ini_file, 63);
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file);
get_configsdir(maps_ini_file, charsmax(maps_ini_file));
format(maps_ini_file, charsmax(maps_ini_file), "%s/maps.ini", maps_ini_file);
if (!file_exists(maps_ini_file))
get_cvar_string("mapcyclefile", maps_ini_file, sizeof(maps_ini_file) - 1);
get_cvar_string("mapcyclefile", maps_ini_file, charsmax(maps_ini_file));
if (!file_exists(maps_ini_file))
format(maps_ini_file, 63, "mapcycle.txt")
format(maps_ini_file, charsmax(maps_ini_file), "mapcycle.txt")
load_settings(maps_ini_file)
@ -94,7 +94,7 @@ public actionResult(id, key)
case 0:
{
new _modName[10]
get_modname(_modName, 9)
get_modname(_modName, charsmax(_modName))
if (!equal(_modName, "zp"))
{
@ -148,16 +148,16 @@ public checkVotes(id)
new menuBody[512]
new tempMap[32];
ArrayGetString(g_mapName, g_choosed, tempMap, charsmax(tempMap));
new len = format(menuBody, 511, g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", tempMap)
new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L: \w%s^n^n" : "%L: %s^n^n", id, "THE_WINNER", tempMap)
len += format(menuBody[len], 511 - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
format(menuBody[len], 511-len, "^n1. %L^n2. %L", id, "YES", id, "NO")
len += format(menuBody[len], charsmax(menuBody) - len, g_coloredMenus ? "\y%L^n\w" : "%L^n", id, "WANT_CONT")
format(menuBody[len], charsmax(menuBody) - len, "^n1. %L^n2. %L", id, "YES", id, "NO")
show_menu(id, 0x03, menuBody, 10, "The winner: ")
set_task(10.0, "autoRefuse", 4545454)
} else {
new _modName[10]
get_modname(_modName, 9)
get_modname(_modName, charsmax(_modName))
if (!equal(_modName, "zp"))
{
@ -192,7 +192,7 @@ public voteCount(id, key)
{
new name[MAX_NAME_LENGTH]
get_user_name(id, name, 31)
get_user_name(id, name, charsmax(name))
client_print(0, print_chat, "%L", LANG_PLAYER, "X_VOTED_FOR", name, key + 1)
}
@ -219,7 +219,7 @@ displayVoteMapsMenu(id, pos)
if (start >= g_mapNums)
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, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 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, "VOTEMAP_MENU", pos + 1, (g_mapNums / 7 + ((g_mapNums % 7) ? 1 : 0)))
new end = start + 7, keys = MENU_KEY_0
if (end > g_mapNums)
@ -233,49 +233,49 @@ displayVoteMapsMenu(id, pos)
{
++b
if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, tempMap)
len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, tempMap)
else
len += format(menuBody[len], 511-len, "#. %s^n", tempMap)
len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", tempMap)
} else {
keys |= (1<<b)
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", ++b, tempMap)
}
}
if (g_voteSelectedNum[id])
{
keys |= MENU_KEY_8
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "START_VOT")
len += format(menuBody[len], charsmax(menuBody) - len, "^n8. %L^n", id, "START_VOT")
}
else
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")
len += format(menuBody[len], charsmax(menuBody) - len, g_coloredMenus ? "^n\d8. %L^n\w" : "^n#. %L^n", id, "START_VOT")
if (end != g_mapNums)
{
len += format(menuBody[len], 511-len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
len += format(menuBody[len], charsmax(menuBody) - len, "^n9. %L...^n0. %L^n", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
len += format(menuBody[len], 511-len, "^n0. %L^n", id, pos ? "BACK" : "EXIT")
len += format(menuBody[len], charsmax(menuBody) - len, "^n0. %L^n", id, pos ? "BACK" : "EXIT")
if (g_voteSelectedNum[id])
len += format(menuBody[len], 511-len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n", id, "SEL_MAPS")
len += format(menuBody[len], charsmax(menuBody) - len, g_coloredMenus ? "^n\y%L:^n\w" : "^n%L:^n", id, "SEL_MAPS")
else
len += format(menuBody[len], 511-len, "^n^n")
len += format(menuBody[len], charsmax(menuBody) - len, "^n^n")
for (new c = 0; c < 4; c++)
{
if (c < g_voteSelectedNum[id])
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%s^n", tempMap)
len += format(menuBody[len], charsmax(menuBody) - len, "%s^n", tempMap)
}
else
len += format(menuBody[len], 511-len, "^n")
len += format(menuBody[len], charsmax(menuBody) - len, "^n")
}
new menuName[64]
format(menuName, 63, "%L", "en", "VOTEMAP_MENU")
format(menuName, charsmax(menuName), "%L", "en", "VOTEMAP_MENU")
show_menu(id, keys, menuBody, -1, menuName)
}
@ -360,38 +360,38 @@ public actionVoteMapMenu(id, key)
if (g_voteSelectedNum[id] > 1)
{
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L^n\w^n" : "%L^n^n", id, "WHICH_MAP")
for (new c = 0; c < g_voteSelectedNum[id]; ++c)
{
ArrayGetString(g_mapName, g_voteSelected[id][c], tempMap, charsmax(tempMap));
len += format(menuBody[len], 511, "%d. %s^n", c + 1, tempMap)
len += format(menuBody[len], charsmax(menuBody), "%d. %s^n", c + 1, tempMap)
keys |= (1<<c)
}
keys |= (1<<8)
len += format(menuBody[len], 511, "^n9. %L^n", id, "NONE")
len += format(menuBody[len], charsmax(menuBody), "^n9. %L^n", id, "NONE")
} else {
ArrayGetString(g_mapName, g_voteSelected[id][0], tempMap, charsmax(tempMap));
len = format(menuBody, 511, g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO")
len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L^n%s?^n\w^n1. %L^n2. %L^n" : "%L^n%s?^n^n1. %L^n2. %L^n", id, "CHANGE_MAP_TO", tempMap, id, "YES", id, "NO")
keys = MENU_KEY_1|MENU_KEY_2
}
new menuName[64]
format(menuName, 63, "%L", "en", "WHICH_MAP")
format(menuName, charsmax(menuName), "%L", "en", "WHICH_MAP")
for (new b = 0; b < pnum; ++b)
if (players[b] != id)
show_menu(players[b], keys, menuBody, iVoteTime, menuName)
format(menuBody[len], 511, "^n0. %L", id, "CANC_VOTE")
format(menuBody[len], charsmax(menuBody), "^n0. %L", id, "CANC_VOTE")
keys |= MENU_KEY_0
show_menu(id, keys, menuBody, iVoteTime, menuName)
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
show_activity_key("ADMIN_V_MAP_1", "ADMIN_V_MAP_2", name);
@ -459,7 +459,7 @@ public actionMapsMenu(id, key)
new a = g_menuPosition[id] * 8 + key
new _modName[10]
get_modname(_modName, 9)
get_modname(_modName, charsmax(_modName))
if (!equal(_modName, "zp"))
{
message_begin(MSG_ALL, SVC_INTERMISSION)
@ -468,8 +468,8 @@ public actionMapsMenu(id, key)
new authid[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_name(id, name, charsmax(name))
new tempMap[32];
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
@ -498,7 +498,7 @@ displayMapsMenu(id, pos)
if (start >= g_mapNums)
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, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 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, "CHANGLE_MENU", pos + 1, (g_mapNums / 8 + ((g_mapNums % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
@ -509,16 +509,16 @@ displayMapsMenu(id, pos)
{
keys |= (1<<b)
ArrayGetString(g_mapName, a, tempMap, charsmax(tempMap));
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, tempMap)
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", ++b, tempMap)
}
if (end != g_mapNums)
{
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
}
else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
format(menuBody[len], charsmax(menuBody) - len, "^n0. %L", id, pos ? "BACK" : "EXIT")
new menuName[64]
format(menuName, 63, "%L", "en", "CHANGLE_MENU")

View File

@ -199,7 +199,7 @@ displayMenu(id, pos)
if (start >= g_menusNumber) // MENUS_NUMBER
start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511,
new len = format(menuBody, charsmax(menuBody),
g_coloredMenus ? "\yAMX Mod X Menu\R%d/%d^n\w^n" : "AMX Mod X Menu %d/%d^n^n" , pos + 1, (g_menusNumber / MENUITEMSPERPAGE) + (((g_menusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
@ -218,33 +218,33 @@ displayMenu(id, pos)
keys |= (1<<b)
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %L^n", ++b, id, g_menuBody[a])
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", ++b, g_menuBody[a])
} else {
++b
if (g_coloredMenus)
{
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %L^n\w", b, id, g_menuBody[a])
else
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, g_menuBody[a])
} else {
if (g_menuBodyPhrase[a])
len += format(menuBody[len], 511-len, "#. %L^n", id, g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "#. %L^n", id, g_menuBody[a])
else
len += format(menuBody[len], 511-len, "#. %s^n", g_menuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", g_menuBody[a])
}
}
}
if (end != g_menusNumber) // MENUS_NUMBER
{
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
} 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)
@ -262,7 +262,7 @@ clientDisplayMenu(id, pos)
if (start >= g_clientMenusNumber) // MENUS_NUMBER
start = pos = g_clientMenuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\yAMX Mod X Client Menu\R%d/%d^n\w^n" : "AMX Mod X Client Menu %d/%d^n^n" , pos + 1, (g_clientMenusNumber / MENUITEMSPERPAGE) + (((g_clientMenusNumber % MENUITEMSPERPAGE) > 0) ? 1 : 0))
new end = start + MENUITEMSPERPAGE
new keys = MENU_KEY_0
@ -279,34 +279,34 @@ clientDisplayMenu(id, pos)
keys |= (1<<b)
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %L^n", ++b, id, g_clientMenuBody[a])
else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "%d. %s^n", ++b, g_clientMenuBody[a])
} else {
++b
if (g_coloredMenus)
{
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %L^n\w", b, id, g_clientMenuBody[a])
else
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "\d%d. %s^n\w", b, g_clientMenuBody[a])
} else {
if (g_clientMenuBodyPhrase[a])
len += format(menuBody[len], 511-len, "#. %L^n", id, g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "#. %L^n", id, g_clientMenuBody[a])
else
len += format(menuBody[len], 511-len, "#. %s^n", g_clientMenuBody[a])
len += format(menuBody[len], charsmax(menuBody) - len, "#. %s^n", g_clientMenuBody[a])
}
}
}
if (end != g_clientMenusNumber) // MENUS_NUMBER
{
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
}
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)
@ -386,6 +386,6 @@ public plugin_cfg()
AddDefaultMenus()
new configs[128]
get_configsdir(configs, 127)
get_configsdir(configs, charsmax(configs))
server_cmd("exec %s/custommenuitems.cfg", configs)
}

View File

@ -84,7 +84,7 @@ public cmdLangMenu(id, level, cid)
}
new buffer[3]
get_user_info(id, "lang", buffer, 2)
get_user_info(id, "lang", buffer, charsmax(buffer))
g_menuLang[id] = get_lang_id(buffer)
showMenu(id)
@ -137,7 +137,7 @@ public actionMenu(id, key)
new pLang[3], pLang_old[3]
get_lang(g_menuLang[id], pLang)
get_user_info(id, "lang", pLang_old, 2)
get_user_info(id, "lang", pLang_old, charsmax(pLang_old))
if (!equali(pLang, pLang_old))
{

View File

@ -66,8 +66,8 @@ public plugin_init()
register_menucmd(register_menuid("Pause/Unpause Plugins"), 1023, "actionMenu")
g_coloredMenus = colored_menus()
get_configsdir(g_fileToSave, 63);
format(g_fileToSave, 63, "%s/pausecfg.ini", g_fileToSave);
get_configsdir(g_fileToSave, charsmax(g_fileToSave));
format(g_fileToSave, charsmax(g_fileToSave), "%s/pausecfg.ini", g_fileToSave);
return PLUGIN_CONTINUE
}
@ -138,7 +138,7 @@ public actionMenu(id, key)
new option = g_menuPos[id] * 6 + key
new file[32], status[2]
get_plugin(option, file, 31, status, 0, status, 0, status, 0, status, 1)
get_plugin(option, file, charsmax(file), status, 0, status, 0, status, 0, status, 1)
switch (status[0])
{
@ -234,7 +234,7 @@ displayMenu(id, pos)
if (start >= datanum)
start = pos = g_menuPos[id] = 0
new len = format(menu_body, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "PAUSE_UNPAUSE", pos + 1, ((datanum / 6) + ((datanum % 6) ? 1 : 0)))
new len = format(menu_body, charsmax(menu_body), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "PAUSE_UNPAUSE", pos + 1, ((datanum / 6) + ((datanum % 6) ? 1 : 0)))
new end = start + 6, keys = MENU_KEY_0|MENU_KEY_8|MENU_KEY_7
if (end > datanum)
@ -242,34 +242,34 @@ displayMenu(id, pos)
for (new a = start; a < end; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
getStatus(id, status[0], statusCode, status, 7)
get_plugin(a, filename, charsmax(filename), title, charsmax(title), status, 0, status, 0, status, charsmax(status))
getStatus(id, status[0], statusCode, status, charsmax(status))
if (isSystem(a) || (statusCode != 'O' && statusCode != 'S'))
{
if (g_coloredMenus)
{
len += format(menu_body[len], 511-len, "\d%d. %s\R%s^n\w", ++k, title, status)
len += format(menu_body[len], charsmax(menu_body) - len, "\d%d. %s\R%s^n\w", ++k, title, status)
} else {
++k
len += format(menu_body[len], 511-len, "#. %s %s^n", title, status)
len += format(menu_body[len], charsmax(menu_body) - len, "#. %s %s^n", title, status)
}
} else {
keys |= (1<<k)
len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++k, title, status)
len += format(menu_body[len], charsmax(menu_body) - len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++k, title, status)
}
}
len += format(menu_body[len], 511-len, "^n7. %L^n", id, "CLEAR_PAUSED")
len += format(menu_body[len], 511-len, g_coloredMenus ? "8. %L \y\R%s^n\w" : "8. %L %s^n", id, "SAVE_PAUSED", g_Modified ? "*" : "")
len += format(menu_body[len], charsmax(menu_body) - len, "^n7. %L^n", id, "CLEAR_PAUSED")
len += format(menu_body[len], charsmax(menu_body) - len, g_coloredMenus ? "8. %L \y\R%s^n\w" : "8. %L %s^n", id, "SAVE_PAUSED", g_Modified ? "*" : "")
if (end != datanum)
{
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
format(menu_body[len], charsmax(menu_body) - len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
format(menu_body[len], charsmax(menu_body) - len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menu_body, -1, "Pause/Unpause Plugins")
}
@ -289,7 +289,7 @@ pausePlugins(id)
for (new a = 0; a < imax; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
get_plugin(a, filename, charsmax(filename), title, charsmax(title), status, 0, status, 0, status, charsmax(status))
if (!isSystem(a) && status[0] == 'r' && pause("ac", filename))
{
@ -308,7 +308,7 @@ unpausePlugins(id)
for (new a = 0; a < imax; ++a)
{
get_plugin(a, filename, 31, title, 31, status, 0, status, 0, status, 1)
get_plugin(a, filename, charsmax(filename), title, charsmax(title), status, 0, status, 0, status, charsmax(status))
if (!isSystem(a) && status[0] == 'p' && unpause("ac", filename))
{
@ -327,7 +327,7 @@ findPluginByFile(arg[32], &len)
for (new a = 0; a < inum; ++a)
{
get_plugin(a, name, 31, title, 31, status, 0, status, 0, status, 1)
get_plugin(a, name, charsmax(name), title, charsmax(title), status, 0, status, 0, status, charsmax(status))
if (equali(name, arg, len) && (
status[0] == 'r' || /*running*/
@ -335,7 +335,7 @@ findPluginByFile(arg[32], &len)
status[0] == 's' || /*stopped*/
status[0] == 'd' )) /*debug*/
{
len = copy(arg, 31, name)
len = copy(arg, charsmax(arg), name)
return a
}
}
@ -350,7 +350,7 @@ findPluginByTitle(name[], file[], len)
for (new a = 0; a < inum; ++a)
{
get_plugin(a, file, len, title, 31, status, 0, status, 0, status, 1)
get_plugin(a, file, len, title, charsmax(title), status, 0, status, 0, status, charsmax(status))
if (equali(title, name))
return a
@ -365,11 +365,11 @@ public cmdPlugin(id, level, cid)
return PLUGIN_HANDLED
new cmds[32]
read_argv(1, cmds, 31)
read_argv(1, cmds, charsmax(cmds))
if (equal(cmds, "add") && read_argc() > 2)
{
read_argv(2, cmds, 31)
read_argv(2, cmds, charsmax(cmds))
new file[2]
if ((g_system[g_systemNum] = findPluginByTitle(cmds, file, 0)) != -1)
@ -410,7 +410,7 @@ public cmdPlugin(id, level, cid)
}
else if (equal(cmds, "pause"))
{
new arg[32], a, len = read_argv(2, arg, 31)
new arg[32], a, len = read_argv(2, arg, charsmax(arg))
if (len && ((a = findPluginByFile(arg, len)) != -1) && !isSystem(a) && pause("ac", arg))
console_print(id, "%L %L", id, "PAUSE_PLUGIN_MATCH", arg, id, "PAUSED")
@ -419,7 +419,7 @@ public cmdPlugin(id, level, cid)
}
else if (equal(cmds, "enable"))
{
new arg[32], a, len = read_argv(2, arg, 31)
new arg[32], a, len = read_argv(2, arg, charsmax(arg))
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a))
{
@ -439,7 +439,7 @@ public cmdPlugin(id, level, cid)
}
else if (equal(cmds, "stop"))
{
new arg[32], a, len = read_argv(2, arg, 31)
new arg[32], a, len = read_argv(2, arg, charsmax(arg))
if (len && (a = findPluginByFile(arg, len)) != -1 && !isSystem(a) && pause("dc", arg))
{
@ -453,14 +453,14 @@ public cmdPlugin(id, level, cid)
{
new lName[32], lVersion[32], lAuthor[32], lFile[32], lStatus[32]
format(lName, 31, "%L", id, "NAME")
format(lVersion, 31, "%L", id, "VERSION")
format(lAuthor, 31, "%L", id, "AUTHOR")
format(lFile, 31, "%L", id, "FILE")
format(lStatus, 31, "%L", id, "STATUS")
format(lName, charsmax(lName), "%L", id, "NAME")
format(lVersion, charsmax(lVersion), "%L", id, "VERSION")
format(lAuthor, charsmax(lAuthor), "%L", id, "AUTHOR")
format(lFile, charsmax(lFile), "%L", id, "FILE")
format(lStatus, charsmax(lStatus), "%L", id, "STATUS")
new arg1[8], running = 0
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
new start = read_argv(2, arg1, charsmax(arg1)) ? str_to_num(arg1) : 1
if (--start < 0)
start = 0
@ -480,7 +480,7 @@ public cmdPlugin(id, level, cid)
for (new a = start; a < end; ++a)
{
get_plugin(a, plugin, 31, title, 31, version, 15, author, 31, status, 15)
get_plugin(a, plugin, charsmax(plugin), title, charsmax(title), version, charsmax(version), author, charsmax(authod), status, charsmax(status))
if (status[0] == 'r') ++running
console_print(id, " [%3d] %-18.17s %-8.7s %-17.16s %-16.15s %-9.8s", a + 1, title, version, author, plugin, status)
}
@ -521,12 +521,12 @@ saveSettings(filename[])
for (new a = 0; a < inum; ++a)
{
get_plugin(a, file, 31, title, 31, status, 0, status, 0, status, 1)
get_plugin(a, file, charsmax(file), title, charsmax(title), status, 0, status, 0, status, charsmax(status))
// "paused"
if (status[0] == 'p')
{
format(text, 255, "^"%s^" ;%s", title, file)
format(text, charsmax(text), "^"%s^" ;%s", title, file)
write_file(filename, text)
}
}
@ -541,9 +541,9 @@ loadSettings(filename[])
new name[256], file[32], i, pos = 0
while (read_file(filename, pos++, name, 255, i))
while (read_file(filename, pos++, name, charsmax(name), i))
{
if (name[0] != ';' && parse(name, name, 31) && (i = findPluginByTitle(name, file, 31) != -1))
if (name[0] != ';' && parse(name, name, charsmax(name)) && (i = findPluginByTitle(name, file, charsmax(file)) != -1))
pause("ac", file)
}

View File

@ -138,8 +138,8 @@ public plugin_init()
g_coloredMenus = colored_menus()
new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63)
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file)
get_configsdir(clcmds_ini_file, charsmax(clcmds_ini_file))
format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file)
if (LibraryExists("cstrike", LibType_Library))
@ -275,10 +275,10 @@ public actionBanMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, charsmax(name))
new userid2 = get_user_userid(player)
@ -294,7 +294,7 @@ public actionBanMenu(id, key)
else
{
new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",banTime);
formatex(tempTime,charsmax(tempTime),"%d",banTime);
for (new i = 1; i <= MaxClients; i++)
{
show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
@ -310,7 +310,7 @@ public actionBanMenu(id, key)
{
/* END OF MODIFICATIONS BY MISTAGEE */
new ipa[32]
get_user_ip(player, ipa, 31, 1)
get_user_ip(player, ipa, charsmax(ipa), 1)
server_cmd("addip %d %s;writeip", banTime, ipa)
if( g_tempBans )
@ -352,7 +352,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, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -362,38 +362,38 @@ displayBanMenu(id, pos)
for (new a = start; a < end; ++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) && i != id))
{
++b
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
len += format(menuBody[len], 511-len, "#. %s^n", name)
len += format(menuBody[len], charsmax(menuBody) - 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)
len += format(menuBody[len], charsmax(menuBody) - 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], charsmax(menuBody) - len, "%d. %s^n", ++b, name)
}
}
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
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])
{
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
}
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")
}
@ -442,7 +442,7 @@ public actionSlapMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name2[MAX_NAME_LENGTH]
get_user_name(player, name2, 31)
get_user_name(player, name2, charsmax(name2))
if (!is_user_alive(player))
{
@ -453,9 +453,9 @@ public actionSlapMenu(id, key)
new authid[32], authid2[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, charsmax(name))
new aSize = ArraySize(g_slapsettings);
if (aSize > 1 && g_menuOption[id] < aSize -1)
@ -496,7 +496,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, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -506,22 +506,22 @@ displaySlapMenu(id, pos)
for (new a = start; a < end; ++a)
{
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
get_user_name(i, name, charsmax(name))
if (g_cstrike)
{
if (cs_get_user_team(i) == CS_TEAM_T)
{
copy(team, 3, "TE")
copy(team, charsmax(team), "TE")
}
else if (cs_get_user_team(i) == CS_TEAM_CT)
{
copy(team, 3, "CT")
copy(team, charsmax(team), "CT")
} else {
get_user_team(i, team, 3)
get_user_team(i, team, charsmax(team))
}
} else {
get_user_team(i, team, 3)
get_user_team(i, team, charsmax(team))
}
if (!is_user_alive(i) || (access(i, ADMIN_IMMUNITY) && i != id))
@ -529,31 +529,31 @@ displaySlapMenu(id, pos)
++b
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
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
len += format(menuBody[len], charsmax(menuBody) - 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)
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
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] == ArraySize(g_slapsettings) - 1)
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY")
len += format(menuBody[len], charsmax(menuBody) - len, "^n8. %L^n", id, "SLAY")
else
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])
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
}
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")
}
@ -592,10 +592,10 @@ public actionKickMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
get_user_name(player, name2, 31)
get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, charsmax(name))
get_user_name(player, name2, charsmax(name2))
new userid2 = get_user_userid(player)
@ -630,7 +630,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, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
new end = start + 8
new keys = MENU_KEY_0
@ -640,33 +640,33 @@ displayKickMenu(id, pos)
for (new a = start; a < end; ++a)
{
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
get_user_name(i, name, charsmax(name))
if (access(i, ADMIN_IMMUNITY) && i != id)
{
++b
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
len += format(menuBody[len], 511-len, "#. %s^n", name)
len += format(menuBody[len], charsmax(menuBody) - 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)
len += format(menuBody[len], charsmax(menuBody) - 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], charsmax(menuBody) - len, "%d. %s^n", ++b, name)
}
}
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
}
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")
}
@ -729,10 +729,10 @@ public actionTeamMenu(id, key)
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_name(player, name2, 31)
get_user_authid(id, authid, 31)
get_user_authid(player, authid2, 31)
get_user_name(id, name, 31)
get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, charsmax(name))
// This modulo math just aligns the option to the CsTeams-corresponding number
new destTeamSlot = (g_menuOption[id] % 3)
@ -741,7 +741,6 @@ public actionTeamMenu(id, key)
show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[destTeamSlot]);
if( destTeamSlot == 2 )
{
if ( g_fakemeta )
@ -842,7 +841,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, 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 keys = MENU_KEY_0|MENU_KEY_8
@ -852,7 +851,7 @@ displayTeamMenu(id, pos)
for (new a = start; a < end; ++a)
{
i = g_menuPlayers[id][a]
get_user_name(i, name, 31)
get_user_name(i, name, charsmax(name))
if (g_cstrike)
{
@ -860,21 +859,21 @@ displayTeamMenu(id, pos)
if (iteam == 1)
{
copy(team, 3, "TE")
copy(team, charsmax(team), "TE")
}
else if (iteam == 2)
{
copy(team, 3, "CT")
copy(team, charsmax(team), "CT")
}
else if (iteam == 3)
{
copy(team, 3, "SPE");
copy(team, charsmax(team), "SPE");
// iteam = 6; // oO WTF is this ?? fixed g_CSTeamiNumbers.
} else {
iteam = get_user_team(i, team, 3)
iteam = get_user_team(i, team, charsmax(team))
}
} else {
iteam = get_user_team(i, team, 3)
iteam = get_user_team(i, team, charsmax(team))
}
if( !iteam )
{
@ -886,28 +885,28 @@ displayTeamMenu(id, pos)
++b
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
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team)
len += format(menuBody[len], charsmax(menuBody) - 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)
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
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_CSTeamNames[g_menuOption[id] % 3])
len += format(menuBody[len], charsmax(menuBody) - len, "^n8. %L^n", id, "TRANSF_TO", g_CSTeamNames[g_menuOption[id] % 3])
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
}
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")
}
@ -948,8 +947,8 @@ public actionClcmdMenu(id, key)
new command[512], authid[32], name[MAX_NAME_LENGTH], userid[32]
copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player, authid, 31)
get_user_name(player, name, 31)
get_user_authid(player, authid, charsmax(authid))
get_user_name(player, name, charsmax(name))
num_to_str(get_user_userid(player), userid, 31)
replace(command, charsmax(command), "%userid%", userid)
@ -990,7 +989,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, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8
@ -1000,38 +999,38 @@ displayClcmdMenu(id, pos)
for (new a = start; a < end; ++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) && i != id))
{
++b
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
len += format(menuBody[len], 511-len, "#. %s^n", name)
len += format(menuBody[len], charsmax(menuBody) - 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)
len += format(menuBody[len], charsmax(menuBody) - 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], charsmax(menuBody) - len, "%d. %s^n", ++b, name)
}
}
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
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])
{
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
}
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")
}
@ -1062,13 +1061,13 @@ load_settings(szFilename[])
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, charsmax(text), 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], 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
}

View File

@ -152,11 +152,11 @@ stock DisplayPluginMenu(id,const MenuText[], const Handler[], const Command[], c
callfunc_push_int(i); // push the plid
if ((tally=callfunc_end())>0)
{
get_plugin(i,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,PluginState,sizeof(PluginState)-1);
get_plugin(i,"",0,PluginName,charsmax(PluginName),"",0,"",0,PluginState,charsmax(PluginState));
// Command syntax is: "# Function", # being plugin ID, function being public function to call.
formatex(PluginCmd,sizeof(PluginCmd)-1,"%d %s",i,Command);
formatex(MenuText,sizeof(MenuText)-1,"%s - %d",PluginName,tally);
formatex(PluginCmd,charsmax(PluginCmd),"%d %s",i,Command);
formatex(MenuText,charsmax(MenuText),"%s - %d",PluginName,tally);
// If the plugin is running, add this as an activated menu item.
if (strcmp(PluginState,"running",true)==0 ||
strcmp(PluginState,"debug", true)==0)
@ -192,7 +192,7 @@ stock bool:GetPlidForValidPlugins(id, &plid)
{
// Yes, we were provided a plugin.
new TargetPlugin[64];
read_argv(1,TargetPlugin,sizeof(TargetPlugin)-1);
read_argv(1,TargetPlugin,charsmax(TargetPlugin));
new BufferName[64];
new BufferFile[64];
@ -202,7 +202,7 @@ stock bool:GetPlidForValidPlugins(id, &plid)
i<max;
i++)
{
get_plugin(i,BufferFile,sizeof(BufferFile)-1,BufferName,sizeof(BufferName)-1,"",0,"",0,BufferState,sizeof(BufferState)-1);
get_plugin(i,BufferFile,charsmax(BufferFile),BufferName,charsmax(BufferName),"",0,"",0,BufferState,charsmax(BufferState));
if (strcmp(BufferFile,TargetPlugin,true) != 0||
strcmp(BufferName,TargetPlugin,true) != 0)
@ -360,19 +360,19 @@ public PluginMenuSelection(id, menu, item)
// Note the menu is destroyed BEFORE the command
// gets executed.
// The command retrieved is in the format: "PLID Command"
menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,Dummy,0,Dummy[0]);
menu_item_getinfo(menu, item, Dummy[0], Command, charsmax(Command),Dummy,0,Dummy[0]);
new plid=str_to_num(Command);
new Function[32];
for (new i=0;i<sizeof(Command)-1;i++)
for (new i=0;i<charsmax(Command);i++)
{
if (Command[i]==' ')
{
// we're at the break. move up one space.
i++;
copy(Function,sizeof(Function)-1,Command[i]);
copy(Function,charsmax(Function),Command[i]);
break;
}
}
@ -411,7 +411,7 @@ public CommandChangeCvar(id)
new Args[256];
read_args(Args,sizeof(Args)-1);
read_args(Args,charsmax(Args));
remove_quotes(Args);
@ -434,8 +434,8 @@ public CommandChangeCvar(id)
new Name[MAX_NAME_LENGTH];
new AuthID[40];
get_user_name(id,Name,sizeof(Name)-1);
get_user_authid(id,AuthID,sizeof(AuthID)-1);
get_user_name(id,Name,charsmax(Name));
get_user_authid(id,AuthID,charsmax(AuthID));
log_amx("Cmd: ^"%s<%d><%s><>^" set cvar (name ^"%s^") (value ^"%s^")", Name, get_user_userid(id), AuthID, CurrentCvarName[id], Args);
@ -510,7 +510,7 @@ public CvarMenuSelection(id, menu, item)
new Command[32];
new Dummy[1];
// pcvar pointer is stored in command, extract the name of the cvar from the name field.
menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,CvarName,sizeof(CvarName)-1,Dummy[0]);
menu_item_getinfo(menu, item, Dummy[0], Command, charsmax(Command),CvarName,charsmax(CvarName),Dummy[0]);
CurrentCvar[id]=str_to_num(Command);
@ -522,7 +522,7 @@ public CvarMenuSelection(id, menu, item)
// TODO: ML this
// Scan up "CvarName" and stop at the first space
for (new i=0;i<sizeof(CvarName)-1;i++)
for (new i=0;i<charsmax(CvarName);i++)
{
if (CvarName[i]==' ')
{
@ -530,7 +530,7 @@ public CvarMenuSelection(id, menu, item)
break;
}
}
copy(CurrentCvarName[id],sizeof(CurrentCvarName[])-1,CvarName);
copy(CurrentCvarName[id],charsmax(CurrentCvarName[]),CvarName);
client_print(id,print_chat,"[AMXX] Type in the new value for %s, or !cancel to cancel.",CvarName);
client_cmd(id,"messagemode amx_changecvar");
@ -551,9 +551,9 @@ public DisplayCvarMenu(id, plid, page)
{
new PluginName[32];
new MenuTitle[64];
get_plugin(plid,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,"",0);
get_plugin(plid,"",0,PluginName,charsmax(PluginName),"",0,"",0,"",0);
formatex(MenuTitle,sizeof(MenuTitle)-1,"%s Cvars:",PluginName);
formatex(MenuTitle,charsmax(MenuTitle),"%s Cvars:",PluginName);
new Menu=menu_create(MenuTitle,"CvarMenuSelection");
@ -567,17 +567,17 @@ public DisplayCvarMenu(id, plid, page)
i<max;
i++)
{
get_plugins_cvar(i, Cvar, sizeof(Cvar),_, CvarPlid, CvarPtr);
get_plugins_cvar(i, Cvar, charsmax(Cvar),_, CvarPlid, CvarPtr);
if (CvarPlid==plid)
{
if (CanIModifyCvar(id,Cvar))
{
get_pcvar_string(CvarPtr,CvarData,sizeof(CvarData)-1);
formatex(CvarText,sizeof(CvarText)-1,"%s - %s",Cvar,CvarData);
get_pcvar_string(CvarPtr,CvarData,charsmax(CvarData));
formatex(CvarText,charsmax(CvarText),"%s - %s",Cvar,CvarData);
// Now store the pcvar data in Cvar
num_to_str(CvarPtr,Cvar,sizeof(Cvar)-1);
num_to_str(CvarPtr,Cvar,charsmax(Cvar));
menu_additem(Menu,CvarText,Cvar,_,EnabledCallback);
}
else
@ -659,7 +659,7 @@ public SpecificCommandHandler(id,menu,item)
new Dummy[1];
if (item==0) // "With params"
{
menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], sizeof(CurrentCommand[])-1,"",0,Dummy[0]);
menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], charsmax(CurrentCommand[]),"",0,Dummy[0]);
if (CurrentCommand[id][0]==0) // This should never happen, but just incase..
{
client_print(id,print_chat,"[AMXX] There was an error extracting the command name.");
@ -676,7 +676,7 @@ public SpecificCommandHandler(id,menu,item)
}
else if (item==1) // "No params"
{
menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], sizeof(CurrentCommand[])-1,"",0,Dummy[0]);
menu_item_getinfo(menu, item, Dummy[0], CurrentCommand[id], charsmax(CurrentCommand[]),"",0,Dummy[0]);
if (CurrentCommand[id][0]==0) // This should never happen, but just incase..
{
client_print(id,print_chat,"[AMXX] There was an error extracting the command name.");
@ -721,11 +721,11 @@ stock DisplaySpecificCommand(id,cid)
new CommandAccess;
new Menu;
get_concmd(cid,CommandName,sizeof(CommandName)-1,CommandAccess, CommandDesc,sizeof(CommandDesc)-1, -1, -1);
get_concmd(cid,CommandName,charsmax(CommandName),CommandAccess, CommandDesc, charsmax(CommandDesc), -1, -1);
if (CommandDesc[0]!='^0')
{
formatex(CommandTitle,sizeof(CommandTitle)-1,"%s^n%s",CommandName,CommandDesc);
formatex(CommandTitle,charsmax(CommandTitle),"%s^n%s",CommandName,CommandDesc);
Menu=menu_create(CommandTitle,"SpecificCommandHandler");
}
else
@ -754,7 +754,7 @@ public CommandExecuteCommand(id)
new Args[256];
read_args(Args,sizeof(Args)-1);
read_args(Args,charsmax(Args));
remove_quotes(Args);
@ -836,7 +836,7 @@ public CommandMenuSelection(id, menu, item)
new Command[32];
new Dummy[1];
// pcvar pointer is stored in command, extract the name of the cvar from the name field.
menu_item_getinfo(menu, item, Dummy[0], Command, sizeof(Command)-1,"",0,Dummy[0]);
menu_item_getinfo(menu, item, Dummy[0], Command, charsmax(Command),"",0,Dummy[0]);
menu_destroy(menu);
@ -873,9 +873,9 @@ public DisplayCmdMenu(id, plid, page)
{
new PluginName[32];
new MenuTitle[64];
get_plugin(plid,"",0,PluginName,sizeof(PluginName)-1,"",0,"",0,"",0);
get_plugin(plid,"",0,PluginName,charsmax(PluginName),"",0,"",0,"",0);
formatex(MenuTitle,sizeof(MenuTitle)-1,"%s Commands:",PluginName);
formatex(MenuTitle,charsmax(MenuTitle),"%s Commands:",PluginName);
new Menu=menu_create(MenuTitle,"CommandMenuSelection");
@ -892,7 +892,7 @@ public DisplayCmdMenu(id, plid, page)
{
if (get_concmd_plid(i,-1,-1)==plid)
{
get_concmd(i,Command,sizeof(Command)-1,CommandAccess, "",0, -1, -1);
get_concmd(i,Command,charsmax(Command),CommandAccess, "",0, -1, -1);
if (IsDisplayableCmd(Command))
{
@ -901,7 +901,7 @@ public DisplayCmdMenu(id, plid, page)
CommandAccess==ADMIN_USER ||
CommandAccess==ADMIN_ALL)
{
num_to_str(i,CidString,sizeof(CidString)-1);
num_to_str(i,CidString,charsmax(CidString));
menu_additem(Menu,Command,CidString,0,EnabledCallback);
}
else

View File

@ -86,8 +86,8 @@ public msgInit()
new hostname[64]
get_cvar_string("hostname", hostname, 63)
replace(g_scrollMsg, SCROLLMSG_SIZE-1, "%hostname%", hostname)
get_cvar_string("hostname", hostname, charsmax(hostname))
replace(g_scrollMsg, charsmax(g_scrollMsg), "%hostname%", hostname)
g_Length = strlen(g_scrollMsg)
@ -98,13 +98,13 @@ public msgInit()
public setMessage()
{
remove_task(123) /* remove current messaging */
read_argv(1, g_scrollMsg, SCROLLMSG_SIZE-1)
read_argv(1, g_scrollMsg, charsmax(g_scrollMsg))
g_Length = strlen(g_scrollMsg)
new mytime[32]
read_argv(2, mytime, 31)
read_argv(2, mytime, charsmax(mytime))
g_Frequency = str_to_num(mytime)

View File

@ -59,8 +59,8 @@ public plugin_init()
register_plugin("Stats Configuration", AMXX_VERSION_STR, "AMXX Dev Team")
register_menucmd(register_menuid("Stats Configuration"), 1023, "actionCfgMenu")
get_configsdir(g_fileToSave, 63)
format(g_fileToSave, 63, "%s/stats.ini", g_fileToSave)
get_configsdir(g_fileToSave, charsmax(g_fileToSave))
format(g_fileToSave, charsmax(g_fileToSave), "%s/stats.ini", g_fileToSave)
loadSettings(g_fileToSave)
g_coloredMenus = colored_menus()
}
@ -71,7 +71,7 @@ public cmdCfg(id, level, cid)
return PLUGIN_HANDLED
new cmds[32]
read_argv(1, cmds, 31)
read_argv(1, cmds, charsmax(cmds))
new option = equali(cmds, "on") ? 1 : 0
@ -81,7 +81,7 @@ public cmdCfg(id, level, cid)
if (read_argc() > 2 && option)
{
new var[32], enabled = 0
read_argv(2, var, 31)
read_argv(2, var, charsmax(var))
for (new a = 0; a < g_menuDataNum; ++a)
{
@ -128,7 +128,7 @@ public cmdCfg(id, level, cid)
else if (equali(cmds, "list"))
{
new arg1[8]
new start = read_argv(2, arg1, 7) ? str_to_num(arg1) : 1
new start = read_argv(2, arg1, charsmax(arg1)) ? str_to_num(arg1) : 1
if (--start < 0) start = 0
@ -142,9 +142,9 @@ public cmdCfg(id, level, cid)
new lName[16], lVariable[16], lStatus[16]
format(lName, 15, "%L", id, "NAME")
format(lVariable, 15, "%L", id, "VARIABLE")
format(lStatus, 15, "%L", id, "STATUS")
format(lName, charsmax(lName), "%L", id, "NAME")
format(lVariable, charsmax(lVariable), "%L", id, "VARIABLE")
format(lStatus, charsmax(lStatus), "%L", id, "STATUS")
console_print(id, "^n----- %L: -----", id, "STATS_CONF")
console_print(id, " %-29.28s %-24.23s %-9.8s", lName, lVariable, lStatus)
@ -154,7 +154,7 @@ public cmdCfg(id, level, cid)
for (new a = start; a < end; ++a)
{
format(lOnOff, 15, "%L", id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
format(lOnOff, charsmax(lOnOff), "%L", id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
console_print(id, "%3d: %-29.28s %-24.23s %-9.8s", a + 1, g_menuData[a], g_menuDataVar[a], lOnOff)
}
}
@ -170,8 +170,8 @@ public cmdCfg(id, level, cid)
{
if (g_menuDataNum < MAX_MENU_DATA)
{
read_argv(2, g_menuData[g_menuDataNum], 31)
read_argv(3, g_menuDataVar[g_menuDataNum], 31)
read_argv(2, g_menuData[g_menuDataNum], charsmax(g_menuData[]))
read_argv(3, g_menuDataVar[g_menuDataNum], charsmax(g_menuDataVar[]))
g_menuDataId[g_menuDataNum] = get_xvar_id(g_menuDataVar[g_menuDataNum])
++g_menuDataNum
}
@ -209,7 +209,7 @@ displayCfgMenu(id, pos)
if (start >= g_menuDataNum)
start = pos = g_menuPosition[id] = 0
new len = format(menu_body, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "STATS_CONF", pos + 1, ((g_menuDataNum / 7)+((g_menuDataNum % 7) ? 1 : 0)))
new len = format(menu_body, charsmax(menu_body), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "STATS_CONF", pos + 1, ((g_menuDataNum / 7)+((g_menuDataNum % 7) ? 1 : 0)))
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
if (end > g_menuDataNum)
@ -221,24 +221,24 @@ displayCfgMenu(id, pos)
/* Backwards compatibility hack - if the name starts with ST_, assume it is translation safe! */
if (equal(g_menuData[a], "ST_", 3))
{
len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %L\y\R%L^n\w" : "%d. %L %L^n", ++k, id, g_menuData[a], id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
len += format(menu_body[len], charsmax(menu_body) -len, g_coloredMenus ? "%d. %L\y\R%L^n\w" : "%d. %L %L^n", ++k, id, g_menuData[a], id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
} else {
len += format(menu_body[len], 511-len, g_coloredMenus ? "%d. %s\y\R%L^n\w" : "%d. %s %L^n", ++k, g_menuData[a], id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
len += format(menu_body[len], charsmax(menu_body) -len, g_coloredMenus ? "%d. %s\y\R%L^n\w" : "%d. %s %L^n", ++k, g_menuData[a], id, get_xvar_num(g_menuDataId[a]) ? "ON" : "OFF")
}
}
if (g_menuDataNum == 0)
len += format(menu_body[len], 511-len, g_coloredMenus ? "\d%L\w" : "%L", id, "NO_STATS")
len += format(menu_body[len], charsmax(menu_body) -len, g_coloredMenus ? "\d%L\w" : "%L", id, "NO_STATS")
len += format(menu_body[len], 511-len, g_coloredMenus ? "^n8. %L\y\R%s^n\w" : "^n8. %L %s^n", id, "SAVE_CONF", g_modified ? "*" : "")
len += format(menu_body[len], charsmax(menu_body) -len, g_coloredMenus ? "^n8. %L\y\R%s^n\w" : "^n8. %L %s^n", id, "SAVE_CONF", g_modified ? "*" : "")
if (end != g_menuDataNum)
{
format(menu_body[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
format(menu_body[len], charsmax(menu_body) -len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9
}
else
format(menu_body[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
format(menu_body[len], charsmax(menu_body) -len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menu_body, -1, "Stats Configuration")
}
@ -290,11 +290,11 @@ saveSettings(filename[])
{
if (equal(g_menuData[a], "ST_", 3))
{
format(text, 255, "%-24.23s ;%L", g_menuDataVar[a], LANG_SERVER, g_menuData[a])
format(text, charsmax(text), "%-24.23s ;%L", g_menuDataVar[a], LANG_SERVER, g_menuData[a])
}
else
{
format(text, 255, "%-24.23s ;%s", g_menuDataVar[a], g_menuData[a])
format(text, charsmax(text), "%-24.23s ;%s", g_menuDataVar[a], g_menuData[a])
}
write_file(filename, text)
}
@ -311,11 +311,11 @@ loadSettings(filename[])
new text[256], name[32]
new len, pos = 0, xid
while (read_file(filename, pos++, text, 255, len))
while (read_file(filename, pos++, text, charsmax(text), len))
{
if (text[0] == ';') continue // line is a comment
parse(text, name, 31)
parse(text, name, charsmax(name))
if ((xid = get_xvar_id(name)) != -1)
set_xvar_num(xid, 1)