I found a code snippet that I wrote a year and 4 months ago:
PHP Code:
#include <amxmodx>
#include <fakemeta>
#define PLUGIN "Status Bar"
#define VERSION "1.0"
#define AUTHOR "KliPPy"
new const g_classname[] = "barent";
new status = -1;
new g_msgBarTime;
new g_maxplayers;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_clcmd("oduzmi", "cmdOduzmi");
register_clcmd("say pocni", "cmdPocni");
g_msgBarTime = get_user_msgid("BarTime2");
new ent = engfunc(EngFunc_CreateNamedEntity, engfunc(EngFunc_AllocString, "info_target"));
set_pev(ent, pev_classname, g_classname);
set_pev(ent, pev_nextthink, 3.0);
register_forward(FM_Think, "fwThink");
g_maxplayers = get_maxplayers();
}
public cmdOduzmi()
status -= 1
public cmdPocni()
status = 99;
public fwThink(ent)
{
if(!pev_valid(ent))
return FMRES_IGNORED;
static szClassname[32];
pev(ent, pev_classname, szClassname, charsmax(szClassname));
if(!equal(szClassname, g_classname))
return FMRES_IGNORED;
for(new i = 0; i < g_maxplayers; i++)
{
if(!is_user_alive(i) || !is_user_connected(i))
continue;
message_begin(MSG_ONE, g_msgBarTime, _, i)
write_short(10000);
write_short(status);
message_end();
}
set_pev(ent, pev_nextthink, get_gametime() + 0.5);
return FMRES_IGNORED;
}
(Don't you dare to critique coding style and inefficiency, it all was written quickly for testing purposes).
I hope you can see what have I done in here to keep the bar static, and you should use 65535 in write_short() instead of 10000(again, it was all for testing purposes so I input a random number), than you can update it even slower than 0.5 seconds I think.
And I am curious right now, why did VALVe put second parameter as short instead of byte, since you shouldn't go over 100(percents) anyway.