30.11.2013, 16:29
What xVIP3Rx said. Everytime RobberyBar is called, it gets initialized at 0 and then it goes 1. It'll never reach greater value. It should be global and don't forget to reset it too.
I believe you should use each progress bar per player. MyRobberyBar will update for all.
pawn Код:
// Let's save few memory:
// global:
new robbingtime[MAX_PLAYERS char];
// OnPlayerConnect:
robbingtime{ playerid } = 0;
pawn Код:
if(RobbingWangCars[i] > 1) //When player is robbing
{
RobbingWang[i] --;
WangRobbedRecently =200;
robbingtime{ playerid } = 0;
ShowProgressBarForPlayer(playerid, MyRobberyBar);
RobbingTime = SetTimerEx("RobberyBar",1000,true,"i",i);
}
pawn Код:
forward RobberyBar(playerid);
public RobberyBar(playerid)
{
robbingtime{ playerid }++;
SetProgressBarValue(MyRobberyBar,robbingtime);
UpdateProgressBar(MyRobberyBar, playerid);
if(robbingtime{ playerid } == 15)
{
robbingtime{ playerid } = 0;
KillTimer(RobbingTime);
HideProgressBarForPlayer(playerid,MyRobberyBar);
}
}