Merge pull request #141 from Freeman-AM/master

Removal of many hardcoded contents (part 1)
This commit is contained in:
Vincent Herbet 2014-10-13 10:18:32 +02:00
commit 3894e53cf6
18 changed files with 612 additions and 612 deletions

View File

@ -539,7 +539,7 @@ public client_death(killer, victim, wpnindex, hitplace, TK)
param[0] = killer param[0] = killer
param[1] = g_multiKills[killer][0] param[1] = g_multiKills[killer][0]
set_task(4.0 + float(param[1]), "checkKills", killer, param, 2) set_task(4.0 + float(param[1]), "checkKills", killer, param, sizeof(param))
} }
} }

View File

@ -343,7 +343,7 @@ setWeapon(a, action)
findMenuId(name[]) findMenuId(name[])
{ {
for (new i = 0; i < 7 ; ++i) for (new i = 0; i < sizeof(g_menusNames) ; ++i)
if (equali(name, g_menusNames[i])) if (equali(name, g_menusNames[i]))
return i return i
@ -376,7 +376,7 @@ switchCommand(id, action)
for (new b = 2; b < c; ++b) for (new b = 2; b < c; ++b)
{ {
read_argv(b, arg, 31) read_argv(b, arg, charsmax(arg))
if ((a = findMenuId(arg)) != -1) if ((a = findMenuId(arg)) != -1)
{ {
@ -418,7 +418,7 @@ public cmdRest(id, level, cid)
new cmd[8] new cmd[8]
read_argv(1, cmd, 7) read_argv(1, cmd, charsmax(cmd))
if (equali("on", cmd)) if (equali("on", cmd))
switchCommand(id, 1) switchCommand(id, 1)
@ -427,7 +427,7 @@ public cmdRest(id, level, cid)
else if (equali("list", cmd)) else if (equali("list", cmd))
{ {
new arg1[8] 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) if (--start < 0)
start = 0 start = 0
@ -442,9 +442,9 @@ public cmdRest(id, level, cid)
new lName[16], lValue[16], lStatus[16], lOnOff[16] new lName[16], lValue[16], lStatus[16], lOnOff[16]
format(lName, 15, "%L", id, "NAME") format(lName, charsmax(lName), "%L", id, "NAME")
format(lValue, 15, "%L", id, "VALUE") format(lValue, charsmax(lValue), "%L", id, "VALUE")
format(lStatus, 15, "%L", id, "STATUS") format(lStatus, charsmax(lStatus), "%L", id, "STATUS")
console_print(id, "^n----- %L: -----", id, "WEAP_RES") console_print(id, "^n----- %L: -----", id, "WEAP_RES")
console_print(id, " %-32.31s %-10.9s %-9.8s", lName, lValue, lStatus) console_print(id, " %-32.31s %-10.9s %-9.8s", lName, lValue, lStatus)
@ -453,7 +453,7 @@ public cmdRest(id, level, cid)
{ {
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
format(lOnOff, 15, "%L", id, positionBlocked(a) ? "ON" : "OFF") format(lOnOff, charsmax(lOnOff), "%L", id, positionBlocked(a) ? "ON" : "OFF")
console_print(id, "%3d: %-32.31s %-10.9s %-9.8s", a + 1, g_WeaponNames[a], g_Aliases[a], lOnOff) console_print(id, "%3d: %-32.31s %-10.9s %-9.8s", a + 1, g_WeaponNames[a], g_Aliases[a], lOnOff)
} }
} }
@ -477,15 +477,15 @@ public cmdRest(id, level, cid)
} }
else if (equali("load", cmd)) else if (equali("load", cmd))
{ {
setc(g_blockPos, 112, 0) // Clear current settings setc(g_blockPos, sizeof(g_blockPos), 0) // Clear current settings
new arg1[64] new arg1[64]
if (read_argv(2, arg1, 63)) if (read_argv(2, arg1, charsmax(arg1)))
{ {
new configsdir[32] new configsdir[32]
get_configsdir(configsdir, 31) get_configsdir(configsdir, charsmax(configsdir))
format(arg1, 63, "%s/%s", configsdir, arg1) format(arg1, charsmax(arg1), "%s/%s", configsdir, arg1)
} }
if (loadSettings(arg1)) if (loadSettings(arg1))
@ -522,7 +522,7 @@ displayMenu(id, pos)
if (start >= MAXMENUPOS) if (start >= MAXMENUPOS)
start = pos = g_Position[id] = 0 start = pos = g_Position[id] = 0
new len = format(menubody, 511, "\y%L\R%d/5^n^n\w", id, "REST_WEAP", pos + 1) new len = format(menubody, charsmax(menubody), "\y%L\R%d/5^n^n\w", id, "REST_WEAP", pos + 1)
new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0 new end = start + 7, keys = MENU_KEY_0|MENU_KEY_8, k = 0
if (end > MAXMENUPOS) if (end > MAXMENUPOS)
@ -531,18 +531,18 @@ displayMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
keys |= (1<<k) keys |= (1<<k)
len += format(menubody[len], 511 - len, g_MenuItem[a], ++k, g_WeaponNames[a], id, positionBlocked(a) ? "ON" : "OFF") len += format(menubody[len], charsmax(menubody) - len, g_MenuItem[a], ++k, g_WeaponNames[a], id, positionBlocked(a) ? "ON" : "OFF")
} }
len += format(menubody[len], 511 - len, "^n8. %L \y\R%s^n\w", id, "SAVE_SET", g_Modified ? "*" : "") len += format(menubody[len], charsmax(menubody) - len, "^n8. %L \y\R%s^n\w", id, "SAVE_SET", g_Modified ? "*" : "")
if (end != MAXMENUPOS) if (end != MAXMENUPOS)
{ {
format(menubody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menubody[len], charsmax(menubody) - len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menubody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menubody[len], charsmax(menubody) - len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menubody, -1, "Restrict Weapons") show_menu(id, keys, menubody, -1, "Restrict Weapons")
} }
@ -624,7 +624,7 @@ public client_command(id)
{ {
new arg[13] new arg[13]
if (read_argv(0, arg, 12) > 11) /* Longest buy command has 11 chars so if command is longer then don't care */ if (read_argv(0, arg, charsmax(arg)) > 11) /* Longest buy command has 11 chars so if command is longer then don't care */
{ {
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
@ -638,7 +638,7 @@ public client_command(id)
{ {
new key[12], num new key[12], num
read_argv(1, key, 11) read_argv(1, key, charsmax(key))
num = str_to_num(key) - 1 num = str_to_num(key) - 1
return checkRest(id, g_InBuyMenu[id], num) return checkRest(id, g_InBuyMenu[id], num)
@ -732,7 +732,7 @@ saveSettings(filename[])
{ {
if (positionBlocked(a)) if (positionBlocked(a))
{ {
format(text, 63, "%-16.15s ; %s", g_Aliases[a], g_WeaponNames[a]) format(text, charsmax(text), "%-16.15s ; %s", g_Aliases[a], g_WeaponNames[a])
write_file(filename, text) write_file(filename, text)
} }
} }
@ -748,15 +748,15 @@ loadSettings(filename[])
new text[16] new text[16]
new a, pos = 0 new a, pos = 0
format(g_szEquipAmmoRestr, 9, "000000000") format(g_szEquipAmmoRestr, charsmax(g_szEquipAmmoRestr), "000000000")
format(g_szWeapRestr, 26, "00000000000000000000000000") format(g_szWeapRestr, charsmax(g_szWeapRestr), "00000000000000000000000000")
while (read_file(filename, pos++, text, 15, a)) while (read_file(filename, pos++, text, charsmax(text), a))
{ {
if (text[0] == ';' || !a) if (text[0] == ';' || !a)
continue // line is a comment continue // line is a comment
parse(text, text, 15) parse(text, text, charsmax(text))
if ((a = findAliasId(text)) != -1) if ((a = findAliasId(text)) != -1)
{ {
@ -785,7 +785,7 @@ public fn_setautobuy(id)
for (new i = 1; i < argCount; i++) // Start at parameter 1; parameter 0 is just "cl_setautobuy" for (new i = 1; i < argCount; i++) // Start at parameter 1; parameter 0 is just "cl_setautobuy"
{ {
read_argv(i, arg, 127) read_argv(i, arg, charsmax(arg))
// Add this parameter to user's autobuy prefs // Add this parameter to user's autobuy prefs
autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg) autobuyLen += format(g_Autobuy[id][autobuyLen], AUTOBUYLENGTH - autobuyLen, "%s", arg)
@ -857,7 +857,7 @@ public HookEvent_ShowMenu(id)
{ {
new menustring[24] new menustring[24]
read_data(4, menustring, 23) read_data(4, menustring, charsmax(menustring))
/* Early breakouts */ /* Early breakouts */
new curidx new curidx
@ -898,7 +898,7 @@ public HookEvent_ShowMenu(id)
return return
} }
for (new i=0; i<6; i++) for (new i=0; i<sizeof(g_menuStrings); i++)
{ {
if (equali(menustring[curidx], g_menuStrings[i])) if (equali(menustring[curidx], g_menuStrings[i]))
{ {
@ -950,13 +950,13 @@ public plugin_init()
register_event("ShowMenu", "HookEvent_ShowMenu", "b") register_event("ShowMenu", "HookEvent_ShowMenu", "b")
new configsDir[64]; new configsDir[64];
get_configsdir(configsDir, 63); get_configsdir(configsDir, charsmax(configsDir));
#if defined MAPSETTINGS #if defined MAPSETTINGS
new mapname[32] new mapname[32]
get_mapname(mapname, 31) get_mapname(mapname, charsmax(mapname))
format(g_saveFile, 63, "%s/weaprest_%s.ini", configsDir, mapname) format(g_saveFile, charsmax(g_saveFile), "%s/weaprest_%s.ini", configsDir, mapname)
#else #else
format(g_saveFile, 63, "%s/weaprest.ini", configsDir) format(g_saveFile, charsmax(g_saveFile), "%s/weaprest.ini", configsDir)
#endif #endif
loadSettings(g_saveFile) loadSettings(g_saveFile)
} }

View File

@ -41,15 +41,15 @@ public client_disconnect(id)
new iUserid = get_user_userid(id) new iUserid = get_user_userid(id)
new _max = xmod_get_maxweapons() new _max = xmod_get_maxweapons()
get_user_team(id, szTeam, 15) get_user_team(id, szTeam, charsmax(szTeam))
get_user_name(id, szName, 31) get_user_name(id, szName, charsmax(szName))
get_user_authid(id, szAuthid, 31) get_user_authid(id, szAuthid, charsmax(szAuthid))
for (new i = 1 ; i < _max ; ++i) for (new i = 1 ; i < _max ; ++i)
{ {
if (get_user_wstats(id, i, iStats, iHits)) if (get_user_wstats(id, i, iStats, iHits))
{ {
xmod_get_wpnname(i, szWeapon, 23) xmod_get_wpnname(i, szWeapon, charsmax(szWeapon))
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
szName, iUserid, szAuthid, szTeam, szWeapon, iStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1]) szName, iUserid, szAuthid, szTeam, szWeapon, iStats[4], iStats[5], iStats[0], iStats[2], iStats[3], iStats[6], iStats[1])

View File

@ -607,7 +607,7 @@ add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1])
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName) iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName)
for (new i = 1; i < 8; i++) for (new i = 1; i < sizeof(izBody); i++)
{ {
if (!izBody[i]) if (!izBody[i])
continue continue
@ -640,7 +640,7 @@ format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
if (izStats[STATS_HITS]) if (izStats[STATS_HITS])
{ {
for (new i = 1; i < 8; i++) for (new i = 1; i < sizeof(izBody); i++)
{ {
if (!izBody[i]) if (!izBody[i])
continue continue
@ -680,7 +680,7 @@ format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
if (izStats[STATS_HITS]) if (izStats[STATS_HITS])
{ {
for (new i = 1; i < 8; i++) for (new i = 1; i < sizeof(izBody); i++)
{ {
if (!izBody[i]) if (!izBody[i])
continue continue
@ -757,7 +757,7 @@ format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
new L_BODY_PART[8][32] new L_BODY_PART[8][32]
for (new i = 1; i < 8; i++) for (new i = 1; i < sizeof(L_BODY_PART); i++)
{ {
formatex(L_BODY_PART[i], charsmax(L_BODY_PART[]), "%L", id, BODY_PART[i]) formatex(L_BODY_PART[i], charsmax(L_BODY_PART[]), "%L", id, BODY_PART[i])
} }
@ -1292,14 +1292,14 @@ public eventStartRound()
{ {
g_izTeamEventScore[iTeam] = 0 g_izTeamEventScore[iTeam] = 0
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(g_izTeamGameStats[]); i++)
g_izTeamGameStats[iTeam][i] = 0 g_izTeamGameStats[iTeam][i] = 0
} }
// Clear game stats, incl '0' that is sum of all users. // Clear game stats, incl '0' that is sum of all users.
for (id = 0; id <= MaxClients; id++) for (id = 0; id <= MaxClients; id++)
{ {
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(g_izUserGameStats[]); i++)
g_izUserGameStats[id][i] = 0 g_izUserGameStats[id][i] = 0
} }
} }
@ -1310,7 +1310,7 @@ public eventStartRound()
{ {
g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam] g_izTeamScore[iTeam] = g_izTeamEventScore[iTeam]
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(g_izTeamRndStats[]); i++)
g_izTeamRndStats[iTeam][i] = 0 g_izTeamRndStats[iTeam][i] = 0
} }
@ -1319,7 +1319,7 @@ public eventStartRound()
{ {
g_izUserRndName[id][0] = 0 g_izUserRndName[id][0] = 0
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(g_izUserRndStats[]); i++)
g_izUserRndStats[id][i] = 0 g_izUserRndStats[id][i] = 0
g_fzShowUserStatsTime[id] = 0.0 g_fzShowUserStatsTime[id] = 0.0
@ -1347,7 +1347,7 @@ public eventSpawn(id)
args[0] = id args[0] = id
if (g_iPluginMode & MODE_HUD_DELAY) if (g_iPluginMode & MODE_HUD_DELAY)
set_task(0.1, "delay_spawn", 200 + id, args, 1) set_task(0.1, "delay_spawn", 200 + id, args, sizeof(args))
else else
delay_spawn(args) delay_spawn(args)
@ -1462,7 +1462,7 @@ kill_stats(id)
// Update user's team round stats // Update user's team round stats
if (iTeam >= 0 && iTeam < MAX_TEAMS) if (iTeam >= 0 && iTeam < MAX_TEAMS)
{ {
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(izStats); i++)
{ {
g_izTeamRndStats[iTeam][i] += izStats[i] g_izTeamRndStats[iTeam][i] += izStats[i]
g_izTeamGameStats[iTeam][i] += izStats[i] g_izTeamGameStats[iTeam][i] += izStats[i]
@ -1474,7 +1474,7 @@ kill_stats(id)
// Update user's round stats // Update user's round stats
if (g_izUserUserID[id] == get_user_userid(id)) if (g_izUserUserID[id] == get_user_userid(id))
{ {
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(izStats); i++)
{ {
g_izUserRndStats[id][i] += izStats[i] g_izUserRndStats[id][i] += izStats[i]
g_izUserGameStats[id][i] += izStats[i] g_izUserGameStats[id][i] += izStats[i]
@ -1482,7 +1482,7 @@ kill_stats(id)
} else { } else {
g_izUserUserID[id] = get_user_userid(id) g_izUserUserID[id] = get_user_userid(id)
for (i = 0; i < 8; i++) for (i = 0; i < sizeof(izStats); i++)
{ {
g_izUserRndStats[id][i] = izStats[i] g_izUserRndStats[id][i] = izStats[i]
g_izUserGameStats[id][i] = izStats[i] g_izUserGameStats[id][i] = izStats[i]
@ -1584,7 +1584,7 @@ endround_stats()
public eventTeamScore() public eventTeamScore()
{ {
new sTeamID[1 + 1], iTeamScore new sTeamID[1 + 1], iTeamScore
read_data(1, sTeamID, 1) read_data(1, sTeamID, charsmax(sTeamID))
iTeamScore = read_data(2) iTeamScore = read_data(2)
g_izTeamEventScore[(sTeamID[0] == 'C') ? 1 : 0] = iTeamScore g_izTeamEventScore[(sTeamID[0] == 'C') ? 1 : 0] = iTeamScore
@ -1637,7 +1637,7 @@ public end_game_stats()
public eventSpecMode(id) public eventSpecMode(id)
{ {
new sData[12] new sData[12]
read_data(2, sData, 11) read_data(2, sData, charsmax(sData))
g_izSpecMode[id] = (sData[10] == '2') g_izSpecMode[id] = (sData[10] == '2')
return PLUGIN_CONTINUE return PLUGIN_CONTINUE

View File

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

View File

@ -269,9 +269,9 @@ public endGameStats(){
new players[32], inum new players[32], inum
get_players(players,inum) get_players(players,inum)
new g_Top[8], top = get_cvar_num("dodstats_topvalue") new g_Top[16], top = get_cvar_num("dodstats_topvalue")
for(i = 0; i < inum; ++i){ for(i = 0; i < inum; ++i){
format(g_Top,15,"%L",i,"TOPX",top) format(g_Top,charsmax(g_Top),"%L",i,"TOPX",top)
getTop15_steam(i) getTop15_steam(i)
show_motd(players[i],g_Buffer,g_Top) show_motd(players[i],g_Buffer,g_Top)
} }
@ -295,18 +295,18 @@ public cmdStats(id){
/* build list of attackers */ /* build list of attackers */
getAttackers(id) { getAttackers(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[9],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[9],body[8],found=0
new pos = format(g_Buffer,2047,"%L^n",id,"ATTACKERS") new pos = format(g_Buffer,charsmax(g_Buffer),"%L^n",id,"ATTACKERS")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_astats(id,a,stats,body,wpn,31)) if(get_user_astats(id,a,stats,body,wpn,charsmax(wpn)))
{ {
found = 1 found = 1
if (stats[0]) if (stats[0])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HIT_S",wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HIT_S",wpn)
} }
} }
return found return found
@ -316,17 +316,17 @@ getAttackers(id) {
/* build list of victims */ /* build list of victims */
getVictims(id) { getVictims(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[9],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[9],body[8],found=0
new pos = format(g_Buffer,2047,"%L^n",id,"VICTIMS") new pos = format(g_Buffer,charsmax(g_Buffer),"%L^n",id,"VICTIMS")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_vstats(id,a,stats,body,wpn,31)) if(get_user_vstats(id,a,stats,body,wpn,charsmax(wpn)))
{ {
found = 1 found = 1
if (stats[1]) if (stats[1])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HITS",wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d %L / %d %L%s^n",name,stats[6],id,"DMG",stats[5],id,"HITS",wpn)
} }
} }
return found return found
@ -337,21 +337,21 @@ getHits(id,killer) {
new stats[9], body[8], pos = 0 new stats[9], body[8], pos = 0
g_Buffer[0] = 0 g_Buffer[0] = 0
get_user_astats(id,killer,stats,body) get_user_astats(id,killer,stats,body)
for(new a = 1; a < 8; ++a) for(new a = 1; a < sizeof(body); ++a)
if(body[a]) if(body[a])
pos += format(g_Buffer[pos],2047-pos,"%L: %d^n",id,g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%L: %d^n",id,g_bodyParts[a],body[a])
} }
/* build list of hits for say hp */ /* build list of hits for say hp */
getMyHits(id,killed) { getMyHits(id,killed) {
new name[MAX_NAME_LENGTH], stats[9], body[8], found = 0 new name[MAX_NAME_LENGTH], stats[9], body[8], found = 0
get_user_name(killed,name,31) get_user_name(killed,name,charsmax(name))
new pos = format(g_Buffer,2047,"%L",id,"YOU_HIT",name) new pos = format(g_Buffer,charsmax(g_Buffer),"%L",id,"YOU_HIT",name)
get_user_vstats(id,killed,stats,body) get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){ for(new a = 1; a < sizeof(body); ++a){
if(body[a]){ if(body[a]){
found = 1 found = 1
pos += format(g_Buffer[pos],2047-pos," %L: %d ",id,g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos," %L: %d ",id,g_bodyParts[a],body[a])
} }
} }
return found return found
@ -367,9 +367,9 @@ public cmdKiller(id) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (g_Killers[id][0]) { if (g_Killers[id][0]) {
new name[MAX_NAME_LENGTH], stats[9], body[8], wpn[33], mstats[9], mbody[8] new name[MAX_NAME_LENGTH], stats[9], body[8], wpn[32], mstats[9], mbody[8]
get_user_name(g_Killers[id][0],name,31) get_user_name(g_Killers[id][0],name,charsmax(name))
get_user_astats(id,g_Killers[id][0],stats,body,wpn,31) get_user_astats(id,g_Killers[id][0],stats,body,wpn,charsmax(wpn))
get_user_vstats(id,g_Killers[id][0],mstats,mbody) get_user_vstats(id,g_Killers[id][0],mstats,mbody)
client_print(id,print_chat,"%L",id,"KILL_INFO1", name,wpn,float(g_Killers[id][2]) * 0.0254 ) client_print(id,print_chat,"%L",id,"KILL_INFO1", name,wpn,float(g_Killers[id][2]) * 0.0254 )
client_print(id,print_chat,"%L",id,"KILL_INFO2", stats[6],stats[5], g_Killers[id][1] ) client_print(id,print_chat,"%L",id,"KILL_INFO2", stats[6],stats[5], g_Killers[id][1] )
@ -415,22 +415,22 @@ showStatsMenu(id,pos){
get_players(g_userPlayers[id],inum) get_players(g_userPlayers[id],inum)
if (start >= inum) start = pos = g_userPosition[id] = 0 if (start >= inum) start = pos = g_userPosition[id] = 0
new len = format(menu_body,511,"\y%L\R%d/%d^n\w^n",id,"SERVER_STATS",pos + 1,((inum/max_menupos)+((inum%max_menupos)?1:0))) new len = format(menu_body,charsmax(menu_body),"\y%L\R%d/%d^n\w^n",id,"SERVER_STATS",pos + 1,((inum/max_menupos)+((inum%max_menupos)?1:0)))
new name[MAX_NAME_LENGTH], end = start + max_menupos, keys = (1<<9)|(1<<7) new name[MAX_NAME_LENGTH], end = start + max_menupos, keys = (1<<9)|(1<<7)
if (end > inum) end = inum if (end > inum) end = inum
for(new a = start; a < end; ++a){ for(new a = start; a < end; ++a){
get_user_name(g_userPlayers[id][a],name,31) get_user_name(g_userPlayers[id][a],name,charsmax(name))
keys |= (1<<k) keys |= (1<<k)
len += format(menu_body[len],511-len,"%d. %s^n",++k,name) len += format(menu_body[len],charsmax(menu_body)-len,"%d. %s^n",++k,name)
} }
len += format(menu_body[len],511-len,"^n8. %L^n",id,g_userState[id] ? "SHOW_RANK" : "SHOW_STATS" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n8. %L^n",id,g_userState[id] ? "SHOW_RANK" : "SHOW_STATS" )
if (end != inum){ if (end != inum){
len += format(menu_body[len],511-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" )
keys |= (1<<8) keys |= (1<<8)
} }
else len += format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" ) else len += format(menu_body[len],charsmax(menu_body)-len,"^n0. %s" , pos ? "Back" : "Exit" )
show_menu(id,keys,menu_body,-1,"Server Stats") show_menu(id,keys,menu_body,-1,"Server Stats")
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -511,24 +511,24 @@ public round_end(){
} }
if ( is_user_connected(who1) ) { if ( is_user_connected(who1) ) {
get_user_name( who1, name1, 31 ) get_user_name( who1, name1, charsmax(name1) )
} }
if ( is_user_connected(who2) ) { if ( is_user_connected(who2) ) {
get_user_name( who2, name2, 31 ) get_user_name( who2, name2, charsmax(name2) )
} }
if ( is_user_connected(who3) ) { if ( is_user_connected(who3) ) {
get_user_name( who3, name3, 31 ) get_user_name( who3, name3, charsmax(name3) )
} }
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
len = 0 len = 0
len += format(g_Buffer2[len] , 1023 - len , len += format(g_Buffer2[len] , charsmax(g_Buffer2) - len ,
"%L: %s^n%d %L^n",players[i],"BEST_SCORE", name1 , score,players[i],"POINTS" ) "%L: %s^n%d %L^n",players[i],"BEST_SCORE", name1 , score,players[i],"POINTS" )
len += format(g_Buffer2[len] , 1023 - len , len += format(g_Buffer2[len] , charsmax(g_Buffer2) - len ,
"%L: %s^n%d %L / %d %L^n",players[i],"MOST_KILLS",name2,kills,players[i],(kills == 1) ? "KILL":"KILLS",hs,players[i],(hs == 1) ? "HEADSHOT":"HEADSHOTS" ) "%L: %s^n%d %L / %d %L^n",players[i],"MOST_KILLS",name2,kills,players[i],(kills == 1) ? "KILL":"KILLS",hs,players[i],(hs == 1) ? "HEADSHOT":"HEADSHOTS" )
len += format(g_Buffer2[len] , 1023 - len , len += format(g_Buffer2[len] , charsmax(g_Buffer2) - len ,
"%L: %s^n%d %L / %d %L^n",players[i],"MOST_DAMAGE",name3 , damage,players[i],"DAMAGE",hits,players[i],(hits == 1) ? "HIT": "HITS" ) "%L: %s^n%d %L / %d %L^n",players[i],"MOST_DAMAGE",name3 , damage,players[i],"DAMAGE",hits,players[i],(hits == 1) ? "HIT": "HITS" )
set_hudmessage(100,200,0,0.02,0.40,2, 0.01, 5.0, 0.01, 0.01, -1 ) set_hudmessage(100,200,0,0.02,0.40,2, 0.01, 5.0, 0.01, 0.01, -1 )
show_hudmessage( players[i] , "%s", g_Buffer2 ) show_hudmessage( players[i] , "%s", g_Buffer2 )
@ -548,7 +548,7 @@ public client_damage(attacker,victim,damage,wpnindex,hitplace,TA)
if ( TA ){ if ( TA ){
if ( TAInfo && is_user_alive(victim) ){ if ( TAInfo && is_user_alive(victim) ){
new attacker_name[MAX_NAME_LENGTH] new attacker_name[MAX_NAME_LENGTH]
get_user_name(attacker,attacker_name,31) get_user_name(attacker,attacker_name,charsmax(attacker_name))
client_print(0,print_chat,"%L",LANG_PLAYER,"TA_MSG",attacker_name) client_print(0,print_chat,"%L",LANG_PLAYER,"TA_MSG",attacker_name)
} }
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
@ -570,7 +570,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
new killer_name[MAX_NAME_LENGTH] new killer_name[MAX_NAME_LENGTH]
get_user_name(killer,killer_name,31) get_user_name(killer,killer_name,charsmax(killer_name))
new enemygre = ( ( (wpnindex == DODW_HANDGRENADE || wpnindex == DODW_MILLS_BOMB) && get_user_team(killer) == 2 ) || ( wpnindex == DODW_STICKGRENADE && get_user_team(killer) == 1 ) ) ? 1:0 new enemygre = ( ( (wpnindex == DODW_HANDGRENADE || wpnindex == DODW_MILLS_BOMB) && get_user_team(killer) == 2 ) || ( wpnindex == DODW_STICKGRENADE && get_user_team(killer) == 1 ) ) ? 1:0
@ -592,7 +592,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
new selfKill = ( killer == victim ) ? 1:0 new selfKill = ( killer == victim ) ? 1:0
new victim_name[MAX_NAME_LENGTH] new victim_name[MAX_NAME_LENGTH]
get_user_name(victim,victim_name,31) get_user_name(victim,victim_name,charsmax(victim_name))
new Float:statstime = get_cvar_float("dodstats_statstime") new Float:statstime = get_cvar_float("dodstats_statstime")
@ -632,9 +632,9 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
if ( ShowKiller && !(!get_cvar_num("dodstats_rankbots") && (is_user_bot(killer) || is_user_bot(victim))) ){ if ( ShowKiller && !(!get_cvar_num("dodstats_rankbots") && (is_user_bot(killer) || is_user_bot(victim))) ){
new stats[9], body[8], wpn[33], mstats[9], mbody[8] new stats[9], body[8], wpn[32], mstats[9], mbody[8]
get_user_astats(victim,killer,stats,body,wpn,31) get_user_astats(victim,killer,stats,body,wpn,charsmax(wpn))
get_user_vstats(victim,killer,mstats,mbody) get_user_vstats(victim,killer,mstats,mbody)
set_hudmessage(220,80,0,0.05,0.15,0, statstime, 12.0, 1.0, 2.0, -1) set_hudmessage(220,80,0,0.05,0.15,0, statstime, 12.0, 1.0, 2.0, -1)
getHits(victim,killer) getHits(victim,killer)
@ -646,7 +646,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
if ( KillerHp ){ if ( KillerHp ){
new kmsg[128] new kmsg[128]
format(kmsg,127,"%L",victim,"STILL_HAS",killer_name,g_Killers[victim][1]) format(kmsg,charsmax(kmsg),"%L",victim,"STILL_HAS",killer_name,g_Killers[victim][1])
client_print(victim,print_console,"%s^n",kmsg) client_print(victim,print_console,"%s^n",kmsg)
set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1) set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1)
show_hudmessage(victim, "%s", kmsg) show_hudmessage(victim, "%s", kmsg)
@ -678,7 +678,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
new param[2] new param[2]
param[0] = killer param[0] = killer
param[1] = g_multiKills[killer][0] param[1] = g_multiKills[killer][0]
set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,sizeof(param))
} }
if ( xmod_is_melee_wpn(wpnindex) && ( KnifeKill || KnifeKillSound ) ){ if ( xmod_is_melee_wpn(wpnindex) && ( KnifeKill || KnifeKillSound ) ){
@ -720,16 +720,16 @@ public client_death(killer,victim,wpnindex,hitplace,TK)
if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){ if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){
if ( HeadShotKill ){ if ( HeadShotKill ){
new weapon[32], message[256], players[32], pnum new weapon[32], message[256], players[32], pnum
xmod_get_wpnname(wpnindex,weapon,31) xmod_get_wpnname(wpnindex,weapon,charsmax(weapon))
get_players(players,pnum,"c") get_players(players,pnum,"c")
for (new i=0;i<pnum;i++) { for (new i=0;i<pnum;i++) {
if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() )
continue continue
format( message, sizeof(message)-1, "%L",players[i],g_HeadShots[ random_num(0,6) ] ) format( message, charsmax(message), "%L",players[i],g_HeadShots[ random_num(0,6) ] )
replace( message, sizeof(message)-1, "$vn", victim_name ) replace( message, charsmax(message), "$vn", victim_name )
replace( message, sizeof(message)-1, "$wn", weapon ) replace( message, charsmax(message), "$wn", weapon )
replace( message, sizeof(message)-1, "$kn", killer_name ) replace( message, charsmax(message), "$kn", killer_name )
set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, -1) set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, -1)
ShowSyncHudMsg(players[i], g_center2_sync, "%s", message) ShowSyncHudMsg(players[i], g_center2_sync, "%s", message)
} }
@ -770,10 +770,10 @@ public showDoubleKill(){
if ( pos > 2 ) pos = 2 if ( pos > 2 ) pos = 2
if ( DoubleKill ) { if ( DoubleKill ) {
new name[MAX_NAME_LENGTH] new name[MAX_NAME_LENGTH]
get_user_name(g_prevKillerId,name,31) get_user_name(g_prevKillerId,name,charsmax(name))
if ( pos == 2 ){ if ( pos == 2 ){
new kills[3] new kills[3]
num_to_str(g_KillCount,kills,2) num_to_str(g_KillCount,kills,charsmax(kills))
} }
set_hudmessage(65, 102, 158, -1.0, 0.25, 0, 6.0, 6.0, 0.5, 0.15, -1) set_hudmessage(65, 102, 158, -1.0, 0.25, 0, 6.0, 6.0, 0.5, 0.15, -1)
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){
@ -795,7 +795,7 @@ public checkKills(param[]){
if ( a > -1 ){ if ( a > -1 ){
if ( MultiKill ) { if ( MultiKill ) {
new name[MAX_NAME_LENGTH] new name[MAX_NAME_LENGTH]
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1) set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
if ( a > 6 ) a = 6 if ( a > 6 ) a = 6
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){
@ -922,28 +922,28 @@ displayStats_steam(id,dest) {
new name[MAX_NAME_LENGTH], stats[9], body[8] new name[MAX_NAME_LENGTH], stats[9], body[8]
get_user_wstats(id,0,stats,body) get_user_wstats(id,0,stats,body)
new pos = copy(g_Buffer,2047,"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px; color:#FFB000;}</style></head><pre><body>") new pos = copy(g_Buffer,charsmax(g_Buffer),"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px; color:#FFB000;}</style></head><pre><body>")
pos += format(g_Buffer[pos],2047-pos,"<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>",
dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS") dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS")
pos += format(g_Buffer[pos],2047-pos,"<tr><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr></table><br><br><br>", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<tr><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr></table><br><br><br>",
stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2]) stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2])
pos += format(g_Buffer[pos],2047-pos,"<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L<td></tr>", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L<td></tr>",
dest,"M_WEAPON",dest,"M_SHOTS",dest,"M_HITS",dest,"M_DAMAGE",dest,"M_KILLS",dest,"M_DEATHS") dest,"M_WEAPON",dest,"M_SHOTS",dest,"M_HITS",dest,"M_DAMAGE",dest,"M_KILLS",dest,"M_DEATHS")
for(new a = 1; a < DODMAX_WEAPONS; ++a) { for(new a = 1; a < DODMAX_WEAPONS; ++a) {
if (get_user_wstats(id,a,stats,body)){ if (get_user_wstats(id,a,stats,body)){
if ( xmod_is_melee_wpn(a) ) if ( xmod_is_melee_wpn(a) )
stats[4] = -1; stats[4] = -1;
xmod_get_wpnname(a,name,31) xmod_get_wpnname(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<tr><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>^n",
name,stats[4],stats[5],stats[6],stats[0],stats[1]) name,stats[4],stats[5],stats[6],stats[0],stats[1])
} }
} }
copy(g_Buffer[pos],2047-pos,"</table></pre></body></html>") copy(g_Buffer[pos],charsmax(g_Buffer)-pos,"</table></pre></body></html>")
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
} }
@ -961,23 +961,23 @@ displayRank_steam(id,dest) {
new name[MAX_NAME_LENGTH], stats[9], body[8] new name[MAX_NAME_LENGTH], stats[9], body[8]
new rank_pos = get_user_stats(id,stats,body) new rank_pos = get_user_stats(id,stats,body)
new pos = copy(g_Buffer,2047,"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px;color:#FFB000;}</style></head><pre><body>") new pos = copy(g_Buffer,charsmax(g_Buffer),"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px;color:#FFB000;}</style></head><pre><body>")
pos += format(g_Buffer[pos],2047-pos, pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,
"<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>",dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS") "<table><tr><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>",dest,"M_KILLS",dest,"M_DEATHS",dest,"M_SCORE",dest,"M_TKS",dest,"M_HITS",dest,"M_SHOTS",dest,"M_HS")
pos += format(g_Buffer[pos],2047-pos, pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,
"<tr><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr></table><br><br>", "<tr><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr></table><br><br>",
stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2]) stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2])
pos += format(g_Buffer[pos],2047-pos,"%L^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n",dest,"M_HITS",dest,g_bodyParts[1],body[1],dest,g_bodyParts[2],body[2],dest,g_bodyParts[3],body[3],dest,g_bodyParts[4],body[4],dest,g_bodyParts[5],body[5],dest,g_bodyParts[6],body[6],dest,g_bodyParts[7],body[7]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%L^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n%L: %d^n",dest,"M_HITS",dest,g_bodyParts[1],body[1],dest,g_bodyParts[2],body[2],dest,g_bodyParts[3],body[3],dest,g_bodyParts[4],body[4],dest,g_bodyParts[5],body[5],dest,g_bodyParts[6],body[6],dest,g_bodyParts[7],body[7])
pos += format(g_Buffer[pos],2047-pos,"%L <b>%d</b> %L <b>%d</b>",dest,(id==dest)?"M_YOUR_RANK_IS":"M_THEIR_RANK_IS", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%L <b>%d</b> %L <b>%d</b>",dest,(id==dest)?"M_YOUR_RANK_IS":"M_THEIR_RANK_IS",
rank_pos,dest,"M_OF",get_statsnum()) rank_pos,dest,"M_OF",get_statsnum())
pos += format(g_Buffer[pos],2047-pos,"</pre></body></html>") pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"</pre></body></html>")
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
} }
@ -988,8 +988,8 @@ public cmdTop15(id) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
getTop15_steam(id) getTop15_steam(id)
new g_Top[8] new g_Top[16]
format(g_Top,7,"%L",id,"TOPX",get_cvar_num("dodstats_topvalue")) format(g_Top,charsmax(g_Top),"%L",id,"TOPX",get_cvar_num("dodstats_topvalue"))
show_motd(id,g_Buffer,g_Top) show_motd(id,g_Buffer,g_Top)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
@ -999,21 +999,21 @@ public cmdTop15(id) {
getTop15_steam(id){ getTop15_steam(id){
new stats[9], body[8], name[MAX_NAME_LENGTH] new stats[9], body[8], name[MAX_NAME_LENGTH]
new pos = copy(g_Buffer,2047,"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px;color:#FFB000;}</style></head><pre><body>") new pos = copy(g_Buffer,charsmax(g_Buffer),"<html><head><meta charset=utf-8><style type=^"text/css^">pre{color:#FFB000;}body{background:Black;margin-left:8px;margin-top:0px;color:#FFB000;}</style></head><pre><body>")
pos += format(g_Buffer[pos],2047-pos,"<table><tr><td>#</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<table><tr><td>#</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td><td>%L</td></tr>",
id,"M_NICK",id,"M_KILLS",id,"M_DEATHS",id,"M_SCORE",id,"M_TKS",id,"M_HITS",id,"M_SHOTS",id,"M_HS") id,"M_NICK",id,"M_KILLS",id,"M_DEATHS",id,"M_SCORE",id,"M_TKS",id,"M_HITS",id,"M_SHOTS",id,"M_HS")
new imax = get_statsnum() new imax = get_statsnum()
new itmax = get_cvar_num("dodstats_topvalue") new itmax = get_cvar_num("dodstats_topvalue")
if (imax > itmax ) if (imax > itmax )
imax = itmax imax = itmax
for(new a = 0; a < imax; ++a){ for(new a = 0; a < imax; ++a){
get_stats(a,stats,body,name,31); get_stats(a,stats,body,name,charsmax(name));
replace_all(name, 31, "<", "[") replace_all(name, charsmax(name), "<", "[")
replace_all(name, 31, ">", "]") replace_all(name, charsmax(name), ">", "]")
pos += format(g_Buffer[pos],2047-pos,"<tr><td>%d.</td><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"<tr><td>%d.</td><td>%s</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>^n",
a+1,name,stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2]) a+1,name,stats[0],stats[1],stats[7],stats[3],stats[5],stats[4],stats[2])
} }
pos += format(g_Buffer[pos],2047-pos,"</table></pre></body></html>") pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"</table></pre></body></html>")
} }

View File

@ -26,13 +26,13 @@ public client_disconnect(id) {
remove_task( id ) remove_task( id )
new szTeam[16],szName[MAX_NAME_LENGTH],szAuthid[32], iStats[9], iHits[8], szWeapon[16] new szTeam[16],szName[MAX_NAME_LENGTH],szAuthid[32], iStats[9], iHits[8], szWeapon[16]
new iUserid = get_user_userid( id ) new iUserid = get_user_userid( id )
get_user_info(id,"team", szTeam, 15 ) get_user_info(id,"team", szTeam, charsmax(szTeam) )
szTeam[0] -= 32; szTeam[0] -= 32;
get_user_name(id, szName ,31 ) get_user_name(id, szName ,charsmax(szName) )
get_user_authid(id, szAuthid , 31 ) get_user_authid(id, szAuthid , charsmax(szAuthid) )
for(new i = 1 ; i < DODMAX_WEAPONS; ++i ) { for(new i = 1 ; i < DODMAX_WEAPONS; ++i ) {
if( get_user_wstats( id , i ,iStats , iHits ) ) { if( get_user_wstats( id , i ,iStats , iHits ) ) {
xmod_get_wpnlogname( i , szWeapon , 15 ) xmod_get_wpnlogname( i , szWeapon , charsmax(szWeapon) )
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^") (score ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^") (score ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1],iStats[7]) szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1],iStats[7])
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats2^" (weapon ^"%s^") (head ^"%d^") (chest ^"%d^") (stomach ^"%d^") (leftarm ^"%d^") (rightarm ^"%d^") (leftleg ^"%d^") (rightleg ^"%d^")",

View File

@ -92,7 +92,7 @@ check_idletime(id) {
client_print(id, print_chat, "[AMXX] You have %d seconds to move or you will be kicked for being idle", timeleft) client_print(id, print_chat, "[AMXX] You have %d seconds to move or you will be kicked for being idle", timeleft)
} else if (g_idletime[id] > maxidletime) { } else if (g_idletime[id] > maxidletime) {
new name[MAX_NAME_LENGTH] new name[MAX_NAME_LENGTH]
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
client_print(0, print_chat, "[AMXX] %s was kicked for being idle longer than %d seconds", name, maxidletime) client_print(0, print_chat, "[AMXX] %s was kicked for being idle longer than %d seconds", name, maxidletime)
log_amx("%s was kicked for being idle longer than %d seconds", name, maxidletime) log_amx("%s was kicked for being idle longer than %d seconds", name, maxidletime)
server_cmd("kick #%d ^"You were kicked for being idle longer than %d seconds^"", get_user_userid(id), maxidletime) server_cmd("kick #%d ^"You were kicked for being idle longer than %d seconds^"", get_user_userid(id), maxidletime)
@ -114,7 +114,7 @@ public playerSpawned(id) {
g_spawned[id] = false g_spawned[id] = false
new sid[1] new sid[1]
sid[0] = id sid[0] = id
set_task(0.75, "delayedSpawn",_, sid, 1) // Give the player time to drop to the floor when spawning set_task(0.75, "delayedSpawn",_, sid, sizeof(sid)) // Give the player time to drop to the floor when spawning
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }

View File

@ -34,12 +34,12 @@ public plugin_init()
register_cvar("amx_extendmap_max","90") register_cvar("amx_extendmap_max","90")
register_cvar("amx_extendmap_step","15") register_cvar("amx_extendmap_step","15")
get_localinfo("lastMap",g_lastMap,31) get_localinfo("lastMap",g_lastMap,charsmax(g_lastMap))
set_localinfo("lastMap","") set_localinfo("lastMap","")
new maps_ini_file[64]; new maps_ini_file[64];
get_configsdir(maps_ini_file, 63); get_configsdir(maps_ini_file, charsmax(maps_ini_file));
format(maps_ini_file, 63, "%s/maps.ini", maps_ini_file); format(maps_ini_file, charsmax(maps_ini_file), "%s/maps.ini", maps_ini_file);
if ( loadSettings(maps_ini_file) ) if ( loadSettings(maps_ini_file) )
set_task(15.0,"voteNextmap",987456,"",0,"b") set_task(15.0,"voteNextmap",987456,"",0,"b")
} }
@ -51,7 +51,7 @@ public checkVotes(){
b = a b = a
if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) { if ( g_voteCount[SELECTMAPS] > g_voteCount[b] ) {
new mapname[32] new mapname[32]
get_mapname(mapname,31) get_mapname(mapname,charsmax(mapname))
new Float:steptime = get_cvar_float("amx_extendmap_step") new Float:steptime = get_cvar_float("amx_extendmap_step")
set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime ) set_cvar_float("mp_timelimit", get_cvar_float("mp_timelimit") + steptime )
client_print(0,print_chat,"Choosing finished. Current map will be extended to next %.0f minutes", steptime ) client_print(0,print_chat,"Choosing finished. Current map will be extended to next %.0f minutes", steptime )
@ -62,15 +62,15 @@ public checkVotes(){
if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] ) if ( g_voteCount[b] && g_voteCount[SELECTMAPS+1] <= g_voteCount[b] )
set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] ) set_cvar_string("amx_nextmap", g_mapName[g_nextName[b]] )
new smap[32] new smap[32]
get_cvar_string("amx_nextmap",smap,31) get_cvar_string("amx_nextmap",smap,charsmax(smap))
client_print(0,print_chat,"Choosing finished. The nextmap will be %s", smap ) client_print(0,print_chat,"Choosing finished. The nextmap will be %s", smap )
log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap) log_amx("Vote: Voting for the nextmap finished. The nextmap will be %s", smap)
} }
public countVote(id,key){ public countVote(id,key){
if ( get_cvar_float("amx_vote_answers") ) { if ( get_cvar_float("amx_vote_answers") ) {
new name[32] new name[MAX_NAME_LENGTH]
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
if ( key == SELECTMAPS ) if ( key == SELECTMAPS )
client_print(0,print_chat,"%s chose map extending", name ) client_print(0,print_chat,"%s chose map extending", name )
else if ( key < SELECTMAPS ) else if ( key < SELECTMAPS )
@ -98,7 +98,7 @@ public voteNextmap(){
return return
g_selected = true g_selected = true
new menu[512], a, mkeys = (1<<SELECTMAPS+1) new menu[512], a, mkeys = (1<<SELECTMAPS+1)
new pos = copy(menu,511,"AMX Choose nextmap:^n^n") new pos = copy(menu,charsmax(menu),"AMX Choose nextmap:^n^n")
new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums new dmax = (g_mapNums > SELECTMAPS) ? SELECTMAPS : g_mapNums
for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){ for(g_mapVoteNum = 0;g_mapVoteNum<dmax;++g_mapVoteNum){
a=random_num(0,g_mapNums-1) a=random_num(0,g_mapNums-1)
@ -113,14 +113,14 @@ public voteNextmap(){
g_voteCount[SELECTMAPS] = 0 g_voteCount[SELECTMAPS] = 0
g_voteCount[SELECTMAPS+1] = 0 g_voteCount[SELECTMAPS+1] = 0
new mapname[32] new mapname[32]
get_mapname(mapname,31) get_mapname(mapname,charsmax(mapname))
if ( get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max") ){ if ( get_cvar_float("mp_timelimit") < get_cvar_float("amx_extendmap_max") ){
pos += format(menu[pos], charsmax(menu) - pos, "%d. Extend map %s^n", SELECTMAPS+1, mapname) pos += format(menu[pos], charsmax(menu) - pos, "%d. Extend map %s^n", SELECTMAPS+1, mapname)
mkeys |= (1<<SELECTMAPS) mkeys |= (1<<SELECTMAPS)
} }
format(menu[pos],511,"%d. None",SELECTMAPS+2) format(menu[pos],charsmax(menu),"%d. None",SELECTMAPS+2)
show_menu(0,mkeys,menu,15) show_menu(0,mkeys,menu,15)
set_task(15.0,"checkVotes") set_task(15.0,"checkVotes")
client_print(0,print_chat,"It's time to choose the nextmap...") client_print(0,print_chat,"It's time to choose the nextmap...")
@ -164,12 +164,12 @@ loadSettings(filename[])
new szText[32] new szText[32]
new a, pos = 0 new a, pos = 0
new currentMap[32] new currentMap[32]
get_mapname(currentMap,31) get_mapname(currentMap,charsmax(currentMap))
while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,31,a) ) while ( (g_mapNums < MAX_MAPS) && read_file(filename,pos++,szText,charsmax(szText),a) )
{ {
if ( szText[0] != ';' if ( szText[0] != ';'
&& parse(szText, g_mapName[g_mapNums] ,31 ) && parse(szText, g_mapName[g_mapNums] ,charsmax(g_mapName[]) )
&& ValidMap( g_mapName[g_mapNums] ) && ValidMap( g_mapName[g_mapNums] )
&& !equali( g_mapName[g_mapNums] ,g_lastMap) && !equali( g_mapName[g_mapNums] ,g_lastMap)
&& !equali( g_mapName[g_mapNums] ,currentMap) ) && !equali( g_mapName[g_mapNums] ,currentMap) )
@ -181,6 +181,6 @@ loadSettings(filename[])
public plugin_end(){ public plugin_end(){
new current_map[32] new current_map[32]
get_mapname(current_map,31 ) get_mapname(current_map,charsmax(current_map) )
set_localinfo("lastMap",current_map) set_localinfo("lastMap",current_map)
} }

View File

@ -74,11 +74,11 @@ public server_changelevel() {
// Check if the cvar "amx_nextmap" has changed since the map loaded as it overrides the min/max settings. // Check if the cvar "amx_nextmap" has changed since the map loaded as it overrides the min/max settings.
new szCvarNextMap[32] new szCvarNextMap[32]
get_cvar_string("amx_nextmap", szCvarNextMap, 31) get_cvar_string("amx_nextmap", szCvarNextMap, charsmax(szCvarNextMap))
if ( !equal(szCvarNextMap, g_mapCycle[g_nextPos][NAME]) ) { if ( !equal(szCvarNextMap, g_mapCycle[g_nextPos][NAME]) ) {
if (ValidMap(szCvarNextMap)) { if (ValidMap(szCvarNextMap)) {
if (g_changeMapDelay) if (g_changeMapDelay)
set_task(INFO_READ_TIME, "changeMap", 0, szCvarNextMap, 32) set_task(INFO_READ_TIME, "changeMap", 0, szCvarNextMap, sizeof(szCvarNextMap))
else else
changeMap(szCvarNextMap) changeMap(szCvarNextMap)
return BLOCK_ONCE return BLOCK_ONCE
@ -89,7 +89,7 @@ public server_changelevel() {
getNextValidMap(szNextMap) getNextValidMap(szNextMap)
if (ValidMap(szNextMap)) { if (ValidMap(szNextMap)) {
if (g_changeMapDelay) if (g_changeMapDelay)
set_task(INFO_READ_TIME, "changeMap", 0, szNextMap, 32) set_task(INFO_READ_TIME, "changeMap", 0, szNextMap, sizeof(szNextMap))
else else
changeMap(szNextMap) changeMap(szNextMap)
} else } else
@ -134,7 +134,7 @@ public getNextValidMap(szNextMap[]) {
(g_mapCycle[startPos][MIN] <= g_numPlayers) ? "many" : "few", g_mapCycle[startPos][NAME], g_mapCycle[g_nextPos][NAME]) (g_mapCycle[startPos][MIN] <= g_numPlayers) ? "many" : "few", g_mapCycle[startPos][NAME], g_mapCycle[g_nextPos][NAME])
new szPos[8] new szPos[8]
num_to_str(g_nextPos, szPos, 7) num_to_str(g_nextPos, szPos, charsmax(szPos))
set_localinfo("amx_nextmap_pos", szPos) set_localinfo("amx_nextmap_pos", szPos)
set_cvar_string("amx_nextmap", g_mapCycle[g_nextPos][NAME]) set_cvar_string("amx_nextmap", g_mapCycle[g_nextPos][NAME])
g_changeMapDelay = true g_changeMapDelay = true
@ -143,7 +143,7 @@ public getNextValidMap(szNextMap[]) {
public voteMap() { public voteMap() {
new szVoteMap[128] new szVoteMap[128]
read_data(2, szVoteMap, 127) // "YO | Cheesy Peteza executed votemap 2 (co_angst 1/5)" read_data(2, szVoteMap, charsmax(szVoteMap)) // "YO | Cheesy Peteza executed votemap 2 (co_angst 1/5)"
new start, end, szData[64] new start, end, szData[64]
for (new i; i<strlen(szVoteMap); ++i) { for (new i; i<strlen(szVoteMap); ++i) {
@ -155,10 +155,10 @@ public voteMap() {
szData[j++] = szVoteMap[i] // "co_angst 1/5" szData[j++] = szVoteMap[i] // "co_angst 1/5"
} }
szData[j] = 0 szData[j] = 0
replace(szData, 63, "/", " ") // "co_angst 1 5" replace(szData, charsmax(szData), "/", " ") // "co_angst 1 5"
new szMapName[32], szVote1[3], szVote2[3], iVote1, iVote2 new szMapName[32], szVote1[3], szVote2[3], iVote1, iVote2
parse(szData, szMapName, 31, szVote1, 2, szVote2, 2) parse(szData, szMapName, charsmax(szMapName), szVote1, charsmax(szVote1), szVote2, charsmax(szVote2))
iVote1 = str_to_num(szVote1) iVote1 = str_to_num(szVote1)
iVote2 = str_to_num(szVote2) iVote2 = str_to_num(szVote2)
@ -171,11 +171,11 @@ public voteMap() {
findNextMap() { findNextMap() {
new szPos[8] new szPos[8]
get_localinfo("amx_nextmap_pos", szPos, 7) get_localinfo("amx_nextmap_pos", szPos, charsmax(szPos))
new pos = str_to_num(szPos) new pos = str_to_num(szPos)
new curmap[32] new curmap[32]
get_mapname(curmap, 31) get_mapname(curmap, charsmax(curmap))
if ( equal(g_mapCycle[pos][NAME], curmap) ) { if ( equal(g_mapCycle[pos][NAME], curmap) ) {
g_nextPos = pos + 1 g_nextPos = pos + 1
if (g_nextPos == g_numMaps) if (g_nextPos == g_numMaps)
@ -191,29 +191,29 @@ findNextMap() {
} }
} }
set_cvar_string("amx_nextmap", g_mapCycle[g_nextPos][NAME]) set_cvar_string("amx_nextmap", g_mapCycle[g_nextPos][NAME])
num_to_str(g_nextPos, szPos, 7) num_to_str(g_nextPos, szPos, charsmax(szPos))
set_localinfo("amx_nextmap_pos", szPos) set_localinfo("amx_nextmap_pos", szPos)
} }
readMapCycle() { readMapCycle() {
new szMapCycleFile[32] new szMapCycleFile[32]
get_cvar_string("mapcyclefile", szMapCycleFile, 31) get_cvar_string("mapcyclefile", szMapCycleFile, charsmax(szMapCycleFile))
new length, line = 0 new length, line = 0
new szBuffer[64], szMapName[32], szMapPlayerNum[32] new szBuffer[64], szMapName[32], szMapPlayerNum[32]
if ( file_exists(szMapCycleFile) ) { if ( file_exists(szMapCycleFile) ) {
while( read_file(szMapCycleFile, line++, szBuffer, 63, length) ) { // ns_lost "\minplayers\16\maxplayers\32\" while( read_file(szMapCycleFile, line++, szBuffer, charsmax(szBuffer), length) ) { // ns_lost "\minplayers\16\maxplayers\32\"
parse(szBuffer, szMapName, 31, szMapPlayerNum, 31) parse(szBuffer, szMapName, charsmax(szMapName), szMapPlayerNum, charsmax(szMapPlayerNum))
if ( !isalpha(szMapName[0]) || !ValidMap(szMapName) ) continue if ( !isalpha(szMapName[0]) || !ValidMap(szMapName) ) continue
copy(g_mapCycle[g_numMaps][NAME], 31, szMapName) copy(g_mapCycle[g_numMaps][NAME], charsmax(g_mapCycle[][NAME]), szMapName)
for (new i; i<strlen(szMapPlayerNum); ++i) { // " minplayers 16 maxplayers 32 " for (new i; i<strlen(szMapPlayerNum); ++i) { // " minplayers 16 maxplayers 32 "
if (szMapPlayerNum[i] == '\') if (szMapPlayerNum[i] == '\')
szMapPlayerNum[i] = ' ' szMapPlayerNum[i] = ' '
} }
new szKey1[11], szKey2[11], szValue1[3], szValue2[3] new szKey1[11], szKey2[11], szValue1[3], szValue2[3]
parse(szMapPlayerNum, szKey1, 10, szValue1, 2, szKey2, 10, szValue2, 2) parse(szMapPlayerNum, szKey1, charsmax(szKey1), szValue1, charsmax(szValue1), szKey2, charsmax(szKey2), szValue2, charsmax(szValue2))
if (equal(szKey1, "minplayers")) if (equal(szKey1, "minplayers"))
g_mapCycle[g_numMaps][MIN] = clamp(str_to_num(szValue1), 0, 32) g_mapCycle[g_numMaps][MIN] = clamp(str_to_num(szValue1), 0, 32)
if (equal(szKey2, "maxplayers")) if (equal(szKey2, "maxplayers"))
@ -231,18 +231,18 @@ public roundEnded() {
public sayNextMap(){ public sayNextMap(){
new szName[32] new szName[32]
get_cvar_string("amx_nextmap", szName, 31) get_cvar_string("amx_nextmap", szName, charsmax(szName))
client_print(0, print_chat, "Next Map: %s", szName) client_print(0, print_chat, "Next Map: %s", szName)
} }
public sayNextMapTimeLeft(){ public sayNextMapTimeLeft(){
new szName[32], szText[128] new szName[32], szText[128]
get_cvar_string("amx_nextmap", szName, 31) get_cvar_string("amx_nextmap", szName, charsmax(szName))
format(szText, 64, "Next Map: %s", szName) format(szText, charsmax(szText), "Next Map: %s", szName)
if (get_cvar_float("mp_timelimit")) { if (get_cvar_float("mp_timelimit")) {
new a = get_timeleft() new a = get_timeleft()
format(szText, 127, "%s Time Left: %d:%02d", szText, (a / 60) , (a % 60) ) format(szText, charsmax(szText), "%s Time Left: %d:%02d", szText, (a / 60) , (a % 60) )
} }
client_print(0, print_chat, "%s", szText) client_print(0, print_chat, "%s", szText)
} }

View File

@ -60,11 +60,11 @@ new g_ScoreInfo_Team;
public plugin_init() { public plugin_init() {
register_plugin("NS Commands",AMXX_VERSION_STR,"AMXX Dev Team"); register_plugin("NS Commands",AMXX_VERSION_STR,"AMXX Dev Team");
// create our semi-random acknowledgement commands // create our semi-random acknowledgement commands
format(g_TeamOneAck,11,"namx_a%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z')); format(g_TeamOneAck,charsmax(g_TeamOneAck),"namx_a%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'));
format(g_TeamTwoAck,11,"namx_b%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z')); format(g_TeamTwoAck,charsmax(g_TeamTwoAck),"namx_b%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'));
format(g_ReadyRoomAck,11,"namx_c%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z')); format(g_ReadyRoomAck,charsmax(g_ReadyRoomAck),"namx_c%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'));
format(g_AutoAssignAck,11,"namx_d%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z')); format(g_AutoAssignAck,charsmax(g_AutoAssignAck),"namx_d%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'));
format(g_StopCommAck,11,"namx_e%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z')); format(g_StopCommAck,charsmax(g_StopCommAck),"namx_e%c%c%c%c%c",random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'),random_num('a','z'));
// register them.. // register them..
register_clcmd(g_TeamOneAck,"ack_team_one"); register_clcmd(g_TeamOneAck,"ack_team_one");
@ -123,7 +123,7 @@ public client_connect(id) {
} }
stock UTIL_FindCommander() { stock UTIL_FindCommander() {
new i=1; new i=1;
while (i<32) { while (i<MAX_PLAYERS) {
if (g_Class[i]==PLAYERCLASS_COMMANDER) // this player is comm.. if (g_Class[i]==PLAYERCLASS_COMMANDER) // this player is comm..
return i; return i;
i++; i++;
@ -144,15 +144,15 @@ public cmdRandom(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
if (read_argc()>1) { // person is specified.. if (read_argc()>1) { // person is specified..
new arg[32] 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) new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH]; new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
new auth[32],auth_targ[32]; new auth[32],auth_targ[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_name(player,name_targ,31); get_user_name(player,name_targ,charsmax(name_targ));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
get_user_authid(player,auth_targ,31); get_user_authid(player,auth_targ,charsmax(auth_targ));
log_amx("Cmd: ^"%s<%d><%s><>^" random ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); log_amx("Cmd: ^"%s<%d><%s><>^" random ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ);
show_activity(id, name, "random %s", name_targ); show_activity(id, name, "random %s", name_targ);
@ -174,8 +174,8 @@ public cmdRandom(id,level,cid) {
} }
if (cur) { if (cur) {
new name[MAX_NAME_LENGTH],auth[32]; new name[MAX_NAME_LENGTH],auth[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
log_amx("Cmd: ^"%s<%d><%s><>^" random all",name,get_user_userid(id),auth); log_amx("Cmd: ^"%s<%d><%s><>^" random all",name,get_user_userid(id),auth);
show_activity(id, name, "random all"); show_activity(id, name, "random all");
@ -210,15 +210,15 @@ public cmdReadyRoom(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
if (read_argc()>1) { // person is specified.. if (read_argc()>1) { // person is specified..
new arg[32] 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) new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH]; new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
new auth[32],auth_targ[32]; new auth[32],auth_targ[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_name(player,name_targ,31); get_user_name(player,name_targ,charsmax(name_targ));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
get_user_authid(player,auth_targ,31); get_user_authid(player,auth_targ,charsmax(auth_targ));
log_amx("Cmd: ^"%s<%d><%s><>^" ready room ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); log_amx("Cmd: ^"%s<%d><%s><>^" ready room ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ);
show_activity(id, name, "ready room %s", name_targ); show_activity(id, name, "ready room %s", name_targ);
@ -238,8 +238,8 @@ public cmdReadyRoom(id,level,cid) {
} }
if (cur) { if (cur) {
new name[MAX_NAME_LENGTH],auth[32]; new name[MAX_NAME_LENGTH],auth[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
log_amx("Cmd: ^"%s<%d><%s><>^" ready room all",name,get_user_userid(id),auth); log_amx("Cmd: ^"%s<%d><%s><>^" ready room all",name,get_user_userid(id),auth);
show_activity(id, name, "ready room all"); show_activity(id, name, "ready room all");
@ -273,7 +273,7 @@ public cmdTeamTwo(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
if (read_argc()>1) { // person is specified.. if (read_argc()>1) { // person is specified..
new arg[32] 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) new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
if (g_Team[player]==2 || g_Team[player]==4 /*i think 4 is team 2 in ava..*/) { if (g_Team[player]==2 || g_Team[player]==4 /*i think 4 is team 2 in ava..*/) {
@ -282,10 +282,10 @@ public cmdTeamTwo(id,level,cid) {
} }
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH]; new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
new auth[32],auth_targ[32]; new auth[32],auth_targ[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_name(player,name_targ,31); get_user_name(player,name_targ,charsmax(name_targ));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
get_user_authid(player,auth_targ,31); get_user_authid(player,auth_targ,charsmax(auth_targ));
log_amx("Cmd: ^"%s<%d><%s><>^" alien ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); log_amx("Cmd: ^"%s<%d><%s><>^" alien ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ);
show_activity(id, name, "alien %s", name_targ); show_activity(id, name, "alien %s", name_targ);
@ -301,7 +301,7 @@ public cmdTeamOne(id,level,cid) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
if (read_argc()>1) { // person is specified.. if (read_argc()>1) { // person is specified..
new arg[32] 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) new player = cmd_target(id,arg,CMDTARGET_OBEY_IMMUNITY | CMDTARGET_ALLOW_SELF)
if (!player) return PLUGIN_HANDLED if (!player) return PLUGIN_HANDLED
if (g_Team[player]==1 || g_Team[player]==3 /*i think 3 is team 2 in mvm..*/) { if (g_Team[player]==1 || g_Team[player]==3 /*i think 3 is team 2 in mvm..*/) {
@ -310,10 +310,10 @@ public cmdTeamOne(id,level,cid) {
} }
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH]; new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
new auth[32],auth_targ[32]; new auth[32],auth_targ[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_name(player,name_targ,31); get_user_name(player,name_targ,charsmax(name_targ));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
get_user_authid(player,auth_targ,31); get_user_authid(player,auth_targ,charsmax(auth_targ));
log_amx("Cmd: ^"%s<%d><%s><>^" marine ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ); log_amx("Cmd: ^"%s<%d><%s><>^" marine ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(player),auth_targ);
show_activity(id, name, "marine %s", name_targ); show_activity(id, name, "marine %s", name_targ);
@ -334,10 +334,10 @@ public cmdUnComm(id,level,cid) {
client_cmd(comm, "%s", g_StopCommAck); client_cmd(comm, "%s", g_StopCommAck);
new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH]; new name[MAX_NAME_LENGTH],name_targ[MAX_NAME_LENGTH];
new auth[32],auth_targ[32]; new auth[32],auth_targ[32];
get_user_name(id,name,31); get_user_name(id,name,charsmax(name));
get_user_name(comm,name_targ,31); get_user_name(comm,name_targ,charsmax(name_targ));
get_user_authid(id,auth,31); get_user_authid(id,auth,charsmax(auth));
get_user_authid(comm,auth_targ,31); get_user_authid(comm,auth_targ,charsmax(auth_targ));
log_amx("Cmd: ^"%s<%d><%s><>^" uncomm ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(comm),auth_targ); log_amx("Cmd: ^"%s<%d><%s><>^" uncomm ^"%s<%d><%s><>^"",name,get_user_userid(id),auth, name_targ,get_user_userid(comm),auth_targ);
show_activity(id, name, "uncomm %s", name_targ); show_activity(id, name, "uncomm %s", name_targ);

View File

@ -146,20 +146,20 @@ public plugin_init()
g_gametype = ns_get_gameplay(); g_gametype = ns_get_gameplay();
new clcmds_ini_file[64] new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63) get_configsdir(clcmds_ini_file, charsmax(clcmds_ini_file))
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
// initialize the ns team names // initialize the ns team names
copy(g_PrettyTeamNames[0], sizeof(g_PrettyTeamNames[]), "Ready Room"); copy(g_PrettyTeamNames[0], charsmax(g_PrettyTeamNames[]), "Ready Room");
copy(g_TeamNames[0], sizeof(g_TeamNames[]), "undefinedteam"); copy(g_TeamNames[0], charsmax(g_TeamNames[]), "undefinedteam");
copy(g_TeamCommands[0], sizeof(g_TeamCommands[]), "readyroom;readyroom"); copy(g_TeamCommands[0], charsmax(g_TeamCommands[]), "readyroom;readyroom");
copy(g_AbbreviatedTeamNames[0], sizeof(g_AbbreviatedTeamNames[]), "RR"); copy(g_AbbreviatedTeamNames[0], charsmax(g_AbbreviatedTeamNames[]), "RR");
copy(g_PrettyTeamNames[3], sizeof(g_PrettyTeamNames[]), "Spectators"); copy(g_PrettyTeamNames[3], charsmax(g_PrettyTeamNames[]), "Spectators");
copy(g_TeamNames[3], sizeof(g_TeamNames[]), "spectatorteam"); copy(g_TeamNames[3], charsmax(g_TeamNames[]), "spectatorteam");
copy(g_TeamCommands[3], sizeof(g_TeamCommands[]), "readyroom;readyroom;spectate"); copy(g_TeamCommands[3], charsmax(g_TeamCommands[]), "readyroom;readyroom;spectate");
copy(g_AbbreviatedTeamNames[3], sizeof(g_AbbreviatedTeamNames[]), "SP"); copy(g_AbbreviatedTeamNames[3], charsmax(g_AbbreviatedTeamNames[]), "SP");
if (g_gametype == NSGame_CantTell || if (g_gametype == NSGame_CantTell ||
g_gametype == NSGame_Unknown) g_gametype == NSGame_Unknown)
@ -172,39 +172,39 @@ public plugin_init()
{ {
case NSGame_MarineVAlien: case NSGame_MarineVAlien:
{ {
copy(g_TeamNames[1], sizeof(g_TeamNames[]), "marine1team"); copy(g_TeamNames[1], charsmax(g_TeamNames[]), "marine1team");
copy(g_PrettyTeamNames[1], sizeof(g_PrettyTeamNames[]), "Marines"); copy(g_PrettyTeamNames[1], charsmax(g_PrettyTeamNames[]), "Marines");
copy(g_AbbreviatedTeamNames[1], sizeof(g_AbbreviatedTeamNames[]), "M"); copy(g_AbbreviatedTeamNames[1], charsmax(g_AbbreviatedTeamNames[]), "M");
copy(g_TeamCommands[1], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamone"); copy(g_TeamCommands[1], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamone");
copy(g_TeamNames[2], sizeof(g_TeamNames[]), "alien1team"); copy(g_TeamNames[2], charsmax(g_TeamNames[]), "alien1team");
copy(g_PrettyTeamNames[2], sizeof(g_PrettyTeamNames[]), "Aliens"); copy(g_PrettyTeamNames[2], charsmax(g_PrettyTeamNames[]), "Aliens");
copy(g_AbbreviatedTeamNames[2], sizeof(g_AbbreviatedTeamNames[]), "A"); copy(g_AbbreviatedTeamNames[2], charsmax(g_AbbreviatedTeamNames[]), "A");
copy(g_TeamCommands[2], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamtwo"); copy(g_TeamCommands[2], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamtwo");
} }
case NSGame_MarineVMarine: case NSGame_MarineVMarine:
{ {
copy(g_TeamNames[1], sizeof(g_TeamNames[]), "marine1team"); copy(g_TeamNames[1], charsmax(g_TeamNames[]), "marine1team");
copy(g_PrettyTeamNames[1], sizeof(g_PrettyTeamNames[]), "Marine Team 1"); copy(g_PrettyTeamNames[1], charsmax(g_PrettyTeamNames[]), "Marine Team 1");
copy(g_AbbreviatedTeamNames[1], sizeof(g_AbbreviatedTeamNames[]), "M1"); copy(g_AbbreviatedTeamNames[1], charsmax(g_AbbreviatedTeamNames[]), "M1");
copy(g_TeamCommands[1], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamone"); copy(g_TeamCommands[1], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamone");
copy(g_TeamNames[2], sizeof(g_TeamNames[]), "marine2team"); copy(g_TeamNames[2], charsmax(g_TeamNames[]), "marine2team");
copy(g_PrettyTeamNames[2], sizeof(g_PrettyTeamNames[]), "Marine Team 2"); copy(g_PrettyTeamNames[2], charsmax(g_PrettyTeamNames[]), "Marine Team 2");
copy(g_AbbreviatedTeamNames[2], sizeof(g_AbbreviatedTeamNames[]), "M2"); copy(g_AbbreviatedTeamNames[2], charsmax(g_AbbreviatedTeamNames[]), "M2");
copy(g_TeamCommands[2], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamthree"); copy(g_TeamCommands[2], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamthree");
} }
case NSGame_AlienVAlien: case NSGame_AlienVAlien:
{ {
copy(g_TeamNames[1], sizeof(g_TeamNames[]), "alien1team"); copy(g_TeamNames[1], charsmax(g_TeamNames[]), "alien1team");
copy(g_PrettyTeamNames[1], sizeof(g_PrettyTeamNames[]), "Alien Team 1"); copy(g_PrettyTeamNames[1], charsmax(g_PrettyTeamNames[]), "Alien Team 1");
copy(g_AbbreviatedTeamNames[1], sizeof(g_AbbreviatedTeamNames[]), "A1"); copy(g_AbbreviatedTeamNames[1], charsmax(g_AbbreviatedTeamNames[]), "A1");
copy(g_TeamCommands[1], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamtwo"); copy(g_TeamCommands[1], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamtwo");
copy(g_TeamNames[2], sizeof(g_TeamNames[]), "alien2team"); copy(g_TeamNames[2], charsmax(g_TeamNames[]), "alien2team");
copy(g_PrettyTeamNames[2], sizeof(g_PrettyTeamNames[]), "Alien Team 2"); copy(g_PrettyTeamNames[2], charsmax(g_PrettyTeamNames[]), "Alien Team 2");
copy(g_AbbreviatedTeamNames[2], sizeof(g_AbbreviatedTeamNames[]), "A2"); copy(g_AbbreviatedTeamNames[2], charsmax(g_AbbreviatedTeamNames[]), "A2");
copy(g_TeamCommands[2], sizeof(g_TeamCommands[]), "readyroom;readyroom;jointeamfour"); copy(g_TeamCommands[2], charsmax(g_TeamCommands[]), "readyroom;readyroom;jointeamfour");
} }
} }
@ -306,10 +306,10 @@ public actionBanMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32] new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
new userid2 = get_user_userid(player) new userid2 = get_user_userid(player)
@ -325,7 +325,7 @@ public actionBanMenu(id, key)
else else
{ {
new tempTime[32]; new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",banTime); formatex(tempTime,charsmax(tempTime),"%d",banTime);
for (new i = 1; i <= MaxClients; i++) for (new i = 1; i <= MaxClients; i++)
{ {
show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime); show_activity_id(i, id, name, "%L %s %L", i, "BAN", name2, i, "FOR_MIN", tempTime);
@ -341,7 +341,7 @@ public actionBanMenu(id, key)
{ {
/* END OF MODIFICATIONS BY MISTAGEE */ /* END OF MODIFICATIONS BY MISTAGEE */
new ipa[32] new ipa[32]
get_user_ip(player, ipa, 31, 1) get_user_ip(player, ipa, charsmax(ipa), 1)
server_cmd("addip %d %s;writeip", banTime, ipa) server_cmd("addip %d %s;writeip", banTime, ipa)
if( g_tempBans ) if( g_tempBans )
@ -383,7 +383,7 @@ displayBanMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, "%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), "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -393,35 +393,35 @@ displayBanMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY)) if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSettings[id]) if (g_menuSettings[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "BAN_PERM")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Ban Menu") show_menu(id, keys, menuBody, -1, "Ban Menu")
} }
@ -470,7 +470,7 @@ public actionSlapMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name2[MAX_NAME_LENGTH] new name2[MAX_NAME_LENGTH]
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
if (!is_user_alive(player)) if (!is_user_alive(player))
{ {
@ -481,9 +481,9 @@ public actionSlapMenu(id, key)
new authid[32], authid2[32], name[MAX_NAME_LENGTH] new authid[32], authid2[32], name[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
new aSize = ArraySize(g_slapsettings); new aSize = ArraySize(g_slapsettings);
if (aSize > 1 && g_menuOption[id] < aSize -1) if (aSize > 1 && g_menuOption[id] < aSize -1)
@ -524,7 +524,7 @@ displaySlapMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, "%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), "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -534,37 +534,37 @@ displaySlapMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
get_user_team(i, team, 3) get_user_team(i, team, charsmax(team))
if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY)) if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, "%d. %s * %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s * %s^n", ++b, name, team)
else else
len += format(menuBody[len], 511-len, "%d. %s %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s %s^n", ++b, name, team)
} }
} }
if (g_menuOption[id] == ArraySize(g_slapsettings) - 1) 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 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]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu") show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
} }
@ -603,10 +603,10 @@ public actionKickMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
new userid2 = get_user_userid(player) new userid2 = get_user_userid(player)
@ -641,7 +641,7 @@ displayKickMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, "%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), "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
new end = start + 8 new end = start + 8
new keys = MENU_KEY_0 new keys = MENU_KEY_0
@ -651,30 +651,30 @@ displayKickMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (access(i, ADMIN_IMMUNITY)) if (access(i, ADMIN_IMMUNITY))
{ {
++b ++b
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Kick Menu") show_menu(id, keys, menuBody, -1, "Kick Menu")
} }
@ -707,10 +707,10 @@ public actionTeamMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32], authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_PrettyTeamNames[g_menuOption[id]]) log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", name, get_user_userid(id), authid, name2, get_user_userid(player), authid2, g_PrettyTeamNames[g_menuOption[id]])
@ -745,7 +745,7 @@ displayTeamMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, "%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), "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -755,34 +755,34 @@ displayTeamMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
iteam = GetNSTeam(i, team, 3) iteam = GetNSTeam(i, team, charsmax(team))
if (iteam == g_menuOption[id] || access(i, ADMIN_IMMUNITY)) if (iteam == g_menuOption[id] || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
len += format(menuBody[len], 511-len, "#. %s %s^n", name, team) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, team)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, "%d. %s * %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s * %s^n", ++b, name, team)
else else
len += format(menuBody[len], 511-len, "%d. %s %s^n", ++b, name, team) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s %s^n", ++b, name, team)
} }
} }
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_PrettyTeamNames[g_menuOption[id]]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "TRANSF_TO", g_PrettyTeamNames[g_menuOption[id]])
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Team Menu") show_menu(id, keys, menuBody, -1, "Team Menu")
} }
@ -822,14 +822,14 @@ public actionClcmdMenu(id, key)
{ {
new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32] new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32]
copy(command, 63, g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]]) copy(command, charsmax(command), g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player, authid, 31) get_user_authid(player, authid, charsmax(authid))
get_user_name(player, name, 31) get_user_name(player, name, charsmax(name))
num_to_str(get_user_userid(player), userid, 31) num_to_str(get_user_userid(player), userid, charsmax(userid))
replace(command, 63, "%userid%", userid) replace(command, charsmax(command), "%userid%", userid)
replace(command, 63, "%authid%", authid) replace(command, charsmax(command), "%authid%", authid)
replace(command, 63, "%name%", name) replace(command, charsmax(command), "%name%", name)
if (flags & 1) if (flags & 1)
{ {
@ -865,7 +865,7 @@ displayClcmdMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, "%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), "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -875,35 +875,35 @@ displayClcmdMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY)) if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSelectNum[id]) if (g_menuSelectNum[id])
len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "NO_CMDS")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Client Cmds Menu") show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
} }
@ -934,13 +934,13 @@ load_settings(szFilename[])
new text[256], szFlags[32], szAccess[32] new text[256], szFlags[32], szAccess[32]
new a, pos = 0 new a, pos = 0
while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a)) while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, charsmax(text), a))
{ {
if (text[0] == ';') continue if (text[0] == ';') continue
if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3) if (parse(text, g_clcmdName[g_clcmdNum], charsmax(g_clcmdName[]), g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd[]), szFlags, charsmax(szFlags), szAccess, charsmax(szAccess)) > 3)
{ {
while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^"")) while (replace(g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd[]), "\'", "^""))
{ {
// do nothing // do nothing
} }

View File

@ -30,7 +30,7 @@ public plugin_init() {
set_task(0.8,"timeRemain",8648458,"",0,"b") set_task(0.8,"timeRemain",8648458,"",0,"b")
new szMapName[4] new szMapName[4]
get_mapname(szMapName, 3) get_mapname(szMapName, charsmax(szMapName))
if (equal(szMapName, "co_")) { if (equal(szMapName, "co_")) {
register_event("PlayHUDNot", "roundChange", "bc", "1=0", "2>56", "2<59") register_event("PlayHUDNot", "roundChange", "bc", "1=0", "2>56", "2<59")
is_combat = true is_combat = true
@ -40,12 +40,12 @@ public plugin_init() {
public sayTheTime(id){ public sayTheTime(id){
if ( get_cvar_num("amx_time_voice") ){ if ( get_cvar_num("amx_time_voice") ){
new mhours[6], mmins[6], whours[32], wmins[32], wpm[6] new mhours[6], mmins[6], whours[32], wmins[32], wpm[6]
get_time("%H",mhours,5) get_time("%H",mhours,charsmax(mhours))
get_time("%M",mmins,5) get_time("%M",mmins,charsmax(mmins))
new mins = str_to_num(mmins) new mins = str_to_num(mmins)
new hrs = str_to_num(mhours) new hrs = str_to_num(mhours)
if (mins) if (mins)
num_to_word(mins,wmins,31) num_to_word(mins,wmins,charsmax(wmins))
else else
wmins[0] = 0 wmins[0] = 0
if (hrs < 12) if (hrs < 12)
@ -55,13 +55,13 @@ public sayTheTime(id){
wpm = "pm " wpm = "pm "
} }
if (hrs) if (hrs)
num_to_word(hrs,whours,31) num_to_word(hrs,whours,charsmax(whours))
else else
whours = "twelve " whours = "twelve "
client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"",whours,wmins,wpm ) client_cmd(id, "spk ^"fvox/time_is_now %s_period %s%s^"",whours,wmins,wpm )
} }
new ctime[64] new ctime[64]
get_time("%m/%d/%Y - %H:%M:%S",ctime,63) get_time("%m/%d/%Y - %H:%M:%S",ctime,charsmax(ctime))
client_print(0,print_chat, "The time: %s",ctime ) client_print(0,print_chat, "The time: %s",ctime )
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
@ -71,7 +71,7 @@ public sayTimeLeft(id){
new a = get_timeleft() new a = get_timeleft()
if ( get_cvar_num("amx_time_voice") ) { if ( get_cvar_num("amx_time_voice") ) {
new svoice[128] new svoice[128]
setTimeVoice( svoice , 127 , 0 , a ) setTimeVoice( svoice , charsmax(svoice) , 0 , a )
client_cmd( id , "%s", svoice ) client_cmd( id , "%s", svoice )
} }
client_print(0,print_chat, "Time Left: %d:%02d", (a / 60) , (a % 60) ) client_print(0,print_chat, "Time Left: %d:%02d", (a / 60) , (a % 60) )
@ -108,20 +108,20 @@ setTimeVoice(text[],len,flags,tmlf){
new temp[7][32] new temp[7][32]
new secs = tmlf % 60 new secs = tmlf % 60
new mins = tmlf / 60 new mins = tmlf / 60
for(new a = 0;a < 7;++a) for(new a = 0;a < sizeof(temp);++a)
temp[a][0] = 0 temp[a][0] = 0
if (secs > 0){ if (secs > 0){
num_to_word(secs,temp[4],31) num_to_word(secs,temp[4],charsmax(temp[]))
if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */ if (!(flags & 8)) temp[5] = "seconds " /* there is no "second" in default hl */
} }
if (mins > 59){ if (mins > 59){
new hours = mins / 60 new hours = mins / 60
num_to_word(hours,temp[0],31) num_to_word(hours,temp[0],charsmax(temp[]))
if (!(flags & 8)) temp[1] = "hours " if (!(flags & 8)) temp[1] = "hours "
mins = mins % 60 mins = mins % 60
} }
if (mins > 0) { if (mins > 0) {
num_to_word(mins ,temp[2],31) num_to_word(mins ,temp[2],charsmax(temp[]))
if (!(flags & 8)) temp[3] = "minutes " if (!(flags & 8)) temp[3] = "minutes "
} }
if (!(flags & 4)) temp[6] = "remaining " if (!(flags & 4)) temp[6] = "remaining "
@ -163,8 +163,8 @@ public setDisplaying(){
new arg[32], flags[32], num[32] new arg[32], flags[32], num[32]
new argc = read_argc() - 1 new argc = read_argc() - 1
for(new i; (argc > i < 32); ++i) { for(new i; (argc > i < 32); ++i) {
read_argv(i+1,arg,31) read_argv(i+1,arg,charsmax(arg))
parse(arg,flags,31,num,31) parse(arg,flags,charsmax(flags),num,charsmax(num))
g_TimeSet[i][0] = str_to_num(num) g_TimeSet[i][0] = str_to_num(num)
g_TimeSet[i][1] = read_flags(flags) g_TimeSet[i][1] = read_flags(flags)
g_TimeSet[i+1][0] = 0 g_TimeSet[i+1][0] = 0
@ -175,7 +175,7 @@ public setDisplaying(){
public timeRemain(param[]){ public timeRemain(param[]){
new gmtm = get_timeleft() new gmtm = get_timeleft()
new stimel[12] new stimel[12]
format(stimel,11,"%02d:%02d",gmtm / 60, gmtm % 60) format(stimel,charsmax(stimel),"%02d:%02d",gmtm / 60, gmtm % 60)
set_cvar_string("amx_timeleft",stimel) set_cvar_string("amx_timeleft",stimel)
if (!is_combat) if (!is_combat)
@ -196,7 +196,7 @@ public timeRemain(param[]){
new flags = g_TimeSet[tm_set][1] new flags = g_TimeSet[tm_set][1]
new arg[128] new arg[128]
if (flags & 1){ // display white text on bottom if (flags & 1){ // display white text on bottom
setTimeText(arg,127,tmlf) setTimeText(arg,charsmax(arg),tmlf)
if (flags & 16) // show/speak if current time is less than this set in parameter if (flags & 16) // show/speak if current time is less than this set in parameter
set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1) set_hudmessage(255, 255, 255, -1.0, 0.85, 0, 0.0, 1.1, 0.1, 0.5, -1)
else else
@ -204,7 +204,7 @@ public timeRemain(param[]){
show_hudmessage(0, "%s", arg) show_hudmessage(0, "%s", arg)
} }
if (flags & 2){ // use voice if (flags & 2){ // use voice
setTimeVoice(arg,127,flags,tmlf) setTimeVoice(arg,charsmax(arg),flags,tmlf)
client_cmd(0, "%s", arg) client_cmd(0, "%s", arg)
} }
} }

View File

@ -61,8 +61,8 @@ public plugin_init()
g_coloredMenus = colored_menus() g_coloredMenus = colored_menus()
new clcmds_ini_file[64] new clcmds_ini_file[64]
get_configsdir(clcmds_ini_file, 63) get_configsdir(clcmds_ini_file, charsmax(clcmds_ini_file))
format(clcmds_ini_file, 63, "%s/clcmds.ini", clcmds_ini_file) format(clcmds_ini_file, charsmax(clcmds_ini_file), "%s/clcmds.ini", clcmds_ini_file)
load_settings(clcmds_ini_file) load_settings(clcmds_ini_file)
} }
@ -118,10 +118,10 @@ public actionBanMenu(id, key)
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32] new name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH], authid[32], authid2[32]
get_user_name(player, name2, 31) get_user_name(player, name2, charsmax(name2))
get_user_authid(id, authid, 31) get_user_authid(id, authid, charsmax(authid))
get_user_authid(player, authid2, 31) get_user_authid(player, authid2, charsmax(authid2))
get_user_name(id, name, 31) get_user_name(id, name, charsmax(name))
new userid2 = get_user_userid(player) new userid2 = get_user_userid(player)
log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id]) log_amx("Ban: ^"%s<%d><%s><>^" ban and kick ^"%s<%d><%s><>^" (minutes ^"%d^")", name, get_user_userid(id), authid, name2, userid2, authid2, g_menuSettings[id])
@ -137,7 +137,7 @@ public actionBanMenu(id, key)
else else
{ {
new tempTime[32]; new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); formatex(tempTime,charsmax(tempTime),"%d",g_menuSettings[id]);
client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); client_print(0, print_chat, "%L %s: %L %s %L", LANG_PLAYER, "ADMIN", name, LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime);
} }
} }
@ -150,7 +150,7 @@ public actionBanMenu(id, key)
else else
{ {
new tempTime[32]; new tempTime[32];
formatex(tempTime,sizeof(tempTime)-1,"%d",g_menuSettings[id]); formatex(tempTime,charsmax(tempTime),"%d",g_menuSettings[id]);
client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime); client_print(0, print_chat, "%L: %L %s %L", LANG_PLAYER, "ADMIN", LANG_PLAYER, "BAN", name2, LANG_PLAYER, "FOR_MIN", tempTime);
} }
} }
@ -159,7 +159,7 @@ public actionBanMenu(id, key)
if (equal("4294967295", authid2)) if (equal("4294967295", authid2))
{ {
new ipa[32] new ipa[32]
get_user_ip(player, ipa, 31, 1) get_user_ip(player, ipa, charsmax(ipa), 1)
server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa) server_cmd("addip %d %s;writeip", g_menuSettings[id], ipa)
if( g_tempBans ) if( g_tempBans )
{ {
@ -200,7 +200,7 @@ displayBanMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "BAN_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -210,38 +210,38 @@ displayBanMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (is_user_bot(i) || access(i, ADMIN_IMMUNITY)) if (is_user_bot(i) || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSettings[id]) if (g_menuSettings[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "BAN_FOR_MIN", g_menuSettings[id])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "BAN_PERM") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "BAN_PERM")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Ban Menu") show_menu(id, keys, menuBody, -1, "Ban Menu")
} }
@ -278,7 +278,7 @@ public actionSlapMenu(id,key) {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new name2[MAX_NAME_LENGTH] new name2[MAX_NAME_LENGTH]
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
if (!is_user_alive(player)) { if (!is_user_alive(player)) {
client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2) client_print(id,print_chat,"%L",id,"CANT_PERF_DEAD",name2)
@ -288,9 +288,9 @@ public actionSlapMenu(id,key) {
new authid[32],authid2[32], name[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH]
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
if ( g_menuOption[id] ) { if ( g_menuOption[id] ) {
log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"", log_amx("Cmd: ^"%s<%d><%s><>^" slap with %d damage ^"%s<%d><%s><>^"",
@ -336,7 +336,7 @@ displaySlapMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "SLAP_SLAY_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -346,7 +346,7 @@ displaySlapMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
new iteam = get_user_team(i) new iteam = get_user_team(i)
if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY)) if (!is_user_alive(i) || access(i, ADMIN_IMMUNITY))
@ -354,31 +354,31 @@ displaySlapMenu(id, pos)
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
else else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, g_teamNames[iteam])
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam])
else else
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam])
} }
} }
if (g_menuOption[id]) if (g_menuOption[id])
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "SLAP_WITH_DMG", g_menuSettings[id])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "SLAY") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "SLAY")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Slap/Slay Menu") show_menu(id, keys, menuBody, -1, "Slap/Slay Menu")
} }
@ -407,10 +407,10 @@ public actionKickMenu(id,key)
new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 8 + key]
new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
new userid2 = get_user_userid(player) new userid2 = get_user_userid(player)
log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"", log_amx("Kick: ^"%s<%d><%s><>^" kick ^"%s<%d><%s><>^"",
@ -446,7 +446,7 @@ displayKickMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0))) new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "KICK_MENU", pos + 1, (g_menuPlayersNum[id] / 8 + ((g_menuPlayersNum[id] % 8) ? 1 : 0)))
new end = start + 8 new end = start + 8
new keys = MENU_KEY_0 new keys = MENU_KEY_0
@ -456,33 +456,33 @@ displayKickMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (access(i, ADMIN_IMMUNITY)) if (access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Kick Menu") show_menu(id, keys, menuBody, -1, "Kick Menu")
} }
@ -510,10 +510,10 @@ public actionTeamMenu(id,key) {
default: { default: {
new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key] new player = g_menuPlayers[id][g_menuPosition[id] * 7 + key]
new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH] new authid[32],authid2[32], name[MAX_NAME_LENGTH], name2[MAX_NAME_LENGTH]
get_user_name(player,name2,31) get_user_name(player,name2,charsmax(name2))
get_user_authid(id,authid,31) get_user_authid(id,authid,charsmax(authid))
get_user_authid(player,authid2,31) get_user_authid(player,authid2,charsmax(authid2))
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")", log_amx("Cmd: ^"%s<%d><%s><>^" transfer ^"%s<%d><%s><>^" (team ^"%s^")",
name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_teamNames[g_menuOption[id]] ) name,get_user_userid(id),authid, name2,get_user_userid(player),authid2, g_teamNames[g_menuOption[id]] )
@ -522,8 +522,8 @@ public actionTeamMenu(id,key) {
case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TRANSF_1", name2, g_teamNames[g_menuOption[id]]) case 1: client_print(0, print_chat, "%L", LANG_PLAYER, "ADMIN_TRANSF_1", name2, g_teamNames[g_menuOption[id]])
} }
new szCmd[2] new szCmd[3]
format(szCmd,2,"%d",g_menuOption[id]) format(szCmd,charsmax(szCmd),"%d",g_menuOption[id])
tfc_userkill(player) tfc_userkill(player)
if (g_menuOption[id] == 5) if (g_menuOption[id] == 5)
{ {
@ -555,7 +555,7 @@ displayTeamMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "TEAM_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -565,7 +565,7 @@ displayTeamMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
iteam = get_user_team(i) iteam = get_user_team(i)
if ((iteam == g_menuOption[id]) || access(i, ADMIN_IMMUNITY)) if ((iteam == g_menuOption[id]) || access(i, ADMIN_IMMUNITY))
@ -573,28 +573,28 @@ displayTeamMenu(id, pos)
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s\R%s^n\w", b, name, g_teamNames[iteam])
else else
len += format(menuBody[len], 511-len, "#. %s %s^n", name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s %s^n", name, g_teamNames[iteam])
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*\y\R%s^n\w" : "%d. %s * %s^n", ++b, name, g_teamNames[iteam])
else else
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam]) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s\y\R%s^n\w" : "%d. %s %s^n", ++b, name, g_teamNames[iteam])
} }
} }
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "TRANSF_TO", g_teamNames[g_menuOption[id]]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "TRANSF_TO", g_teamNames[g_menuOption[id]])
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Team Menu") show_menu(id, keys, menuBody, -1, "Team Menu")
} }
@ -627,13 +627,13 @@ public actionClcmdMenu(id,key) {
new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1] new flags = g_clcmdMisc[g_menuSelect[id][g_menuOption[id]]][1]
if (is_user_connected(player)) { if (is_user_connected(player)) {
new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32] new command[64], authid[32], name[MAX_NAME_LENGTH], userid[32]
copy(command,63,g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]]) copy(command,charsmax(command),g_clcmdCmd[g_menuSelect[id][g_menuOption[id]]])
get_user_authid(player,authid,31) get_user_authid(player,authid,charsmax(authid))
get_user_name(player,name,31) get_user_name(player,name,charsmax(name))
num_to_str(get_user_userid(player),userid,31) num_to_str(get_user_userid(player),userid,charsmax(userid))
replace(command,63,"%userid%",userid) replace(command,charsmax(command),"%userid%",userid)
replace(command,63,"%authid%",authid) replace(command,charsmax(command),"%authid%",authid)
replace(command,63,"%name%",name) replace(command,charsmax(command),"%name%",name)
if (flags & 1) { if (flags & 1) {
server_cmd("%s", command) server_cmd("%s", command)
server_exec() server_exec()
@ -665,7 +665,7 @@ displayClcmdMenu(id, pos)
if (start >= g_menuPlayersNum[id]) if (start >= g_menuPlayersNum[id])
start = pos = g_menuPosition[id] = 0 start = pos = g_menuPosition[id] = 0
new len = format(menuBody, 511, g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0))) new len = format(menuBody, charsmax(menuBody), g_coloredMenus ? "\y%L\R%d/%d^n\w^n" : "%L %d/%d^n^n", id, "CL_CMD_MENU", pos + 1, (g_menuPlayersNum[id] / 7 + ((g_menuPlayersNum[id] % 7) ? 1 : 0)))
new end = start + 7 new end = start + 7
new keys = MENU_KEY_0|MENU_KEY_8 new keys = MENU_KEY_0|MENU_KEY_8
@ -675,38 +675,38 @@ displayClcmdMenu(id, pos)
for (new a = start; a < end; ++a) for (new a = start; a < end; ++a)
{ {
i = g_menuPlayers[id][a] i = g_menuPlayers[id][a]
get_user_name(i, name, 31) get_user_name(i, name, charsmax(name))
if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY)) if (!g_menuSelectNum[id] || access(i, ADMIN_IMMUNITY))
{ {
++b ++b
if (g_coloredMenus) if (g_coloredMenus)
len += format(menuBody[len], 511-len, "\d%d. %s^n\w", b, name) len += format(menuBody[len], charsmax(menuBody)-len, "\d%d. %s^n\w", b, name)
else else
len += format(menuBody[len], 511-len, "#. %s^n", name) len += format(menuBody[len], charsmax(menuBody)-len, "#. %s^n", name)
} else { } else {
keys |= (1<<b) keys |= (1<<b)
if (is_user_admin(i)) if (is_user_admin(i))
len += format(menuBody[len], 511-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, g_coloredMenus ? "%d. %s \r*^n\w" : "%d. %s *^n", ++b, name)
else else
len += format(menuBody[len], 511-len, "%d. %s^n", ++b, name) len += format(menuBody[len], charsmax(menuBody)-len, "%d. %s^n", ++b, name)
} }
} }
if (g_menuSelectNum[id]) if (g_menuSelectNum[id])
len += format(menuBody[len], 511-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]]) len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %s^n", g_clcmdName[g_menuSelect[id][g_menuOption[id]]])
else else
len += format(menuBody[len], 511-len, "^n8. %L^n", id, "NO_CMDS") len += format(menuBody[len], charsmax(menuBody)-len, "^n8. %L^n", id, "NO_CMDS")
if (end != g_menuPlayersNum[id]) if (end != g_menuPlayersNum[id])
{ {
format(menuBody[len], 511-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n9. %L...^n0. %L", id, "MORE", id, pos ? "BACK" : "EXIT")
keys |= MENU_KEY_9 keys |= MENU_KEY_9
} }
else else
format(menuBody[len], 511-len, "^n0. %L", id, pos ? "BACK" : "EXIT") format(menuBody[len], charsmax(menuBody)-len, "^n0. %L", id, pos ? "BACK" : "EXIT")
show_menu(id, keys, menuBody, -1, "Client Cmds Menu") show_menu(id, keys, menuBody, -1, "Client Cmds Menu")
} }
@ -739,13 +739,13 @@ load_settings(szFilename[])
new text[256], szFlags[32], szAccess[32] new text[256], szFlags[32], szAccess[32]
new a, pos = 0 new a, pos = 0
while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, 255, a)) while (g_clcmdNum < MAX_CLCMDS && read_file(szFilename, pos++, text, charsmax(text), a))
{ {
if (text[0] == ';') continue if (text[0] == ';') continue
if (parse(text, g_clcmdName[g_clcmdNum], 31, g_clcmdCmd[g_clcmdNum], 63, szFlags, 31, szAccess, 31) > 3) if (parse(text, g_clcmdName[g_clcmdNum], charsmax(g_clcmdName[]), g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd[]), szFlags, charsmax(szFlags), szAccess, charsmax(szAccess)) > 3)
{ {
while (replace(g_clcmdCmd[g_clcmdNum], 63, "\'", "^"")) while (replace(g_clcmdCmd[g_clcmdNum], charsmax(g_clcmdCmd[]), "\'", "^""))
{ {
// do nothing // do nothing
} }

View File

@ -222,19 +222,19 @@ public cmdStatsMe(id){
displayStats(id,dest) { displayStats(id,dest) {
new name[32], stats[8], body[8] new name[32], stats[8], body[8]
get_user_wstats(id,0,stats,body) get_user_wstats(id,0,stats,body)
new pos = format(g_Buffer,2047,"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n", new pos = format(g_Buffer,charsmax(g_Buffer),"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n",
stats[0],stats[1],stats[3],stats[6],stats[5],stats[4]) stats[0],stats[1],stats[3],stats[6],stats[5],stats[4])
new a new a
for( a = 1; a < TFCMAX_WEAPONS; a++) { for( a = 1; a < TFCMAX_WEAPONS; a++) {
if (get_user_wstats(id,a,stats,body)){ if (get_user_wstats(id,a,stats,body)){
if ( xmod_is_melee_wpn(a) ) if ( xmod_is_melee_wpn(a) )
stats[4] = -1; stats[4] = -1;
xmod_get_wpnname(a,name,31) xmod_get_wpnname(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s shots: %d hits: %d damage: %d kills: %d deaths: %d^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s shots: %d hits: %d damage: %d kills: %d deaths: %d^n",
name,stats[4],stats[5],stats[6],stats[0],stats[1]) name,stats[4],stats[5],stats[6],stats[0],stats[1])
} }
} }
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
} }
@ -250,13 +250,13 @@ public cmdRank(id){
displayRank(id,dest) { displayRank(id,dest) {
new name[MAX_NAME_LENGTH], stats[8], body[8] new name[MAX_NAME_LENGTH], stats[8], body[8]
new rank_pos = get_user_stats(id,stats,body) new rank_pos = get_user_stats(id,stats,body)
new pos = format(g_Buffer,2047,"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n", new pos = format(g_Buffer,charsmax(g_Buffer),"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n",
stats[0],stats[1],stats[3],stats[6],stats[5],stats[4]) stats[0],stats[1],stats[3],stats[6],stats[5],stats[4])
pos += format(g_Buffer[pos],2047-pos,"Hits:^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"Hits:^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n^n",
g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4], g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7]) g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
format(g_Buffer[pos],2047-pos,"%s rank is %d of %d",(id==dest)?"Your":"His", rank_pos,get_statsnum()) format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s rank is %d of %d",(id==dest)?"Your":"His", rank_pos,get_statsnum())
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
} }
@ -273,14 +273,14 @@ public cmdTop15(id) {
/* get top 15 */ /* get top 15 */
getTop15(){ getTop15(){
new stats[8], body[8], name[MAX_NAME_LENGTH] new stats[8], body[8], name[MAX_NAME_LENGTH]
new pos = copy(g_Buffer,2047,"# nick kills/deaths TKs hits/shots/headshots^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"# nick kills/deaths TKs hits/shots/headshots^n")
new imax = get_statsnum() new imax = get_statsnum()
if (imax > 15) imax = 15 if (imax > 15) imax = 15
for(new a = 0; a < imax; ++a){ for(new a = 0; a < imax; ++a){
get_stats(a,stats,body,name,31) get_stats(a,stats,body,name,charsmax(name))
replace_all(name, 31, "<", "[") replace_all(name, charsmax(name), "<", "[")
replace_all(name, 31, ">", "]") replace_all(name, charsmax(name), ">", "]")
pos += format(g_Buffer[pos],2047-pos,"%2d. %-28.27s %d/%d %d %d/%d/%d^n",a+1,name,stats[0],stats[1],stats[3],stats[5],stats[4],stats[2]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%2d. %-28.27s %d/%d %d %d/%d/%d^n",a+1,name,stats[0],stats[1],stats[3],stats[5],stats[4],stats[2])
} }
} }
@ -319,17 +319,17 @@ public cmdStats(id){
/* build list of attackers */ /* build list of attackers */
getAttackers(id) { getAttackers(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0
new pos = copy(g_Buffer,2047,"Attackers:^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"Attackers:^n")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_astats(id,a,stats,body,wpn,31)){ if(get_user_astats(id,a,stats,body,wpn,charsmax(wpn))){
found = 1 found = 1
if (stats[0]) if (stats[0])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn)
} }
} }
return found return found
@ -339,16 +339,16 @@ getAttackers(id) {
/* build list of victims */ /* build list of victims */
getVictims(id) { getVictims(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0
new pos = copy(g_Buffer,2047,"Victims:^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"Victims:^n")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_vstats(id,a,stats,body,wpn,31)){ if(get_user_vstats(id,a,stats,body,wpn,charsmax(wpn))){
found = 1 found = 1
if (stats[1]) if (stats[1])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn)
} }
} }
return found return found
@ -359,22 +359,22 @@ getHits(id,killer) {
new stats[8], body[8], pos = 0 new stats[8], body[8], pos = 0
g_Buffer[0] = 0 g_Buffer[0] = 0
get_user_astats(id,killer,stats,body) get_user_astats(id,killer,stats,body)
for(new a = 1; a < 8; ++a) for(new a = 1; a < sizeof(body); ++a)
if(body[a]) if(body[a])
pos += format(g_Buffer[pos],2047-pos,"%s: %d^n",g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s: %d^n",g_bodyParts[a],body[a])
} }
/* build list of hits for say hp */ /* build list of hits for say hp */
getMyHits(id,killed) { getMyHits(id,killed) {
new name[MAX_NAME_LENGTH], stats[8], body[8], found = 0 new name[MAX_NAME_LENGTH], stats[8], body[8], found = 0
get_user_name(killed,name,31) get_user_name(killed,name,charsmax(name))
new pos = format(g_Buffer,2047,"You hit %s in:",name) new pos = format(g_Buffer,charsmax(g_Buffer),"You hit %s in:",name)
get_user_vstats(id,killed,stats,body) get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){ for(new a = 1; a < sizeof(body); ++a){
if(body[a]){ if(body[a]){
found = 1 found = 1
pos += format(g_Buffer[pos],2047-pos," %s: %d ",g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos," %s: %d ",g_bodyParts[a],body[a])
} }
} }
return found return found
@ -390,9 +390,9 @@ public cmdKiller(id) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (g_Killers[id][0]) { if (g_Killers[id][0]) {
new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[33], mstats[8], mbody[8] new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[32], mstats[8], mbody[8]
get_user_name(g_Killers[id][0],name,31) get_user_name(g_Killers[id][0],name,charsmax(name))
get_user_astats(id,g_Killers[id][0],stats,body,wpn,31) get_user_astats(id,g_Killers[id][0],stats,body,wpn,charsmax(wpn))
client_print(id,print_chat,"%s killed you with %s from distance of %.2f meters", name,wpn,float(g_Killers[id][3]) * 0.0254 ) client_print(id,print_chat,"%s killed you with %s from distance of %.2f meters", name,wpn,float(g_Killers[id][3]) * 0.0254 )
client_print(id,print_chat,"He did %d damage to you with %d hit%s and still had %dhp and %dap", client_print(id,print_chat,"He did %d damage to you with %d hit%s and still had %dhp and %dap",
stats[6],stats[5],(stats[5]==1)?"":"s" , g_Killers[id][1],g_Killers[id][2] ) stats[6],stats[5],(stats[5]==1)?"":"s" , g_Killers[id][1],g_Killers[id][2] )
@ -441,22 +441,22 @@ showStatsMenu(id,pos){
get_players(g_userPlayers[id],inum) get_players(g_userPlayers[id],inum)
if (start >= inum) start = pos = g_userPosition[id] = 0 if (start >= inum) start = pos = g_userPosition[id] = 0
new len = format(menu_body,511,"Server Stats %d/%d^n^n",pos + 1,((inum/max_menupos)+((inum%max_menupos)?1:0))) new len = format(menu_body,charsmax(menu_body),"Server Stats %d/%d^n^n",pos + 1,((inum/max_menupos)+((inum%max_menupos)?1:0)))
new name[MAX_NAME_LENGTH], end = start + max_menupos, keys = (1<<9)|(1<<7) new name[MAX_NAME_LENGTH], end = start + max_menupos, keys = (1<<9)|(1<<7)
if (end > inum) end = inum if (end > inum) end = inum
for(new a = start; a < end; ++a){ for(new a = start; a < end; ++a){
get_user_name(g_userPlayers[id][a],name,31) get_user_name(g_userPlayers[id][a],name,charsmax(name))
keys |= (1<<k) keys |= (1<<k)
len += format(menu_body[len],511-len,"%d. %s^n",++k,name) len += format(menu_body[len],charsmax(menu_body)-len,"%d. %s^n",++k,name)
} }
len += format(menu_body[len],511-len,"^n8. %s^n",g_userState[id] ? "Show rank" : "Show stats" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n8. %s^n",g_userState[id] ? "Show rank" : "Show stats" )
if (end != inum){ if (end != inum){
len += format(menu_body[len],511-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" )
keys |= (1<<8) keys |= (1<<8)
} }
else len += format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" ) else len += format(menu_body[len],charsmax(menu_body)-len,"^n0. %s" , pos ? "Back" : "Exit" )
show_menu(id,keys,menu_body) show_menu(id,keys,menu_body)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
@ -481,7 +481,7 @@ public client_damage(attacker,victim,damage,wpnindex,hitplace,TA){
/* save state at death */ /* save state at death */
public client_death(killer,victim,wpnindex,hitplace,TK){ public client_death(killer,victim,wpnindex,hitplace,TK){
new killer_name[MAX_NAME_LENGTH] new killer_name[MAX_NAME_LENGTH]
get_user_name(killer,killer_name,31) get_user_name(killer,killer_name,charsmax(killer_name))
if ( KillingStreak || KillingStreakSound ){ if ( KillingStreak || KillingStreakSound ){
g_streakKills[ victim ][ 1 ]++ g_streakKills[ victim ][ 1 ]++
@ -493,7 +493,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
new selfKill = ( killer == victim ) ? 1:0 new selfKill = ( killer == victim ) ? 1:0
new victim_name[MAX_NAME_LENGTH] new victim_name[MAX_NAME_LENGTH]
get_user_name(victim,victim_name,31) get_user_name(victim,victim_name,charsmax(victim_name))
new Float:statstime = get_cvar_float("tfcstats_statstime") new Float:statstime = get_cvar_float("tfcstats_statstime")
@ -527,9 +527,9 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
if ( ShowKiller && !(!get_cvar_num("tfcstats_rankbots") && (is_user_bot(killer) || is_user_bot(killer))) ){ if ( ShowKiller && !(!get_cvar_num("tfcstats_rankbots") && (is_user_bot(killer) || is_user_bot(killer))) ){
new stats[8], body[8], wpn[33], mstats[8], mbody[8] new stats[8], body[8], wpn[32], mstats[8], mbody[8]
get_user_astats(victim,killer,stats,body,wpn,31) get_user_astats(victim,killer,stats,body,wpn,charsmax(wpn))
get_user_vstats(victim,killer,mstats,mbody) get_user_vstats(victim,killer,mstats,mbody)
set_hudmessage(220,80,0,0.05,0.15,0, statstime, 12.0, 1.0, 2.0, -1) set_hudmessage(220,80,0,0.05,0.15,0, statstime, 12.0, 1.0, 2.0, -1)
getHits(victim,killer) getHits(victim,killer)
@ -540,7 +540,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
if ( KillerHp ){ if ( KillerHp ){
new kmsg[128] new kmsg[128]
format(kmsg,127,"%s still has %dhp and %d ap",killer_name,g_Killers[victim][1],g_Killers[victim][1]) format(kmsg,charsmax(kmsg),"%s still has %dhp and %d ap",killer_name,g_Killers[victim][1],g_Killers[victim][1])
client_print(victim,print_console, "%s", kmsg) client_print(victim,print_console, "%s", kmsg)
set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1) set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1)
show_hudmessage(victim, "%s", kmsg) show_hudmessage(victim, "%s", kmsg)
@ -572,7 +572,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
new param[2] new param[2]
param[0] = killer param[0] = killer
param[1] = g_multiKills[killer][0] param[1] = g_multiKills[killer][0]
set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,2) set_task( 4.0 + float( param[1] ) ,"checkKills",0,param,sizeof(param))
} }
if ( xmod_is_melee_wpn(wpnindex) && ( KnifeKill || KnifeKillSound ) ){ if ( xmod_is_melee_wpn(wpnindex) && ( KnifeKill || KnifeKillSound ) ){
@ -601,11 +601,11 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){ if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){
if ( HeadShotKill ){ if ( HeadShotKill ){
new weapon[32], message[256] new weapon[32], message[256]
xmod_get_wpnname(wpnindex,weapon,31) xmod_get_wpnname(wpnindex,weapon,charsmax(weapon))
copy( message, sizeof(message)-1, g_HeadShots[ random_num(0,6) ] ) copy( message, charsmax(message), g_HeadShots[ random_num(0,6) ] )
replace( message, sizeof(message)-1, "$vn", victim_name ) replace( message, charsmax(message), "$vn", victim_name )
replace( message, sizeof(message)-1, "$wn", weapon ) replace( message, charsmax(message), "$wn", weapon )
replace( message, sizeof(message)-1, "$kn", killer_name ) replace( message, charsmax(message), "$kn", killer_name )
set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, -1) set_hudmessage(100, 100, 255, -1.0, 0.19, 0, 6.0, 6.0, 0.5, 0.15, -1)
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){
if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() )
@ -642,13 +642,13 @@ public showDoubleKill(){
if ( DoubleKill ) { if ( DoubleKill ) {
new name[MAX_NAME_LENGTH],message[128] new name[MAX_NAME_LENGTH],message[128]
get_user_name(g_prevKillerId,name,31) get_user_name(g_prevKillerId,name,charsmax(name))
copy( message, 127, g_DoubleKillMsg[pos] ) copy( message, charsmax(message), g_DoubleKillMsg[pos] )
replace( message, 127 , "$kn", name ) replace( message, charsmax(message) , "$kn", name )
if ( pos == 2 ){ if ( pos == 2 ){
new kills[3] new kills[3]
num_to_str(g_KillCount,kills,2) num_to_str(g_KillCount,kills,charsmax(kills))
replace( message, 127 , "$kk", kills ) replace( message, charsmax(message) , "$kk", kills )
} }
set_hudmessage(65, 102, 158, -1.0, 0.25, 0, 6.0, 6.0, 0.5, 0.15, -1) set_hudmessage(65, 102, 158, -1.0, 0.25, 0, 6.0, 6.0, 0.5, 0.15, -1)
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){
@ -671,7 +671,7 @@ public checkKills(param[]){
if ( a > -1 ){ if ( a > -1 ){
if ( MultiKill ) { if ( MultiKill ) {
new name[MAX_NAME_LENGTH] new name[MAX_NAME_LENGTH]
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1) set_hudmessage(255, 0, 100, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, -1)
if ( a > 6 ) a = 6 if ( a > 6 ) a = 6
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){

View File

@ -25,12 +25,12 @@ public client_disconnect(id) {
remove_task( id ) remove_task( id )
new szTeam[16],szName[MAX_NAME_LENGTH],szAuthid[32], iStats[8], iHits[8], szWeapon[24] new szTeam[16],szName[MAX_NAME_LENGTH],szAuthid[32], iStats[8], iHits[8], szWeapon[24]
new iUserid = get_user_userid( id ) new iUserid = get_user_userid( id )
get_user_team(id, szTeam, 15 ) get_user_team(id, szTeam, charsmax(szTeam) )
get_user_name(id, szName ,31 ) get_user_name(id, szName , charsmax(szName) )
get_user_authid(id, szAuthid , 31 ) get_user_authid(id, szAuthid , charsmax(szAuthid) )
for(new i = 1 ; i < TFCMAX_WEAPONS ; ++i ) { for(new i = 1 ; i < TFCMAX_WEAPONS ; ++i ) {
if( get_user_wstats( id , i ,iStats , iHits ) ) { if( get_user_wstats( id , i ,iStats , iHits ) ) {
xmod_get_wpnlogname( i , szWeapon , 23 ) xmod_get_wpnlogname( i , szWeapon , charsmax(szWeapon) )
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1]) szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], iStats[2],iStats[3],iStats[6],iStats[1])

View File

@ -167,18 +167,18 @@ public cmdStatsMe(id){
public displayStats(id,dest) { public displayStats(id,dest) {
new name[32], stats[8], body[8] new name[32], stats[8], body[8]
get_user_wstats(id,0,stats,body) get_user_wstats(id,0,stats,body)
new pos = format(g_Buffer,2047,"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n", new pos = format(g_Buffer,charsmax(g_Buffer),"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n",
stats[0],stats[1],stats[3],stats[6],stats[5],stats[4]) stats[0],stats[1],stats[3],stats[6],stats[5],stats[4])
for(new a = 1; a < TSMAX_WEAPONS; ++a) { for(new a = 1; a < TSMAX_WEAPONS; ++a) {
if (get_user_wstats(id,a,stats,body)){ if (get_user_wstats(id,a,stats,body)){
if ( xmod_is_melee_wpn(a) ) if ( xmod_is_melee_wpn(a) )
stats[4] = -1; stats[4] = -1;
xmod_get_wpnname(a,name,31) xmod_get_wpnname(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s shots: %d hits: %d damage: %d kills: %d deaths: %d^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s shots: %d hits: %d damage: %d kills: %d deaths: %d^n",
name,stats[4],stats[5],stats[6],stats[0],stats[1]) name,stats[4],stats[5],stats[6],stats[0],stats[1])
} }
} }
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
} }
@ -193,15 +193,15 @@ public cmdRank(id){
} }
displayRank(id,dest) { displayRank(id,dest) {
new name[32], stats[8], body[8] new name[MAX_NAME_LENGTH], stats[8], body[8]
new rank_pos = get_user_stats(id,stats,body) new rank_pos = get_user_stats(id,stats,body)
new pos = format(g_Buffer,2047,"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n", new pos = format(g_Buffer,charsmax(g_Buffer),"Kills: %d^nDeaths: %d^nTKs: %d^nDamage: %d^nHits: %d^nShots: %d^n^n",
stats[0],stats[1],stats[3],stats[6],stats[5],stats[4]) stats[0],stats[1],stats[3],stats[6],stats[5],stats[4])
pos += format(g_Buffer[pos],2047-pos,"Hits:^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n^n", pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"Hits:^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n%s: %d^n^n",
g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4], g_bodyParts[1],body[1],g_bodyParts[2],body[2],g_bodyParts[3],body[3], g_bodyParts[4],body[4],
g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7]) g_bodyParts[5],body[5],g_bodyParts[6],body[6],g_bodyParts[7],body[7])
format(g_Buffer[pos],2047-pos,"%s rank is %d of %d",(id==dest)?"Your":"His", rank_pos,get_statsnum()) format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s rank is %d of %d",(id==dest)?"Your":"His", rank_pos,get_statsnum())
get_user_name(id,name,31) get_user_name(id,name,charsmax(name))
show_motd(dest,g_Buffer,name) show_motd(dest,g_Buffer,name)
} }
@ -218,14 +218,14 @@ public cmdTop15(id) {
/* get top 15 */ /* get top 15 */
getTop15(){ getTop15(){
new stats[8], body[8], name[MAX_NAME_LENGTH] new stats[8], body[8], name[MAX_NAME_LENGTH]
new pos = copy(g_Buffer,2047,"# nick kills/deaths TKs hits/shots/headshots^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"# nick kills/deaths TKs hits/shots/headshots^n")
new imax = get_statsnum() new imax = get_statsnum()
if (imax > 15) imax = 15 if (imax > 15) imax = 15
for(new a = 0; a < imax; ++a){ for(new a = 0; a < imax; ++a){
get_stats(a,stats,body,name,31) get_stats(a,stats,body,name,charsmax(name))
replace_all(name, 31, "<", "[") replace_all(name, charsmax(name), "<", "[")
replace_all(name, 31, ">", "]") replace_all(name, charsmax(name), ">", "]")
pos += format(g_Buffer[pos],2047-pos,"%2d. %-28.27s %d/%d %d %d/%d/%d^n",a+1,name,stats[0],stats[1],stats[3],stats[5],stats[4],stats[2]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%2d. %-28.27s %d/%d %d %d/%d/%d^n",a+1,name,stats[0],stats[1],stats[3],stats[5],stats[4],stats[2])
} }
} }
@ -261,16 +261,16 @@ public cmdStats(id){
/* build list of attackers */ /* build list of attackers */
getAttackers(id) { getAttackers(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0
new pos = copy(g_Buffer,2047,"Attackers:^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"Attackers:^n")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_astats(id,a,stats,body,wpn,31)){ if(get_user_astats(id,a,stats,body,wpn,charsmax(wpn))){
found = 1 found = 1
if (stats[0]) if (stats[0])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn)
} }
} }
return found return found
@ -279,16 +279,16 @@ getAttackers(id) {
/* build list of victims */ /* build list of victims */
getVictims(id) { getVictims(id) {
new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0 new name[MAX_NAME_LENGTH],wpn[32], stats[8],body[8],found=0
new pos = copy(g_Buffer,2047,"Victims:^n") new pos = copy(g_Buffer,charsmax(g_Buffer),"Victims:^n")
for(new a = 1; a <= MaxClients; ++a){ for(new a = 1; a <= MaxClients; ++a){
if(get_user_vstats(id,a,stats,body,wpn,31)){ if(get_user_vstats(id,a,stats,body,wpn,charsmax(wpn))){
found = 1 found = 1
if (stats[1]) if (stats[1])
format(wpn,31," -- %s",wpn) format(wpn,charsmax(wpn)," -- %s",wpn)
else else
wpn[0] = 0 wpn[0] = 0
get_user_name(a,name,31) get_user_name(a,name,charsmax(name))
pos += format(g_Buffer[pos],2047-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s -- %d dmg / %d hit(s)%s^n",name,stats[6],stats[5],wpn)
} }
} }
return found return found
@ -299,22 +299,22 @@ getHits(id,killer) {
new stats[8], body[8], pos = 0 new stats[8], body[8], pos = 0
g_Buffer[0] = 0 g_Buffer[0] = 0
get_user_astats(id,killer,stats,body) get_user_astats(id,killer,stats,body)
for(new a = 1; a < 8; ++a) for(new a = 1; a < sizeof(body); ++a)
if(body[a]) if(body[a])
pos += format(g_Buffer[pos],2047-pos,"%s: %d^n",g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos,"%s: %d^n",g_bodyParts[a],body[a])
} }
/* build list of hits for say hp */ /* build list of hits for say hp */
getMyHits(id,killed) { getMyHits(id,killed) {
new name[MAX_NAME_LENGTH], stats[8], body[8], found = 0 new name[MAX_NAME_LENGTH], stats[8], body[8], found = 0
get_user_name(killed,name,31) get_user_name(killed,name,charsmax(name))
new pos = format(g_Buffer,2047,"You hit %s in:",name) new pos = format(g_Buffer,charsmax(g_Buffer),"You hit %s in:",name)
get_user_vstats(id,killed,stats,body) get_user_vstats(id,killed,stats,body)
for(new a = 1; a < 8; ++a){ for(new a = 1; a < sizeof(body); ++a){
if(body[a]){ if(body[a]){
found = 1 found = 1
pos += format(g_Buffer[pos],2047-pos," %s: %d ",g_bodyParts[a],body[a]) pos += format(g_Buffer[pos],charsmax(g_Buffer)-pos," %s: %d ",g_bodyParts[a],body[a])
} }
} }
return found return found
@ -324,7 +324,7 @@ public client_damage(attacker,victim,damage,wpnindex,hitplace,TA) {
if ( TA ){ if ( TA ){
if ( TAInfo && is_user_alive(victim) ){ if ( TAInfo && is_user_alive(victim) ){
new attacker_name[MAX_NAME_LENGTH] new attacker_name[MAX_NAME_LENGTH]
get_user_name(attacker,attacker_name,31) get_user_name(attacker,attacker_name,charsmax(attacker_name))
client_print(0,print_chat,"%s attacked a teammate",attacker_name) client_print(0,print_chat,"%s attacked a teammate",attacker_name)
} }
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
@ -341,7 +341,7 @@ public client_damage(attacker,victim,damage,wpnindex,hitplace,TA) {
public client_death(killer,victim,wpnindex,hitplace,TK){ public client_death(killer,victim,wpnindex,hitplace,TK){
new killer_name[MAX_NAME_LENGTH] new killer_name[MAX_NAME_LENGTH]
get_user_name(killer,killer_name,31) get_user_name(killer,killer_name,charsmax(killer_name))
if ( TK ){ if ( TK ){
if ( TAInfo ){ if ( TAInfo ){
@ -355,7 +355,7 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
new headshot = ( hitplace == HIT_HEAD ) ? 1:0 new headshot = ( hitplace == HIT_HEAD ) ? 1:0
new victim_name[MAX_NAME_LENGTH] new victim_name[MAX_NAME_LENGTH]
get_user_name(victim,victim_name,31) get_user_name(victim,victim_name,charsmax(victim_name))
if ( killer == victim ){ if ( killer == victim ){
if ( grenade && GrenadeSuicide ){ if ( grenade && GrenadeSuicide ){
@ -390,11 +390,11 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
else if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){ else if ( headshot && (HeadShotKill || HeadShotKillSound) && !xmod_is_melee_wpn(wpnindex) ){
if ( HeadShotKill ){ if ( HeadShotKill ){
new weapon[32], message[256] new weapon[32], message[256]
xmod_get_wpnname(wpnindex,weapon,31) xmod_get_wpnname(wpnindex,weapon,charsmax(weapon))
copy( message, sizeof(message)-1, g_HeadShots[ random_num(0,6) ] ) copy( message, charsmax(message), g_HeadShots[ random_num(0,6) ] )
replace( message, sizeof(message)-1, "$vn", victim_name ) replace( message, charsmax(message), "$vn", victim_name )
replace( message, sizeof(message)-1 , "$wn", weapon ) replace( message, charsmax(message), "$wn", weapon )
replace( message, sizeof(message)-1, "$kn", killer_name ) replace( message, charsmax(message), "$kn", killer_name )
set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, -1) set_hudmessage(100, 100, 255, -1.0, 0.29, 0, 6.0, 6.0, 0.5, 0.15, -1)
for (new i=1;i<=MaxClients;i++){ for (new i=1;i<=MaxClients;i++){
if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() ) if ( g_Killers[i][0] && g_DeathStats[i] > get_gametime() )
@ -420,26 +420,26 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
if ( FragInfo ){ if ( FragInfo ){
new kmsg[128] new kmsg[128]
new pos = format(kmsg,63,"LastKill: %d frag(s)^n",ts_getuserlastfrag(killer)) new pos = format(kmsg,charsmax(kmsg),"LastKill: %d frag(s)^n",ts_getuserlastfrag(killer))
if ( killFlags ){ if ( killFlags ){
pos += format(kmsg[pos],128-pos,"[") pos += format(kmsg[pos],charsmax(kmsg)-pos,"[")
if ( killFlags & TSKF_STUNTKILL ) if ( killFlags & TSKF_STUNTKILL )
pos += format(kmsg[pos],128-pos," stunt ") pos += format(kmsg[pos],charsmax(kmsg)-pos," stunt ")
if ( killFlags & TSKF_SLIDINGKILL ) if ( killFlags & TSKF_SLIDINGKILL )
pos += format(kmsg[pos],128-pos," sliding ") pos += format(kmsg[pos],charsmax(kmsg)-pos," sliding ")
if ( killFlags & TSKF_DOUBLEKILL ) if ( killFlags & TSKF_DOUBLEKILL )
pos += format(kmsg[pos],128-pos," double ") pos += format(kmsg[pos],charsmax(kmsg)-pos," double ")
if ( killFlags & TSKF_ISSPEC ) if ( killFlags & TSKF_ISSPEC )
pos += format(kmsg[pos],128-pos," spec ") pos += format(kmsg[pos],charsmax(kmsg)-pos," spec ")
if ( killFlags & TSKF_KILLEDSPEC ) if ( killFlags & TSKF_KILLEDSPEC )
pos += format(kmsg[pos],128-pos," kspec ") pos += format(kmsg[pos],charsmax(kmsg)-pos," kspec ")
pos += format(kmsg[pos],128-pos,"]") pos += format(kmsg[pos],charsmax(kmsg)-pos,"]")
} }
set_hudmessage(255,255,255,0.02,0.85,2, 1.5, 3.0, 0.02, 5.0, -1) set_hudmessage(255,255,255,0.02,0.85,2, 1.5, 3.0, 0.02, 5.0, -1)
show_hudmessage(killer, "%s", kmsg) show_hudmessage(killer, "%s", kmsg)
@ -450,9 +450,9 @@ public client_death(killer,victim,wpnindex,hitplace,TK){
DisplayKillInfo(victim){ DisplayKillInfo(victim){
if ( ShowKiller ){ if ( ShowKiller ){
new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[33], mstats[8], mbody[8] new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[32], mstats[8], mbody[8]
get_user_name(g_Killers[victim][0],name,31) get_user_name(g_Killers[victim][0],name,charsmax(name))
get_user_astats(victim,g_Killers[victim][0],stats,body,wpn,31) get_user_astats(victim,g_Killers[victim][0],stats,body,wpn,charsmax(wpn))
get_user_vstats(victim,g_Killers[victim][0],mstats,mbody) get_user_vstats(victim,g_Killers[victim][0],mstats,mbody)
set_hudmessage(220,80,0,0.05,0.15,0, 6.0, 12.0, 1.0, 2.0, -1) set_hudmessage(220,80,0,0.05,0.15,0, 6.0, 12.0, 1.0, 2.0, -1)
getHits(victim,g_Killers[victim][0]) getHits(victim,g_Killers[victim][0])
@ -476,8 +476,8 @@ DisplayAVList(victim){
DisplayKillerHp(victim,con){ DisplayKillerHp(victim,con){
if ( KillerHp ){ if ( KillerHp ){
new name[MAX_NAME_LENGTH], kmsg[128] new name[MAX_NAME_LENGTH], kmsg[128]
get_user_name(g_Killers[victim][0],name,31) get_user_name(g_Killers[victim][0],name,charsmax(name))
format(kmsg,127,"%s still has %dhp",name,g_Killers[victim][1]) format(kmsg,charsmax(kmsg),"%s still has %dhp",name,g_Killers[victim][1])
if ( con ) client_print(victim,print_console, "%s", kmsg) if ( con ) client_print(victim,print_console, "%s", kmsg)
set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1) set_hudmessage(255,255,255,0.02,0.9,2, 1.5, 3.0, 0.02, 5.0, -1)
show_hudmessage(victim, "%s", kmsg) show_hudmessage(victim, "%s", kmsg)
@ -503,9 +503,9 @@ public cmdKiller(id) {
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }
if (g_Killers[id][0]) { if (g_Killers[id][0]) {
new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[33], mstats[8], mbody[8] new name[MAX_NAME_LENGTH], stats[8], body[8], wpn[32], mstats[8], mbody[8]
get_user_name(g_Killers[id][0],name,31) get_user_name(g_Killers[id][0],name,charsmax(name))
get_user_astats(id,g_Killers[id][0],stats,body,wpn,31) get_user_astats(id,g_Killers[id][0],stats,body,wpn,charsmax(wpn))
get_user_vstats(id,g_Killers[id][0],mstats,mbody) get_user_vstats(id,g_Killers[id][0],mstats,mbody)
client_print(id,print_chat,"%s killed you with %s from distance of %.2f meters", name,wpn,float(g_Killers[id][2]) * 0.0254 ) client_print(id,print_chat,"%s killed you with %s from distance of %.2f meters", name,wpn,float(g_Killers[id][2]) * 0.0254 )
client_print(id,print_chat,"He did %d damage to you with %d hit(s) and still had %dhp", client_print(id,print_chat,"He did %d damage to you with %d hit(s) and still had %dhp",
@ -547,20 +547,20 @@ showStatsMenu(id,pos){
new menu_body[512], inum, k = 0, start = pos * MAX_MENUPOS new menu_body[512], inum, k = 0, start = pos * MAX_MENUPOS
get_players(g_userPlayers[id],inum) get_players(g_userPlayers[id],inum)
if (start >= inum) start = pos = g_userPosition[id] = 0 if (start >= inum) start = pos = g_userPosition[id] = 0
new len = format(menu_body,511,"Server Stats %d/%d^n^n",pos + 1,((inum/MAX_MENUPOS)+((inum%MAX_MENUPOS)?1:0))) new len = format(menu_body,charsmax(menu_body),"Server Stats %d/%d^n^n",pos + 1,((inum/MAX_MENUPOS)+((inum%MAX_MENUPOS)?1:0)))
new name[MAX_NAME_LENGTH], end = start + MAX_MENUPOS, keys = (1<<9)|(1<<7) new name[MAX_NAME_LENGTH], end = start + MAX_MENUPOS, keys = (1<<9)|(1<<7)
if (end > inum) end = inum if (end > inum) end = inum
for(new a = start; a < end; ++a){ for(new a = start; a < end; ++a){
get_user_name(g_userPlayers[id][a],name,31) get_user_name(g_userPlayers[id][a],name,charsmax(name))
keys |= (1<<k) keys |= (1<<k)
len += format(menu_body[len],511-len,"%d. %s^n",++k,name) len += format(menu_body[len],charsmax(menu_body)-len,"%d. %s^n",++k,name)
} }
len += format(menu_body[len],511-len,"^n8. %s^n",g_userState[id] ? "Show rank" : "Show stats" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n8. %s^n",g_userState[id] ? "Show rank" : "Show stats" )
if (end != inum){ if (end != inum){
len += format(menu_body[len],511-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" ) len += format(menu_body[len],charsmax(menu_body)-len,"^n9. More...^n0. %s" , pos ? "Back" : "Exit" )
keys |= (1<<8) keys |= (1<<8)
} }
else len += format(menu_body[len],511-len,"^n0. %s" , pos ? "Back" : "Exit" ) else len += format(menu_body[len],charsmax(menu_body)-len,"^n0. %s" , pos ? "Back" : "Exit" )
show_menu(id,keys,menu_body) show_menu(id,keys,menu_body)
return PLUGIN_HANDLED return PLUGIN_HANDLED
} }

View File

@ -29,13 +29,13 @@ public client_disconnect(id) {
new iUserid = get_user_userid( id ) new iUserid = get_user_userid( id )
// team // team
get_user_info(id,"team", szTeam, 15 ) get_user_info(id,"team", szTeam, charsmax(szTeam) )
get_user_name(id, szName ,31 ) get_user_name(id, szName , charsmax(szName) )
get_user_authid(id, szAuthid , 31 ) get_user_authid(id, szAuthid , charsmax(szAuthid) )
for(new i = 1 ; i < TSMAX_WEAPONS ; ++i ) { for(new i = 1 ; i < TSMAX_WEAPONS ; ++i ) {
if( get_user_wstats( id , i ,iStats , iHits ) ) { if( get_user_wstats( id , i ,iStats , iHits ) ) {
xmod_get_wpnlogname( i , szWeapon , 15 ) xmod_get_wpnlogname( i , szWeapon , charsmax(szWeapon) )
log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")", log_message("^"%s<%d><%s><%s>^" triggered ^"weaponstats^" (weapon ^"%s^") (shots ^"%d^") (hits ^"%d^") (kills ^"%d^") (headshots ^"%d^") (tks ^"%d^") (damage ^"%d^") (deaths ^"%d^")",
szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0], szName,iUserid,szAuthid,szTeam,szWeapon,iStats[4],iStats[5],iStats[0],
iStats[2],iStats[3],iStats[6],iStats[1]) iStats[2],iStats[3],iStats[6],iStats[1])