• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Pawn] timers sometime work sometime doesnt work
#1
[Video: https://www.dailymotion.com/video/x7xqv85]

First time I try to show but its gone for no reason
00:01 > 00:06 Ignore after that

Code:
forward OnProgressUpdate(playerid, progress, objective);
forward OnProgressFinish(playerid, objective);

StartProgress(playerid, duration, startvalue = 0, objective)
{
if(ProgressState[playerid] == 1)
return 0;

stop ProgressTimer[playerid];
ProgressTimer[playerid] = repeat ProgressUpdate(playerid, objective);

ProgressLimit[playerid] = duration;
ProgressProgress[playerid] = startvalue;
ProgressState[playerid] = 1;
ProgressObject[playerid] = objective;

SetPlayerProgressBarMaxValue(playerid, PlayerProgressJob[playerid], ProgressLimit[playerid]);
SetPlayerProgressBarValue(playerid, PlayerProgressJob[playerid], ProgressProgress[playerid]);
ShowPlayerProgressBar(playerid, PlayerProgressJob[playerid]);
PlayerTextDrawShow(playerid, PlayerJobCountTD[playerid]);

return 1;
}

StopProgress(playerid)
{
if(ProgressState[playerid] == 0)
return 0;

stop ProgressTimer[playerid];
ProgressLimit[playerid] = 0;
ProgressProgress[playerid] = 0;
ProgressState[playerid] = 0;
ProgressObject[playerid] = INVALID_OBJECT_ID;

HidePlayerProgressBar(playerid, PlayerProgressJob[playerid]);
PlayerTextDrawHide(playerid, PlayerJobCountTD[playerid]);

return 1;
}

timer ProgressUpdate[100](playerid, objective)
{
if(ProgressProgress[playerid] >= ProgressLimit[playerid])
{
StopProgress(playerid);
CallLocalFunction("OnProgressFinish", "dd", playerid, objective);
return;
}

SetPlayerProgressBarMaxValue(playerid, PlayerProgressJob[playerid], ProgressLimit[playerid]);
SetPlayerProgressBarValue(playerid, PlayerProgressJob[playerid], ProgressProgress[playerid]);
ShowPlayerProgressBar(playerid, PlayerProgressJob[playerid]);

CallLocalFunction("OnProgressUpdate", "ddd", playerid, ProgressProgress[playerid], objective);

ProgressProgress[playerid];

return;
}

This all function is from SSS and I mix to my script
And here how I use

Code:
StartProgress(playerid, 100, 0, objectid);

Already fix it
Put stop ProgressTimer[playerid]; under OnPlayerDisconnect
  Reply


Forum Jump: