diff --git a/plugins/admin.sma b/plugins/admin.sma index 4a4f2e25..7bfb2362 100755 --- a/plugins/admin.sma +++ b/plugins/admin.sma @@ -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 // - 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<%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]) { diff --git a/plugins/adminvote.sma b/plugins/adminvote.sma index 4b0069ab..11633b5b 100755 --- a/plugins/adminvote.sma +++ b/plugins/adminvote.sma @@ -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<<%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)<%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<<%s><>^" vote %s (target ^"%s^")", name, get_user_userid(id), authid, voteban ? "ban" : "kick", arg) new msg[256]; diff --git a/plugins/cmdmenu.sma b/plugins/cmdmenu.sma index 6e22803c..1878bc7f 100755 --- a/plugins/cmdmenu.sma +++ b/plugins/cmdmenu.sma @@ -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< 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< 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_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< 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<= 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<= 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<= 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<= 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< 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) } diff --git a/plugins/plmenu.sma b/plugins/plmenu.sma index 0839b663..af3ec272 100755 --- a/plugins/plmenu.sma +++ b/plugins/plmenu.sma @@ -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< 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<= 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<<%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_CSTeamNames[destTeamSlot]) show_activity_key("ADMIN_TRANSF_1", "ADMIN_TRANSF_2", name, name2, g_CSTeamNames[destTeamSlot]); - if( destTeamSlot == 2 ) { @@ -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<= 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< 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 } diff --git a/plugins/pluginmenu.sma b/plugins/pluginmenu.sma index 8f99bf3a..8ae46965 100644 --- a/plugins/pluginmenu.sma +++ b/plugins/pluginmenu.sma @@ -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<%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 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)