25.04.2012, 17:17
I would not use a timer here...
you could update the progress when you Value[playerid] ++;
why update it every 5000ms when you can update it only when needed.
something like
you could update the progress when you Value[playerid] ++;
why update it every 5000ms when you can update it only when needed.
something like
pawn Код:
new Bar:barid[MAX_PLAYERS];
new Value[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
barid[playerid] = //CreateProgressBar ( .. ) ;
ShowProgressBarForPlayer(playerid, barid[playerid]) ;
SetProgressBarValue(barid[playerid], Value[playerid]) ;
SetProgressBarMaxValue(barid[playerid], 10000);
//SetTimerEx("UpdateBar", 5000, true, "i", playerid) ;
return true ;
}
forward UpdateBar(playerid);
public UpdateBar(playerid)
{
SetProgressBarValue(barid[playerid], Value[playerid]) ;
UpdateProgressBar(barid[playerid], playerid);
return true;
}
//when you gain experience
Value[playerid] ++;
UpdateBar(playerid);