Merge pull request #9 from Nextra/statsx-lang
StatsX Language/Translation Update (bug 3040)
This commit is contained in:
commit
60f54ee691
@ -36,6 +36,7 @@
|
||||
#include <amxmodx>
|
||||
#include <amxmisc>
|
||||
#include <csx>
|
||||
#include <hamsandwich>
|
||||
//--------------------------------
|
||||
|
||||
// Uncomment to activate log debug messages.
|
||||
@ -54,7 +55,7 @@
|
||||
#define HUD_MIN_DURATION 0.2
|
||||
|
||||
// Config plugin constants.
|
||||
#define MODE_HUD_DELAY 0 // Make a 0.01 sec delay on HUD reset process.
|
||||
#define MODE_HUD_DELAY 0 // Make a 0.1 sec delay on HUD reset process.
|
||||
|
||||
// You can also manualy enable or disable these options by setting them to 1
|
||||
// For example:
|
||||
@ -155,6 +156,11 @@ new Float:g_fHUDDuration = 0.0
|
||||
new g_iRoundEndTriggered = 0
|
||||
new g_iRoundEndProcessed = 0
|
||||
|
||||
new g_pFreezeTime = 0
|
||||
new g_pRoundTime = 0
|
||||
new g_pHudDuration = 0
|
||||
new g_pHudFreezeLimit = 0
|
||||
|
||||
new Float:g_fStartGame = 0.0
|
||||
new g_izTeamScore[MAX_TEAMS] = {0, ...}
|
||||
new g_izTeamEventScore[MAX_TEAMS] = {0, ...}
|
||||
@ -190,7 +196,7 @@ public plugin_init()
|
||||
|
||||
// Register events.
|
||||
register_event("TextMsg", "eventStartGame", "a", "2=#Game_Commencing", "2=#Game_will_restart_in")
|
||||
register_event("ResetHUD", "eventResetHud", "be")
|
||||
RegisterHamPlayer(Ham_Spawn, "eventSpawn", 1)
|
||||
register_event("RoundTime", "eventStartRound", "bc")
|
||||
register_event("SendAudio", "eventEndRound", "a", "2=%!MRAD_terwin", "2=%!MRAD_ctwin", "2=%!MRAD_rounddraw")
|
||||
register_event("TeamScore", "eventTeamScore", "a")
|
||||
@ -230,12 +236,14 @@ public plugin_init()
|
||||
register_clcmd("say /hudtest", "cmdHudTest")
|
||||
#endif
|
||||
|
||||
register_cvar(HUD_DURATION_CVAR, HUD_DURATION)
|
||||
register_cvar(HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT)
|
||||
g_pHudDuration = register_cvar(HUD_DURATION_CVAR, HUD_DURATION)
|
||||
g_pHudFreezeLimit = register_cvar(HUD_FREEZE_LIMIT_CVAR, HUD_FREEZE_LIMIT)
|
||||
|
||||
g_pFreezeTime = get_cvar_pointer("mp_freezetime")
|
||||
g_pRoundTime = get_cvar_pointer("mp_roundtime")
|
||||
|
||||
// Init buffers and some global vars.
|
||||
g_sBuffer[0] = 0
|
||||
save_team_chatscore()
|
||||
|
||||
g_HudSync_EndRound = CreateHudSyncObj()
|
||||
g_HudSync_SpecInfo = CreateHudSyncObj()
|
||||
@ -299,7 +307,7 @@ public cmdHudTest(id)
|
||||
iLen = 0
|
||||
|
||||
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], charsmax(g_sBuffer) - iLen, "....x....1....x....2....x....3....x....4....x....^n")
|
||||
|
||||
set_hudtype_killer(50.0)
|
||||
show_hudmessage(id, "%s", g_sBuffer)
|
||||
@ -335,7 +343,7 @@ set_plugin_mode(id, sFlags[])
|
||||
if (sFlags[0])
|
||||
g_iPluginMode = read_flags(sFlags)
|
||||
|
||||
get_flags(g_iPluginMode, t_sText, MAX_TEXT_LENGTH)
|
||||
get_flags(g_iPluginMode, t_sText, charsmax(t_sText))
|
||||
console_print(id, "%L", id, "MODE_SET_TO", t_sText)
|
||||
|
||||
return g_iPluginMode
|
||||
@ -344,17 +352,17 @@ set_plugin_mode(id, sFlags[])
|
||||
// Get config parameters.
|
||||
get_config_cvars()
|
||||
{
|
||||
g_fFreezeTime = get_cvar_float("mp_freezetime")
|
||||
g_fFreezeTime = get_pcvar_float(g_pFreezeTime)
|
||||
|
||||
if (g_fFreezeTime < 0.0)
|
||||
g_fFreezeTime = 0.0
|
||||
|
||||
g_fHUDDuration = get_cvar_float(HUD_DURATION_CVAR)
|
||||
g_fHUDDuration = get_pcvar_float(g_pHudDuration)
|
||||
|
||||
if (g_fHUDDuration < 1.0)
|
||||
g_fHUDDuration = 1.0
|
||||
|
||||
g_fFreezeLimitTime = get_cvar_float(HUD_FREEZE_LIMIT_CVAR)
|
||||
g_fFreezeLimitTime = get_pcvar_float(g_pHudFreezeLimit)
|
||||
}
|
||||
|
||||
// Get and format attackers header and list.
|
||||
@ -379,34 +387,34 @@ get_attackers(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
|
||||
if (izStats[STATS_SHOTS] && ShowFullStats)
|
||||
{
|
||||
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")
|
||||
get_user_name(iAttacker, t_sName, charsmax(t_sName))
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L -- %s -- %0.2f%% %L:^n", id, "ATTACKERS", t_sName, accuracy(izStats), id, "ACC")
|
||||
}
|
||||
else
|
||||
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "ATTACKERS")
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L:^n", id, "ATTACKERS")
|
||||
|
||||
// Get and format attacker list.
|
||||
for (iAttacker = 1; iAttacker <= iMaxPlayer; iAttacker++)
|
||||
{
|
||||
if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
|
||||
if (get_user_astats(id, iAttacker, izStats, izBody, t_sWpn, charsmax(t_sWpn)))
|
||||
{
|
||||
iFound = 1
|
||||
get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iAttacker, t_sName, charsmax(t_sName))
|
||||
|
||||
if (izStats[STATS_KILLS])
|
||||
{
|
||||
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], charsmax(sBuffer) - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
|
||||
izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
|
||||
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], charsmax(sBuffer) - 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]))
|
||||
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], charsmax(sBuffer) - 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]))
|
||||
}
|
||||
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], charsmax(sBuffer) - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
|
||||
}
|
||||
}
|
||||
|
||||
@ -434,31 +442,31 @@ get_victims(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
get_user_vstats(id, 0, izStats, izBody)
|
||||
|
||||
if (izStats[STATS_SHOTS])
|
||||
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC")
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L -- %0.2f%% %L:^n", id, "VICTIMS", accuracy(izStats), id, "ACC")
|
||||
else
|
||||
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L:^n", id, "VICTIMS")
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L:^n", id, "VICTIMS")
|
||||
|
||||
for (iVictim = 1; iVictim <= iMaxPlayer; iVictim++)
|
||||
{
|
||||
if (get_user_vstats(id, iVictim, izStats, izBody, t_sWpn, MAX_WEAPON_LENGTH))
|
||||
if (get_user_vstats(id, iVictim, izStats, izBody, t_sWpn, charsmax(t_sWpn)))
|
||||
{
|
||||
iFound = 1
|
||||
get_user_name(iVictim, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iVictim, t_sName, charsmax(t_sName))
|
||||
|
||||
if (izStats[STATS_DEATHS])
|
||||
{
|
||||
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], charsmax(sBuffer) - iLen, "%s -- %d %L / %d %L / %s^n", t_sName, izStats[STATS_HITS], id, "HIT_S",
|
||||
izStats[STATS_DAMAGE], id, "DMG", t_sWpn)
|
||||
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], charsmax(sBuffer) - 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]))
|
||||
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], charsmax(sBuffer) - 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]))
|
||||
}
|
||||
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], charsmax(sBuffer) - iLen, "%s -- %d %L / %d %L^n", t_sName, izStats[STATS_HITS], id, "HIT_S", izStats[STATS_DAMAGE], id, "DMG")
|
||||
}
|
||||
}
|
||||
|
||||
@ -481,99 +489,99 @@ get_kill_info(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
new izAStats[8], izABody[8], izVStats[8], iaVBody[8]
|
||||
|
||||
iFound = 1
|
||||
get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iKiller, t_sName, charsmax(t_sName))
|
||||
|
||||
izAStats[STATS_HITS] = 0
|
||||
izAStats[STATS_DAMAGE] = 0
|
||||
t_sWpn[0] = 0
|
||||
get_user_astats(id, iKiller, izAStats, izABody, t_sWpn, MAX_WEAPON_LENGTH)
|
||||
get_user_astats(id, iKiller, izAStats, izABody, t_sWpn, charsmax(t_sWpn))
|
||||
|
||||
izVStats[STATS_HITS] = 0
|
||||
izVStats[STATS_DAMAGE] = 0
|
||||
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 += 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 += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS])
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L^n", id, "KILLED_YOU_DIST", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]))
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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], charsmax(sBuffer) - iLen, "%L^n", id, "YOU_DID_DMG", izVStats[STATS_DAMAGE], izVStats[STATS_HITS])
|
||||
}
|
||||
|
||||
return iFound
|
||||
}
|
||||
|
||||
// Get and format most disruptive.
|
||||
add_most_disruptive(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
add_most_disruptive(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
new id, iMaxDamageId, iMaxDamage, iMaxHeadShots
|
||||
new iPlayer, iMaxDamageId, iMaxDamage, iMaxHeadShots
|
||||
|
||||
iMaxDamageId = 0
|
||||
iMaxDamage = 0
|
||||
iMaxHeadShots = 0
|
||||
|
||||
// Find player.
|
||||
for (id = 1; id < MAX_PLAYERS; id++)
|
||||
for (iPlayer = 1; iPlayer < MAX_PLAYERS; iPlayer++)
|
||||
{
|
||||
if (g_izUserRndStats[id][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[id][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
|
||||
if (g_izUserRndStats[iPlayer][STATS_DAMAGE] >= iMaxDamage && (g_izUserRndStats[iPlayer][STATS_DAMAGE] > iMaxDamage || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots))
|
||||
{
|
||||
iMaxDamageId = id
|
||||
iMaxDamage = g_izUserRndStats[id][STATS_DAMAGE]
|
||||
iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
|
||||
iMaxDamageId = iPlayer
|
||||
iMaxDamage = g_izUserRndStats[iPlayer][STATS_DAMAGE]
|
||||
iMaxHeadShots = g_izUserRndStats[iPlayer][STATS_HS]
|
||||
}
|
||||
}
|
||||
|
||||
// Format statistics.
|
||||
if (iMaxDamageId)
|
||||
{
|
||||
id = iMaxDamageId
|
||||
iPlayer = iMaxDamageId
|
||||
|
||||
new Float:fGameEff = effec(g_izUserGameStats[id])
|
||||
new Float:fRndAcc = accuracy(g_izUserRndStats[id])
|
||||
new Float:fGameEff = effec(g_izUserGameStats[iPlayer])
|
||||
new Float:fRndAcc = accuracy(g_izUserRndStats[iPlayer])
|
||||
|
||||
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],
|
||||
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)
|
||||
formatex(t_sText, charsmax(t_sText), "%L: %s^n%d %L / %d %L -- %0.2f%% %L / %0.2f%% %L^n", id, "MOST_DMG", g_izUserRndName[iPlayer],
|
||||
g_izUserRndStats[iPlayer][STATS_HITS], id, "HIT_S", iMaxDamage, id, "DMG", fGameEff, id, "EFF", fRndAcc, id, "ACC")
|
||||
add(sBuffer, charsmax(sBuffer), t_sText)
|
||||
}
|
||||
|
||||
return iMaxDamageId
|
||||
}
|
||||
|
||||
// Get and format best score.
|
||||
add_best_score(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
add_best_score(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
new id, iMaxKillsId, iMaxKills, iMaxHeadShots
|
||||
new iPlayer, iMaxKillsId, iMaxKills, iMaxHeadShots
|
||||
|
||||
iMaxKillsId = 0
|
||||
iMaxKills = 0
|
||||
iMaxHeadShots = 0
|
||||
|
||||
// Find player
|
||||
for (id = 1; id < MAX_PLAYERS; id++)
|
||||
for (iPlayer = 1; iPlayer < MAX_PLAYERS; iPlayer++)
|
||||
{
|
||||
if (g_izUserRndStats[id][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[id][STATS_KILLS] > iMaxKills || g_izUserRndStats[id][STATS_HS] > iMaxHeadShots))
|
||||
if (g_izUserRndStats[iPlayer][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[iPlayer][STATS_KILLS] > iMaxKills || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots))
|
||||
{
|
||||
iMaxKillsId = id
|
||||
iMaxKills = g_izUserRndStats[id][STATS_KILLS]
|
||||
iMaxHeadShots = g_izUserRndStats[id][STATS_HS]
|
||||
iMaxKillsId = iPlayer
|
||||
iMaxKills = g_izUserRndStats[iPlayer][STATS_KILLS]
|
||||
iMaxHeadShots = g_izUserRndStats[iPlayer][STATS_HS]
|
||||
}
|
||||
}
|
||||
|
||||
// Format statistics.
|
||||
if (iMaxKillsId)
|
||||
{
|
||||
id = iMaxKillsId
|
||||
iPlayer = iMaxKillsId
|
||||
|
||||
new Float:fGameEff = effec(g_izUserGameStats[id])
|
||||
new Float:fRndAcc = accuracy(g_izUserRndStats[id])
|
||||
new Float:fGameEff = effec(g_izUserGameStats[iPlayer])
|
||||
new Float:fRndAcc = accuracy(g_izUserRndStats[iPlayer])
|
||||
|
||||
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],
|
||||
iMaxKills, LANG_SERVER, "KILL_S", iMaxHeadShots, fGameEff, LANG_SERVER, "EFF", fRndAcc, LANG_SERVER, "ACC")
|
||||
add(sBuffer, MAX_BUFFER_LENGTH, t_sText)
|
||||
formatex(t_sText, charsmax(t_sText), "%L: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n", id, "BEST_SCORE", g_izUserRndName[iPlayer],
|
||||
iMaxKills, id, "KILL_S", iMaxHeadShots, fGameEff, id, "EFF", fRndAcc, id, "ACC")
|
||||
add(sBuffer, charsmax(sBuffer), t_sText)
|
||||
}
|
||||
|
||||
return iMaxKillsId
|
||||
}
|
||||
|
||||
// Get and format team score.
|
||||
add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
add_team_score(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
|
||||
|
||||
@ -586,13 +594,13 @@ add_team_score(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
}
|
||||
|
||||
// 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],
|
||||
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)
|
||||
formatex(t_sText, charsmax(t_sText), "TERRORIST %d / %0.2f%% %L / %0.2f%% %L^nCT %d / %0.2f%% %L / %0.2f%% %L^n", g_izTeamScore[0],
|
||||
fzMapEff[0], id, "EFF", fzRndAcc[0], id, "ACC", g_izTeamScore[1], fzMapEff[1], id, "EFF", fzRndAcc[1], id, "ACC")
|
||||
add(sBuffer, charsmax(sBuffer), t_sText)
|
||||
}
|
||||
|
||||
// Get and format team stats, chat version
|
||||
save_team_chatscore()
|
||||
save_team_chatscore(id, sBuffer[MAX_TEXT_LENGTH + 1])
|
||||
{
|
||||
new Float:fzMapEff[MAX_TEAMS], Float:fzMapAcc[MAX_TEAMS], Float:fzRndAcc[MAX_TEAMS]
|
||||
|
||||
@ -605,16 +613,16 @@ save_team_chatscore()
|
||||
}
|
||||
|
||||
// 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],
|
||||
fzMapEff[0], LANG_SERVER, "EFF", fzMapAcc[0], LANG_SERVER, "ACC", g_izTeamScore[1], fzMapEff[1], LANG_SERVER, "EFF", fzMapAcc[1], LANG_SERVER, "ACC")
|
||||
formatex(sBuffer, charsmax(sBuffer), "TERRORIST %d / %0.2f%% %L / %0.2f%% %L -- CT %d / %0.2f%% %L / %0.2f%% %L", g_izTeamScore[0],
|
||||
fzMapEff[0], id, "EFF", fzMapAcc[0], id, "ACC", g_izTeamScore[1], fzMapEff[1], id, "EFF", fzMapAcc[1], id, "ACC")
|
||||
}
|
||||
|
||||
// Get and format total stats.
|
||||
add_total_stats(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
add_total_stats(id, 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",
|
||||
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)
|
||||
formatex(t_sText, charsmax(t_sText), "%L: %d %L / %d hs -- %d %L / %d %L^n", id, "TOTAL", g_izUserRndStats[0][STATS_KILLS], id, "KILL_S",
|
||||
g_izUserRndStats[0][STATS_HS], g_izUserRndStats[0][STATS_HITS], id, "HITS", g_izUserRndStats[0][STATS_SHOTS], id, "SHOT_S")
|
||||
add(sBuffer, charsmax(sBuffer), t_sText)
|
||||
}
|
||||
|
||||
// Get and format a user's list of body hits from an attacker.
|
||||
@ -633,16 +641,16 @@ add_attacker_hits(id, iAttacker, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
iFound = 1
|
||||
iLen = strlen(sBuffer)
|
||||
get_user_name(iAttacker, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iAttacker, t_sName, charsmax(t_sName))
|
||||
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - 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++)
|
||||
{
|
||||
if (!izBody[i])
|
||||
continue
|
||||
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i])
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, "%L: %d^n", id, BODY_PART[i], izBody[i])
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -661,11 +669,11 @@ format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
new iLen
|
||||
|
||||
iFound = 1
|
||||
get_user_name(iKiller, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iKiller, t_sName, charsmax(t_sName))
|
||||
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, charsmax(t_sWpn))
|
||||
|
||||
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L (%dhp, %dap) >>", id, "KILLED_BY_WITH", t_sName, t_sWpn, distance(g_izUserAttackerDistance[id]),
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%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])
|
||||
|
||||
if (izStats[STATS_HITS])
|
||||
@ -675,14 +683,14 @@ format_kill_ainfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
if (!izBody[i])
|
||||
continue
|
||||
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
|
||||
}
|
||||
}
|
||||
else
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, " %L", id, "NO_HITS")
|
||||
}
|
||||
else
|
||||
format(sBuffer, MAX_BUFFER_LENGTH, "%L", id, "YOU_NO_KILLER")
|
||||
formatex(sBuffer, charsmax(sBuffer), "%L", id, "YOU_NO_KILLER")
|
||||
|
||||
return iFound
|
||||
}
|
||||
@ -702,11 +710,11 @@ format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
if (iKiller && iKiller != id)
|
||||
{
|
||||
iFound = 1
|
||||
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])
|
||||
get_user_name(iKiller, t_sName, charsmax(t_sName))
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L >>", id, "YOU_HIT", t_sName, izStats[STATS_HITS], izStats[STATS_DAMAGE])
|
||||
}
|
||||
else
|
||||
iLen = format(sBuffer, MAX_BUFFER_LENGTH, "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE])
|
||||
iLen = formatex(sBuffer, charsmax(sBuffer), "%L >>", id, "LAST_RES", izStats[STATS_HITS], izStats[STATS_DAMAGE])
|
||||
|
||||
if (izStats[STATS_HITS])
|
||||
{
|
||||
@ -715,17 +723,17 @@ format_kill_vinfo(id, iKiller, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
if (!izBody[i])
|
||||
continue
|
||||
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, " %L: %d", id, BODY_PART[i], izBody[i])
|
||||
}
|
||||
}
|
||||
else
|
||||
iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, " %L", id, "NO_HITS")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, " %L", id, "NO_HITS")
|
||||
|
||||
return iFound
|
||||
}
|
||||
|
||||
// Get and format top 15.
|
||||
format_top15(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
format_top15(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
new iMax = get_statsnum()
|
||||
new izStats[8], izBody[8]
|
||||
@ -736,25 +744,25 @@ format_top15(sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
|
||||
new lKills[16], lDeaths[16], lHits[16], lShots[16], lEff[16], lAcc[16]
|
||||
|
||||
format(lKills, 15, "%L", LANG_SERVER, "KILLS")
|
||||
format(lDeaths, 15, "%L", LANG_SERVER, "DEATHS")
|
||||
format(lHits, 15, "%L", LANG_SERVER, "HITS")
|
||||
format(lShots, 15, "%L", LANG_SERVER, "SHOTS")
|
||||
format(lEff, 15, "%L", LANG_SERVER, "EFF")
|
||||
format(lAcc, 15, "%L", LANG_SERVER, "ACC")
|
||||
formatex(lKills, charsmax(lKills), "%L", id, "KILLS")
|
||||
formatex(lDeaths, charsmax(lDeaths), "%L", id, "DEATHS")
|
||||
formatex(lHits, charsmax(lHits), "%L", id, "HITS")
|
||||
formatex(lShots, charsmax(lShots), "%L", id, "SHOTS")
|
||||
formatex(lEff, charsmax(lEff), "%L", id, "EFF")
|
||||
formatex(lAcc, charsmax(lAcc), "%L", id, "ACC")
|
||||
|
||||
ucfirst(lEff)
|
||||
ucfirst(lAcc)
|
||||
|
||||
iLen = format(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, charsmax(sBuffer), "<meta charset=utf-8><body bgcolor=#000000><font color=#FFB000><pre>")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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 && charsmax(sBuffer) - iLen > 0; i++)
|
||||
{
|
||||
get_stats(i, izStats, izBody, 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],
|
||||
get_stats(i, izStats, izBody, t_sName, charsmax(t_sName))
|
||||
replace_string(t_sName, charsmax(t_sName), "<", "[")
|
||||
replace_string(t_sName, charsmax(t_sName), ">", "]")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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))
|
||||
}
|
||||
}
|
||||
@ -767,21 +775,21 @@ format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
|
||||
new iRankPos, iLen
|
||||
new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16]
|
||||
|
||||
format(lKills, 15, "%L", id, "KILLS")
|
||||
format(lDeaths, 15, "%L", id, "DEATHS")
|
||||
format(lHits, 15, "%L", id, "HITS")
|
||||
format(lShots, 15, "%L", id, "SHOTS")
|
||||
format(lDamage, 15, "%L", id, "DAMAGE")
|
||||
format(lEff, 15, "%L", id, "EFF")
|
||||
format(lAcc, 15, "%L", id, "ACC")
|
||||
formatex(lKills, charsmax(lKills), "%L", id, "KILLS")
|
||||
formatex(lDeaths, charsmax(lDeaths), "%L", id, "DEATHS")
|
||||
formatex(lHits, charsmax(lHits), "%L", id, "HITS")
|
||||
formatex(lShots, charsmax(lShots), "%L", id, "SHOTS")
|
||||
formatex(lDamage, charsmax(lDamage), "%L", id, "DAMAGE")
|
||||
formatex(lEff, charsmax(lEff), "%L", id, "EFF")
|
||||
formatex(lAcc, charsmax(lAcc), "%L", id, "ACC")
|
||||
|
||||
ucfirst(lEff)
|
||||
ucfirst(lAcc)
|
||||
|
||||
iRankPos = get_user_stats(id, izStats, izBody)
|
||||
iLen = format(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 += 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, charsmax(sBuffer), "<body bgcolor=#000000><font color=#FFB000><pre>")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - iLen, "%L %L^n^n", id, (!iMyId || iMyId == id) ? "YOUR" : "PLAYERS", id, "RANK_IS", iRankPos, get_statsnum())
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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],
|
||||
lDamage, izStats[STATS_DAMAGE], lEff, effec(izStats), lAcc, accuracy(izStats))
|
||||
|
||||
@ -789,10 +797,10 @@ format_rankstats(id, sBuffer[MAX_BUFFER_LENGTH + 1], iMyId = 0)
|
||||
|
||||
for (new i = 1; i < 8; i++)
|
||||
{
|
||||
format(L_BODY_PART[i], 31, "%L", id, BODY_PART[i])
|
||||
formatex(L_BODY_PART[i], charsmax(L_BODY_PART[]), "%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], charsmax(sBuffer) - 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],
|
||||
izBody[5], L_BODY_PART[6], izBody[6], L_BODY_PART[7], izBody[7])
|
||||
}
|
||||
@ -805,44 +813,74 @@ format_stats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
new iWeapon, iLen
|
||||
new lKills[16], lDeaths[16], lHits[16], lShots[16], lDamage[16], lEff[16], lAcc[16], lWeapon[16]
|
||||
|
||||
format(lKills, 15, "%L", id, "KILLS")
|
||||
format(lDeaths, 15, "%L", id, "DEATHS")
|
||||
format(lHits, 15, "%L", id, "HITS")
|
||||
format(lShots, 15, "%L", id, "SHOTS")
|
||||
format(lDamage, 15, "%L", id, "DAMAGE")
|
||||
format(lEff, 15, "%L", id, "EFF")
|
||||
format(lAcc, 15, "%L", id, "ACC")
|
||||
format(lWeapon, 15, "%L", id, "WEAPON")
|
||||
formatex(lKills, charsmax(lKills), "%L", id, "KILLS")
|
||||
formatex(lDeaths, charsmax(lDeaths), "%L", id, "DEATHS")
|
||||
formatex(lHits, charsmax(lHits), "%L", id, "HITS")
|
||||
formatex(lShots, charsmax(lShots), "%L", id, "SHOTS")
|
||||
formatex(lDamage, charsmax(lDamage), "%L", id, "DAMAGE")
|
||||
formatex(lEff, charsmax(lEff), "%L", id, "EFF")
|
||||
formatex(lAcc, charsmax(lAcc), "%L", id, "ACC")
|
||||
formatex(lWeapon, charsmax(lWeapon), "%L", id, "WEAPON")
|
||||
|
||||
ucfirst(lEff)
|
||||
ucfirst(lAcc)
|
||||
|
||||
get_user_wstats(id, 0, izStats, izBody)
|
||||
|
||||
iLen = format(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, charsmax(sBuffer), "<body bgcolor=#000000><font color=#FFB000><pre>")
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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],
|
||||
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], charsmax(sBuffer) - 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() && charsmax(sBuffer) - iLen > 0 ; iWeapon++)
|
||||
{
|
||||
if (get_user_wstats(id, iWeapon, izStats, izBody))
|
||||
{
|
||||
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],
|
||||
xmod_get_wpnname(iWeapon, t_sWpn, charsmax(t_sWpn))
|
||||
iLen += formatex(sBuffer[iLen], charsmax(sBuffer) - 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))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Format round end stats
|
||||
format_roundend_hudstats(id, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
sBuffer[0] = 0
|
||||
|
||||
// Create round awards.
|
||||
if (ShowMostDisruptive)
|
||||
add_most_disruptive(id, sBuffer)
|
||||
if (ShowBestScore)
|
||||
add_best_score(id, sBuffer)
|
||||
|
||||
// Create round score.
|
||||
// Compensate HUD message if awards are disabled.
|
||||
if (ShowTeamScore || ShowTotalStats)
|
||||
{
|
||||
if (ShowMostDisruptive && ShowBestScore)
|
||||
add(sBuffer, charsmax(sBuffer), "^n^n")
|
||||
else if (ShowMostDisruptive || ShowBestScore)
|
||||
add(sBuffer, charsmax(sBuffer), "^n^n^n^n")
|
||||
else
|
||||
add(sBuffer, charsmax(sBuffer), "^n^n^n^n^n^n")
|
||||
|
||||
if (ShowTeamScore)
|
||||
add_team_score(id, sBuffer)
|
||||
|
||||
if (ShowTotalStats)
|
||||
add_total_stats(id, sBuffer)
|
||||
}
|
||||
}
|
||||
|
||||
// Show round end stats. If gametime is zero then use default duration time.
|
||||
show_roundend_hudstats(id, Float:fGameTime)
|
||||
show_roundend_hudstats(id, Float:fGameTime, sBuffer[MAX_BUFFER_LENGTH + 1])
|
||||
{
|
||||
// Bail out if there no HUD stats should be shown
|
||||
// for this player or end round stats not created.
|
||||
if (!g_izStatsSwitch[id]) return
|
||||
if (!g_sAwardAndScore[0]) return
|
||||
if (!sBuffer[0]) return
|
||||
|
||||
// If round end timer is zero clear round end stats.
|
||||
if (g_fShowStatsTime == 0.0)
|
||||
@ -870,7 +908,7 @@ show_roundend_hudstats(id, Float:fGameTime)
|
||||
if (fDuration >= HUD_MIN_DURATION)
|
||||
{
|
||||
set_hudtype_endround(fDuration)
|
||||
ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", g_sAwardAndScore)
|
||||
ShowSyncHudMsg(id, g_HudSync_EndRound, "%s", sBuffer)
|
||||
#if defined STATSX_DEBUG
|
||||
log_amx("Show %1.2fs round end HUD stats for #%d", fDuration, id)
|
||||
#endif
|
||||
@ -948,7 +986,7 @@ public cmdPluginMode(id, level, cid)
|
||||
return PLUGIN_HANDLED
|
||||
|
||||
if (read_argc() > 1)
|
||||
read_argv(1, g_sBuffer, MAX_BUFFER_LENGTH)
|
||||
read_argv(1, g_sBuffer, charsmax(g_sBuffer))
|
||||
else
|
||||
g_sBuffer[0] = 0
|
||||
|
||||
@ -967,7 +1005,7 @@ public cmdStatsMe(id)
|
||||
}
|
||||
|
||||
format_stats(id, g_sBuffer)
|
||||
get_user_name(id, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(id, t_sName, charsmax(t_sName))
|
||||
show_motd(id, g_sBuffer, t_sName)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
@ -983,7 +1021,7 @@ public cmdRankStats(id)
|
||||
}
|
||||
|
||||
format_rankstats(id, g_sBuffer)
|
||||
get_user_name(id, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(id, t_sName, charsmax(t_sName))
|
||||
show_motd(id, g_sBuffer, t_sName)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
@ -998,7 +1036,7 @@ public cmdTop15(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
format_top15(g_sBuffer)
|
||||
format_top15(id, g_sBuffer)
|
||||
show_motd(id, g_sBuffer, "Top 15")
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
@ -1074,22 +1112,22 @@ public cmdReport(id)
|
||||
iWeapon = get_user_weapon(id, iClip, iAmmo)
|
||||
|
||||
if (iWeapon != 0)
|
||||
xmod_get_wpnname(iWeapon, t_sWpn, MAX_WEAPON_LENGTH)
|
||||
xmod_get_wpnname(iWeapon, t_sWpn, charsmax(t_sWpn))
|
||||
|
||||
iHealth = get_user_health(id)
|
||||
iArmor = get_user_armor(id)
|
||||
|
||||
new lWeapon[16]
|
||||
|
||||
format(lWeapon, 15, "%L", id, "WEAPON")
|
||||
formatex(lWeapon, charsmax(lWeapon), "%L", LANG_SERVER, "WEAPON")
|
||||
strtolower(lWeapon)
|
||||
|
||||
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, charsmax(g_sBuffer), "%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
|
||||
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, charsmax(g_sBuffer), "%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)
|
||||
|
||||
@ -1105,6 +1143,7 @@ public cmdScore(id)
|
||||
return PLUGIN_HANDLED
|
||||
}
|
||||
|
||||
save_team_chatscore(id, g_sScore)
|
||||
client_print(id, print_chat, "%L: %s", id, "GAME_SCORE", g_sScore)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
@ -1114,12 +1153,12 @@ public cmdScore(id)
|
||||
public cmdSwitch(id)
|
||||
{
|
||||
g_izStatsSwitch[id] = (g_izStatsSwitch[id]) ? 0 : -1
|
||||
num_to_str(g_izStatsSwitch[id], t_sText, MAX_TEXT_LENGTH)
|
||||
num_to_str(g_izStatsSwitch[id], t_sText, charsmax(t_sText))
|
||||
client_cmd(id, "setinfo _amxstatsx %s", t_sText)
|
||||
|
||||
new lEnDis[32]
|
||||
|
||||
format(lEnDis, 31, "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
|
||||
formatex(lEnDis, charsmax(lEnDis), "%L", id, g_izStatsSwitch[id] ? "ENABLED" : "DISABLED")
|
||||
client_print(id, print_chat, "* %L", id, "STATS_ANNOUNCE", lEnDis)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
@ -1168,7 +1207,7 @@ public actionStatsMenu(id, key)
|
||||
|
||||
if (g_sBuffer[0])
|
||||
{
|
||||
get_user_name(iIndex, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iIndex, t_sName, charsmax(t_sName))
|
||||
show_motd(id, g_sBuffer, t_sName)
|
||||
}
|
||||
}
|
||||
@ -1214,7 +1253,7 @@ showStatsMenu(id, iMenuPos)
|
||||
iMenuPos = iMenuPosMax - 1
|
||||
|
||||
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, charsmax(g_sBuffer), "\y%L\R%d/%d^n\w^n", id, "SERVER_STATS", iMenuPos + 1, iMenuPosMax)
|
||||
iMenuOptionMax = iPlayers - iUserIndex
|
||||
|
||||
if (iMenuOptionMax > PPL_MENU_OPTIONS)
|
||||
@ -1222,24 +1261,24 @@ showStatsMenu(id, iMenuPos)
|
||||
|
||||
for (iMenuOption = 0; iMenuOption < iMenuOptionMax; iMenuOption++)
|
||||
{
|
||||
get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(g_izUserMenuPlayers[id][iUserIndex++], t_sName, charsmax(t_sName))
|
||||
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], charsmax(g_sBuffer) - iLen, "%d. %s^n\w", iMenuOption + 1, t_sName)
|
||||
}
|
||||
|
||||
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], charsmax(g_sBuffer) - iLen, "^n8. %s^n\w", g_izUserMenuActionText[g_izUserMenuAction[id]])
|
||||
|
||||
if (iPlayers > iUserIndex)
|
||||
{
|
||||
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n9. %L...", id, "MORE")
|
||||
iLen += formatex(g_sBuffer[iLen], charsmax(g_sBuffer) - iLen, "^n9. %L...", id, "MORE")
|
||||
iKeyMask |= MENU_KEY_9
|
||||
}
|
||||
|
||||
if (iMenuPos > 0)
|
||||
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "BACK")
|
||||
iLen += formatex(g_sBuffer[iLen], charsmax(g_sBuffer) - iLen, "^n0. %L", id, "BACK")
|
||||
else
|
||||
iLen += format(g_sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "^n0. %L", id, "EXIT")
|
||||
iLen += formatex(g_sBuffer[iLen], charsmax(g_sBuffer) - iLen, "^n0. %L", id, "EXIT")
|
||||
|
||||
show_menu(id, iKeyMask, g_sBuffer, -1, "Server Stats")
|
||||
|
||||
@ -1253,11 +1292,11 @@ showStatsMenu(id, iMenuPos)
|
||||
// Reset game stats on game start and restart.
|
||||
public eventStartGame()
|
||||
{
|
||||
read_data(2, t_sText, MAX_TEXT_LENGTH)
|
||||
read_data(2, t_sText, charsmax(t_sText))
|
||||
|
||||
if (t_sText[6] == 'w')
|
||||
{
|
||||
read_data(3, t_sText, MAX_TEXT_LENGTH)
|
||||
read_data(3, t_sText, charsmax(t_sText))
|
||||
g_fStartGame = get_gametime() + float(str_to_num(t_sText))
|
||||
}
|
||||
else
|
||||
@ -1271,7 +1310,7 @@ public eventStartRound()
|
||||
{
|
||||
new iTeam, id, i
|
||||
|
||||
new Float:roundtime = get_cvar_float("mp_roundtime");
|
||||
new Float:roundtime = get_pcvar_float(g_pRoundTime)
|
||||
if (read_data(1) >= floatround(roundtime * 60.0,floatround_floor) || (roundtime == 2.3 && read_data(1) == 137)) // these round too weird for it to work through pawn, have to add an exception for it
|
||||
{
|
||||
#if defined STATSX_DEBUG
|
||||
@ -1337,31 +1376,39 @@ public eventStartRound()
|
||||
}
|
||||
|
||||
// Reset killer info on round restart.
|
||||
public eventResetHud(id)
|
||||
public eventSpawn(id)
|
||||
{
|
||||
if (!is_user_alive(id))
|
||||
return HAM_IGNORED
|
||||
|
||||
new args[1]
|
||||
args[0] = id
|
||||
|
||||
if (g_iPluginMode & MODE_HUD_DELAY)
|
||||
set_task(0.01, "delay_resethud", 200 + id, args, 1)
|
||||
set_task(0.1, "delay_spawn", 200 + id, args, 1)
|
||||
else
|
||||
delay_resethud(args)
|
||||
delay_spawn(args)
|
||||
|
||||
return PLUGIN_CONTINUE
|
||||
return HAM_IGNORED
|
||||
}
|
||||
|
||||
public delay_resethud(args[])
|
||||
public delay_spawn(args[])
|
||||
{
|
||||
new id = args[0]
|
||||
new Float:fGameTime
|
||||
|
||||
// Show user and score round stats after HUD-reset
|
||||
// Show user and score round stats after spawn
|
||||
#if defined STATSX_DEBUG
|
||||
log_amx("Reset HUD for #%d", id)
|
||||
log_amx("Spawn for #%d", id)
|
||||
#endif
|
||||
fGameTime = get_gametime()
|
||||
show_user_hudstats(id, fGameTime)
|
||||
show_roundend_hudstats(id, fGameTime)
|
||||
|
||||
if (g_izStatsSwitch[id] && g_sAwardAndScore[0])
|
||||
{
|
||||
format_roundend_hudstats(id, g_sAwardAndScore)
|
||||
show_roundend_hudstats(id, fGameTime, g_sAwardAndScore)
|
||||
}
|
||||
|
||||
// Reset round stats
|
||||
g_izKilled[id][KILLED_KILLER_ID] = 0
|
||||
@ -1446,7 +1493,7 @@ kill_stats(id)
|
||||
else
|
||||
iTeam = get_user_team(id) - 1
|
||||
|
||||
get_user_name(id, g_izUserRndName[id], MAX_NAME_LENGTH)
|
||||
get_user_name(id, g_izUserRndName[id], charsmax(g_izUserRndName[]))
|
||||
|
||||
if (get_user_rstats(id, izStats, izBody))
|
||||
{
|
||||
@ -1509,7 +1556,7 @@ public eventEndRound()
|
||||
// If first end round event in the round, calculate team score.
|
||||
if (!g_iRoundEndTriggered)
|
||||
{
|
||||
read_data(2, t_sText, MAX_TEXT_LENGTH)
|
||||
read_data(2, t_sText, charsmax(t_sText))
|
||||
|
||||
if (t_sText[7] == 't') // Terrorist wins
|
||||
g_izTeamScore[0]++
|
||||
@ -1549,6 +1596,9 @@ endround_stats()
|
||||
log_amx("End round stats")
|
||||
#endif
|
||||
|
||||
// Get and save round end stats time.
|
||||
g_fShowStatsTime = get_gametime()
|
||||
|
||||
for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
|
||||
{
|
||||
id = iaPlayers[iPlayer]
|
||||
@ -1557,44 +1607,12 @@ endround_stats()
|
||||
{
|
||||
kill_stats(id)
|
||||
}
|
||||
}
|
||||
|
||||
g_sAwardAndScore[0] = 0
|
||||
if (!g_izStatsSwitch[id])
|
||||
continue
|
||||
|
||||
// Create round awards.
|
||||
if (ShowMostDisruptive)
|
||||
add_most_disruptive(g_sAwardAndScore)
|
||||
if (ShowBestScore)
|
||||
add_best_score(g_sAwardAndScore)
|
||||
|
||||
// Create round score.
|
||||
// Compensate HUD message if awards are disabled.
|
||||
if (ShowTeamScore || ShowTotalStats)
|
||||
{
|
||||
if (ShowMostDisruptive && ShowBestScore)
|
||||
add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n")
|
||||
else if (ShowMostDisruptive || ShowBestScore)
|
||||
add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n")
|
||||
else
|
||||
add(g_sAwardAndScore, MAX_BUFFER_LENGTH, "^n^n^n^n^n^n")
|
||||
|
||||
if (ShowTeamScore)
|
||||
add_team_score(g_sAwardAndScore)
|
||||
|
||||
if (ShowTotalStats)
|
||||
add_total_stats(g_sAwardAndScore)
|
||||
}
|
||||
|
||||
save_team_chatscore()
|
||||
|
||||
// Get and save round end stats time.
|
||||
g_fShowStatsTime = get_gametime()
|
||||
|
||||
// Display round end stats to all players.
|
||||
for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
|
||||
{
|
||||
id = iaPlayers[iPlayer]
|
||||
show_roundend_hudstats(id, 0.0)
|
||||
format_roundend_hudstats(id, g_sAwardAndScore)
|
||||
show_roundend_hudstats(id, 0.0, g_sAwardAndScore)
|
||||
}
|
||||
|
||||
// Flag round end processed.
|
||||
@ -1632,13 +1650,13 @@ public end_game_stats()
|
||||
if (!g_izStatsSwitch[id])
|
||||
continue // Do not show any stats
|
||||
|
||||
cmdStatsMe(iaPlayers[iPlayer])
|
||||
cmdStatsMe(id)
|
||||
}
|
||||
}
|
||||
else if (EndTop15)
|
||||
{
|
||||
get_players(iaPlayers, iPlayers)
|
||||
format_top15(g_sBuffer)
|
||||
format_top15(0, g_sBuffer)
|
||||
|
||||
for (iPlayer = 0; iPlayer < iPlayers; iPlayer++)
|
||||
{
|
||||
@ -1647,7 +1665,7 @@ public end_game_stats()
|
||||
if (!g_izStatsSwitch[id])
|
||||
continue // Do not show any stats
|
||||
|
||||
show_motd(iaPlayers[iPlayer], g_sBuffer, "Top 15")
|
||||
show_motd(id, g_sBuffer, "Top 15")
|
||||
}
|
||||
}
|
||||
|
||||
@ -1674,7 +1692,7 @@ public eventShowRank(id)
|
||||
new izStats[8], izBody[8]
|
||||
new iRankPos, iRankMax
|
||||
|
||||
get_user_name(iPlayer, t_sName, MAX_NAME_LENGTH)
|
||||
get_user_name(iPlayer, t_sName, charsmax(t_sName))
|
||||
|
||||
iRankPos = get_user_stats(iPlayer, izStats, izBody)
|
||||
iRankMax = get_statsnum()
|
||||
@ -1691,7 +1709,7 @@ public client_connect(id)
|
||||
{
|
||||
if (ShowStats)
|
||||
{
|
||||
get_user_info(id, "_amxstatsx", t_sText, MAX_TEXT_LENGTH)
|
||||
get_user_info(id, "_amxstatsx", t_sText, charsmax(t_sText))
|
||||
g_izStatsSwitch[id] = (t_sText[0]) ? str_to_num(t_sText) : -1
|
||||
}
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user