Try this, not tested.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <csstats>
#include <fakemeta>
#define PLUGIN "Spec Rank"
#define VERSION "1.0"
#define AUTHOR "Croxeye"
new g_SpecInfo
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
set_task(1.0, "SpecInfo", _, _, _, "b")
g_SpecInfo = CreateHudSyncObj()
}
public SpecInfo()
{
new players[32], num
get_players(players, num, "ch")
new id, target, szTargetName[32]
target = pev(id, pev_iuser2)
set_hudmessage(0, 85, 255, -1.0, 0.75, 0, 6.0, 1.0)
for(new i; i < num; i++)
{
id = players[i]
if(!is_user_alive(id))
{
if(!target)
continue
if(is_user_alive(target))
{
return PLUGIN_HANDLED;
}
get_user_name(target, szTargetName, charsmax(szTargetName))
new stats[8], body[8]
new rank_pos = get_user_stats(target, stats, body)
new rank_max = get_statsnum()
ShowSyncHudMsg(id, g_SpecInfo, "Spectating: %s ® Rank: %d of %d", szTargetName, rank_pos, rank_max)
}
}
return PLUGIN_HANDLED;
}
Or just change this:
PHP Code:
len = format(buffer, charsmax(buffer), "%L",LANG_PLAYER,"RANK");
to this:
PHP Code:
len = format(buffer, charsmax(buffer), "%L %d",LANG_PLAYER,"RANK", rank_pos);
and you need to define rank_pos
PHP Code:
new stats[8], body[8]
new rank_pos = get_user_stats(id, stats, body)