Wanted to make it better but then I remembered you could just add this line in your
addons/amxmodx/configs/stats.ini file and have the same functionality so I dropped it:
PHP Code:
SpecRankInfo ;Spec. Rank Info
PHP Code:
#include <amxmodx>
#include <csstats>
#include <fakemeta>
#include <hamsandwich>
// Cvaruri
new g_iIDPCVarHudEnable;
public plugin_init()
{
register_plugin("Hud Info", "1.1", "")
register_dictionary("statscfg.txt")
// Register Cvars
g_iIDPCVarHudEnable = register_cvar("credits_hudstats", "1");
RegisterHam(Ham_Spawn, "player", "fwHamSpawnPlayer", 1)
RegisterHam(Ham_Killed, "player", "fwHamKilledPlayer", 1)
}
public client_putinserver(iID)
{
set_task(1.0, "fwTaskShowHud", iID, .flags = "b")
}
public fwHamSpawnPlayer(const iID)
{
if (!is_user_alive(iID))
return;
remove_task(iID)
}
public fwHamKilledPlayer(const iID)
{
set_task(1.0, "fwTaskShowHud", iID, .flags = "b")
}
#if AMXX_VERSION_NUM <= 182
public client_disconnect(iID)
#else
public client_disconnected(iID)
#endif
{
remove_task(iID)
}
public fwTaskShowHud(const iID)
{
if (!get_pcvar_num(g_iIDPCVarHudEnable))
return;
// AMXX 182 and lower have issues and client disconnect forwards don't trigger for
// all the cases so we need to "manually" check if client is still connected too
#if AMXX_VERSION_NUM <= 182
if (!is_user_connected(iID))
{
remove_task(iID)
return;
}
#endif
new iIDSpec = pev(iID, pev_iuser2);
if(!iIDSpec || iIDSpec == iID)
return;
// Player max name length is 31
new szName[31];
get_user_name(iID, szName, charsmax(szName))
new iTemp[8], iRankSpec;
iRankSpec = get_user_stats(iIDSpec, iTemp, iTemp);
iTemp[0] = get_statsnum();
// Avoid using automatic channel and/or hud sync because they create hud flicker issues
set_hudmessage(0, 100, 250, -1.0, 0.78, 0, 0.0, 1.05, 0.0, 0.0, 2)
show_hudmessage(iIDSpec, "[ %L ^"%s^": %d/%d ]", iID, "ST_SPEC_RANK", szName, iRankSpec, iTemp[0])
}
__________________