StatsX: Switch format to formatex

This commit is contained in:
Valentin Grünbacher 2014-05-01 04:57:59 +02:00
parent 3e1de6b014
commit 297ced77b9

View File

@ -299,7 +299,7 @@ public cmdHudTest(id)
iLen = 0 iLen = 0
for (i = 1; i < 20; i++) for (i = 1; i < 20; i++)
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n") iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "....x....1....x....2....x....3....x....4....x....^n")
set_hudtype_killer(50.0) set_hudtype_killer(50.0)
show_hudmessage(id, "%s", g_sBuffer) show_hudmessage(id, "%s", g_sBuffer)
@ -380,10 +380,10 @@ get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1])
if (izStats[STATS_SHOTS] && ShowFullStats) if (izStats[STATS_SHOTS] && ShowFullStats)
{ {
get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH) get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L -- %s -- %0.2f%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC")
} }
else else
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS")
// Get and format attacker list. // Get and format attacker list.
for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++) for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)
@ -396,17 +396,17 @@ get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1])
if (izStats[STATS_KILLS]) if (izStats[STATS_KILLS])
{ {
if (!ShowDistHS) if (!ShowDistHS)
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn) izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
else if (izStats[STATS_HS]) else if (izStats[STATS_HS])
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id])) izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id])) izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserAttackerDistance[id]))
} }
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG") iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
} }
} }
@ -434,9 +434,9 @@ get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1])
get_user_vstats(id, 0, izStats, izBody) get_user_vstats(id, 0, izStats, izBody)
if (izStats[STATS_SHOTS]) if (izStats[STATS_SHOTS])
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC")
else else
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS")
for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++) for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++)
{ {
@ -448,17 +448,17 @@ get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1])
if (izStats[STATS_DEATHS]) if (izStats[STATS_DEATHS])
{ {
if (!ShowDistHS) if (!ShowDistHS)
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn) izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
else if (izStats[STATS_HS]) else if (izStats[STATS_HS])
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m / HS^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim])) izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L / %s / %0.0f m^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim])) izStats[STATS_DAMAGE], id, "DMG", t_sWpn, distance(g_izUserVictimDistance[id][iVictim]))
} }
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG") iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
} }
} }
@ -492,9 +492,9 @@ get_kill_info(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
izVStats[STATS_DAMAGE] = 0 izVStats[STATS_DAMAGE] = 0
get_user_vstats(id, iKiller, izVStats, iaVBody) get_user_vstats(id, iKiller, izVStats, iaVBody)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id])) iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]))
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "DID_DMG_HITS", izAStats[STATS_DAMAGE], izAStats[STATS_HITS], g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR]) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "DID_DMG_HITS", izAStats[STATS_DAMAGE], izAStats[STATS_HITS], g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR])
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS]) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS])
} }
return iFound return iFound
@ -528,7 +528,7 @@ add_most_disruptive(sBuffer[MAX_BUFFER_LENGTH + 1])
new Float:fGameEff = effec(g_izUserGameStats[id]) new Float:fGameEff = effec(g_izUserGameStats[id])
new Float:fRndAcc = accuracy(g_izUserRndStats[id]) new Float:fRndAcc = accuracy(g_izUserRndStats[id])
format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d %L -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "MOST_DMG", g_izUserRndName[id], formatex(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d %L -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "MOST_DMG", g_izUserRndName[id],
g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC") g_izUserRndStats[id][STATS_HITS], LANG_SERVER, "HIT_S", iMaxDamage, LANG_SERVER, "DMG", fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
add(sBuffer, MAX_BUFFER_LENGTH, t_sText) add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
} }
@ -564,7 +564,7 @@ add_best_score(sBuffer[MAX_BUFFER_LENGTH + 1])
new Float:fGameEff = effec(g_izUserGameStats[id]) new Float:fGameEff = effec(g_izUserGameStats[id])
new Float:fRndAcc = accuracy(g_izUserRndStats[id]) new Float:fRndAcc = accuracy(g_izUserRndStats[id])
format(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "BEST_SCORE", g_izUserRndName[id], formatex(t_sText, MAX_TEXT_LENGTH, "%L: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n", LANG_SERVER, "BEST_SCORE", g_izUserRndName[id],
iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC") iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
add(sBuffer, MAX_BUFFER_LENGTH, t_sText) add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
} }
@ -586,7 +586,7 @@ add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1])
} }
// Format round team stats, MOTD // Format round team stats, MOTD
format(t_sText, MAX_TEXT_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L^nCT %d / %0.2f%% %L / %0.2f%% %L^n", g_izTeamScore[0], formatex(t_sText, MAX_TEXT_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L^nCT %d / %0.2f%% %L / %0.2f%% %L^n", g_izTeamScore[0],
fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC") fzMapEff[0], LANG_SERVER, "EFF", fzRndAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzRndAcc[1], LANG_SERVER, "ACC")
add(sBuffer, MAX_BUFFER_LENGTH, t_sText) add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
} }
@ -605,14 +605,14 @@ save_team_chatscore()
} }
// Format game team stats, chat // Format game team stats, chat
format(g_sScore, MAX_BUFFER_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L -- CT %d / %0.2f%% %L / %0.2f%% %L", g_izTeamScore[0], formatex(g_sScore, MAX_BUFFER_LENGTH, "TERRORIST %d / %0.2f%% %L / %0.2f%% %L -- CT %d / %0.2f%% %L / %0.2f%% %L", g_izTeamScore[0],
fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC") fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC")
} }
// Get and format total stats. // Get and format total stats.
add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1]) add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1])
{ {
format(t_sText, MAX_TEXT_LENGTH, "%L: %d %L / %d hs -- %d %L / %d %L^n", LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S", formatex(t_sText, MAX_TEXT_LENGTH, "%L: %d %L / %d hs -- %d %L / %d %L^n", LANG_SERVER, "TOTAL", g_izUserRndStats[0][STATS_KILLS], LANG_SERVER, "KILL_S",
g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S") g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], LANG_SERVER, "HITS", g_izUserRndStats[0][STATS_SHOTS], LANG_SERVER, "SHOT_S")
add(sBuffer, MAX_BUFFER_LENGTH, t_sText) add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
} }
@ -635,14 +635,14 @@ add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1])
iLen = strlen(sBuffer) iLen = strlen(sBuffer)
get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH) get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L:^n", id, "HITS_YOU_IN", t_sName)
for (new i = 1; i < 8; i++) for (new i = 1; i < 8; i++)
{ {
if (!izBody[i]) if (!izBody[i])
continue continue
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i]) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i])
} }
} }
} }
@ -665,7 +665,7 @@ format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
izStats[STATS_HITS] = 0 izStats[STATS_HITS] = 0
get_user_astats(id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH) get_user_astats(id, iKiller, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]), iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]),
g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR]) g_izKilled[id][KILLED_KILLER_HEALTH], g_izKilled[id][KILLED_KILLER_ARMOUR])
if (izStats[STATS_HITS]) if (izStats[STATS_HITS])
@ -675,14 +675,14 @@ format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
if (!izBody[i]) if (!izBody[i])
continue continue
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i]) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
} }
} }
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS") iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
} }
else else
format(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER") formatex(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER")
return iFound return iFound
} }
@ -703,10 +703,10 @@ format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
{ {
iFound = 1 iFound = 1
get_user_name(iKiller, t_sName, MAX_NAME_LENGTH) get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE]) iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE])
} }
else else
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE]) iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE])
if (izStats[STATS_HITS]) if (izStats[STATS_HITS])
{ {
@ -715,11 +715,11 @@ format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
if (!izBody[i]) if (!izBody[i])
continue continue
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i]) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
} }
} }
else else
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS") iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
return iFound return iFound
} }
@ -736,25 +736,25 @@ format_top15(sBuffer[MAX_BUFFER_LENGTH + 1])
new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16] new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16]
format(lKills, 15, "%L", LANG_SERVER, "KILLS") formatex(lKills, 15, "%L", LANG_SERVER, "KILLS")
format(lDeaths, 15, "%L", LANG_SERVER, "DEATHS") formatex(lDeaths, 15, "%L", LANG_SERVER, "DEATHS")
format(lHits, 15, "%L", LANG_SERVER, "HITS") formatex(lHits, 15, "%L", LANG_SERVER, "HITS")
format(lShots, 15, "%L", LANG_SERVER, "SHOTS") formatex(lShots, 15, "%L", LANG_SERVER, "SHOTS")
format(lEff, 15, "%L", LANG_SERVER, "EFF") formatex(lEff, 15, "%L", LANG_SERVER, "EFF")
format(lAcc, 15, "%L", LANG_SERVER, "ACC") formatex(lAcc, 15, "%L", LANG_SERVER, "ACC")
ucfirst(lEff) ucfirst(lEff)
ucfirst(lAcc) ucfirst(lAcc)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>")
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n", "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2s %-22.22s %6s %6s %6s %6s %4s %4s %4s^n", "#", "Nick", lKills, lDeaths, lHits, lShots, "HS", lEff, lAcc)
for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++) for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
{ {
get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH) get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
replace_all(t_sName, MAX_NAME_LENGTH, "<", "[") replace_all(t_sName, MAX_NAME_LENGTH, "<", "[")
replace_all(t_sName, MAX_NAME_LENGTH, ">", "]") replace_all(t_sName, MAX_NAME_LENGTH, ">", "]")
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i + 1, t_sName, izStats[STATS_KILLS], iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%2d %-22.22s %6d %6d %6d %6d %4d %3.0f%% %3.0f%%^n", i + 1, t_sName, izStats[STATS_KILLS],
izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats)) izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats))
} }
} }
@ -767,21 +767,21 @@ format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
new iRankPos, iLen new iRankPos, iLen
new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16] new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16]
format(lKills, 15, "%L", id, "KILLS") formatex(lKills, 15, "%L", id, "KILLS")
format(lDeaths, 15, "%L", id, "DEATHS") formatex(lDeaths, 15, "%L", id, "DEATHS")
format(lHits, 15, "%L", id, "HITS") formatex(lHits, 15, "%L", id, "HITS")
format(lShots, 15, "%L", id, "SHOTS") formatex(lShots, 15, "%L", id, "SHOTS")
format(lDamage, 15, "%L", id, "DAMAGE") formatex(lDamage, 15, "%L", id, "DAMAGE")
format(lEff, 15, "%L", id, "EFF") formatex(lEff, 15, "%L", id, "EFF")
format(lAcc, 15, "%L", id, "ACC") formatex(lAcc, 15, "%L", id, "ACC")
ucfirst(lEff) ucfirst(lEff)
ucfirst(lAcc) ucfirst(lAcc)
iRankPos = get_user_stats(id, izStats, izBody) iRankPos = get_user_stats(id, izStats, izBody)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L %L^n^n", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum()) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L %L^n^n", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum())
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS], lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats)) lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
@ -789,10 +789,10 @@ format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
for (new i = 1; i < 8; i++) for (new i = 1; i < 8; i++)
{ {
format(L_BODY_PART[i], 31, "%L", id, BODY_PART[i]) formatex(L_BODY_PART[i], 31, "%L", id, BODY_PART[i])
} }
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d", "HITS", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%10s:^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d^n%10s: %d", "HITS",
L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5], L_BODY_PART[1], izBody[1], L_BODY_PART[2], izBody[2], L_BODY_PART[3], izBody[3], L_BODY_PART[4], izBody[4], L_BODY_PART[5],
izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7]) izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
} }
@ -805,32 +805,32 @@ format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
new iWeapon, iLen new iWeapon, iLen
new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16], lWeapon[16] new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16], lWeapon[16]
format(lKills, 15, "%L", id, "KILLS") formatex(lKills, 15, "%L", id, "KILLS")
format(lDeaths, 15, "%L", id, "DEATHS") formatex(lDeaths, 15, "%L", id, "DEATHS")
format(lHits, 15, "%L", id, "HITS") formatex(lHits, 15, "%L", id, "HITS")
format(lShots, 15, "%L", id, "SHOTS") formatex(lShots, 15, "%L", id, "SHOTS")
format(lDamage, 15, "%L", id, "DAMAGE") formatex(lDamage, 15, "%L", id, "DAMAGE")
format(lEff, 15, "%L", id, "EFF") formatex(lEff, 15, "%L", id, "EFF")
format(lAcc, 15, "%L", id, "ACC") formatex(lAcc, 15, "%L", id, "ACC")
format(lWeapon, 15, "%L", id, "WEAPON") formatex(lWeapon, 15, "%L", id, "WEAPON")
ucfirst(lEff) ucfirst(lEff)
ucfirst(lAcc) ucfirst(lAcc)
get_user_wstats(id, 0, izStats, izBody) get_user_wstats(id, 0, izStats, izBody)
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>") iLen = formatex(sBuffer, MAX_BUFFER_LENGTH, "<body bgcolor=#000000><font color=#FFB000><pre>")
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n", iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%6s: %d (%d with hs)^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %d^n%6s: %0.2f%%^n%6s: %0.2f%%^n^n",
lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS], lKills, izStats[STATS_KILLS], izStats[STATS_HS], lDeaths, izStats[STATS_DEATHS], lHits, izStats[STATS_HITS], lShots, izStats[STATS_SHOTS],
lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats)) lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6s %6s %6s %6s %6s %4s^n", lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc) iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6s %6s %6s %6s %6s %4s^n", lWeapon, lKills, lDeaths, lHits, lShots, lDamage, lAcc)
for (iWeapon = 1; iWeapon < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++) for (iWeapon = 1; iWeapon < xmod_get_maxweapons() && MAX_BUFFER_LENGTH - iLen > 0 ; iWeapon++)
{ {
if (get_user_wstats(id, iWeapon, izStats, izBody)) if (get_user_wstats(id, iWeapon, izStats, izBody))
{ {
xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH) xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6d %6d %6d %6d %6d %3.0f%%^n", t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS], iLen += formatex(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%-12.12s %6d %6d %6d %6d %6d %3.0f%%^n", t_sWpn, izStats[STATS_KILLS], izStats[STATS_DEATHS],
izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats)) izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_DAMAGE], accuracy(izStats))
} }
} }
@ -1081,15 +1081,15 @@ public cmdReport(id)
new lWeapon[16] new lWeapon[16]
format(lWeapon, 15, "%L", id, "WEAPON") formatex(lWeapon, 15, "%L", id, "WEAPON")
strtolower(lWeapon) strtolower(lWeapon)
if (iClip >= 0) if (iClip >= 0)
{ {
format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d/%d, %L: %d, %L: %d", lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor) formatex(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d/%d, %L: %d, %L: %d", lWeapon, t_sWpn, LANG_SERVER, "AMMO", iClip, iAmmo, LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
} }
else else
format(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d, %L: %d", lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor) formatex(g_sBuffer, MAX_BUFFER_LENGTH, "%s: %s, %L: %d, %L: %d", lWeapon, t_sWpn[7], LANG_SERVER, "HEALTH", iHealth, LANG_SERVER, "ARMOR", iArmor)
engclient_cmd(id, "say_team", g_sBuffer) engclient_cmd(id, "say_team", g_sBuffer)
@ -1119,7 +1119,7 @@ public cmdSwitch(id)
new lEnDis[32] new lEnDis[32]
format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED") formatex(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
client_print(id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis) client_print(id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
return PLUGIN_CONTINUE return PLUGIN_CONTINUE
@ -1214,7 +1214,7 @@ showStatsMenu(id, iMenuPos)
iMenuPos = iMenuPosMax - 1 iMenuPos = iMenuPosMax - 1
iUserIndex = iMenuPos * PPL_MENU_OPTIONS iUserIndex = iMenuPos * PPL_MENU_OPTIONS
iLen = format(g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax) iLen = formatex(g_sBuffer, MAX_BUFFER_LENGTH, "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax)
iMenuOptionMax = iPlayers - iUserIndex iMenuOptionMax = iPlayers - iUserIndex
if (iMenuOptionMax > PPL_MENU_OPTIONS) if (iMenuOptionMax > PPL_MENU_OPTIONS)
@ -1224,22 +1224,22 @@ showStatsMenu(id, iMenuPos)
{ {
get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH) get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH)
iKeyMask |= (1<<iMenuOption) iKeyMask |= (1<<iMenuOption)
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%d. %s^n\w", iMenuOption + 1, t_sName) iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%d. %s^n\w", iMenuOption + 1, t_sName)
} }
iKeyMask |= MENU_KEY_8|MENU_KEY_0 iKeyMask |= MENU_KEY_8|MENU_KEY_0
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n8. %s^n\w", g_izUserMenuActionText[g_izUserMenuAction[id]]) iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n8. %s^n\w", g_izUserMenuActionText[g_izUserMenuAction[id]])
if (iPlayers > iUserIndex) if (iPlayers > iUserIndex)
{ {
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE") iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE")
iKeyMask |= MENU_KEY_9 iKeyMask |= MENU_KEY_9
} }
if (iMenuPos > 0) if (iMenuPos > 0)
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK") iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK")
else else
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT") iLen += formatex(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT")
show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats") show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats")