SA-MP Forums Archive
Timer problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Timer problem (/showthread.php?tid=620628)



Timer problem - Micko123 - 01.11.2016

I have problem with timer. I want it to go from 180 to 0.
PHP код:
forward Mission1TimeOut(playerid);
public 
Mission1TimeOut(playerid)
{
    new 
time 180;
    if(
time >= 1)
    {
        
TimeLeftTimer(playerid);
        new 
string[5];
        
time -= 1;
        
format(stringsizeof(string), "%i"time);
        
PlayerTextDrawSetString(playeridTimerTD[playerid][1], string);
    }
    else
    {
        
time 0;
    }
    return 
1;

It goes to 179 and stops there
I also tried with
PHP код:
time --; 
But still the same

Here is SetTimerEx
PHP код:
Mission1TimeTimer SetTimerEx("Mission1TimeOut"1000false"i"playerid); 
What could be the problem?


Re: Timer problem - Micko123 - 01.11.2016

Fixed.. Problem was that this
PHP код:
new time 180
Should be global because every time timer is called new 180 is created..

DAMN i was stupid