SA-MP Forums Archive
Little Question About Timers - 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: Little Question About Timers (/showthread.php?tid=589642)



Little Question About Timers - leo9 - 21.09.2015

Hello,
My question is that what will be if we use non repeatable timers repeatable like this?will be use high memory after minutes?
Код:
public OnGameModeInit()
{
    SetTimer("TestFunction",1000,false);
}
forward TestFunction();
public TestFunction()
{
    SetTimer("TestFunction",1000,false);
}



Re: Little Question About Timers - karemmahmed22 - 21.09.2015

It will eat CPU no more XD.
You can just make it repeatable.


Re: Little Question About Timers - iZN - 21.09.2015

This is a tutorial from awhile back, you should read this up. It's quite important, also do read the points given by AndreT below. If you can't find the post, I've posted the link below aswell.

Tutorial: https://sampforum.blast.hk/showthread.php?tid=356005
AndreT's post: http://forum.sa-mp.com/showpost.php?...57&postcount=6
Tutorial about UNIX timestamp: https://sampforum.blast.hk/showthread.php?tid=254915


Re: Little Question About Timers - leo9 - 21.09.2015

Thanks IZN


Re: Little Question About Timers - M0HAMMAD - 21.09.2015

pawn Код:
new Timer;
public OnGameModeInit()
{
    SetTimer("TestFunction",1000,false);
}
forward TestFunction();
public TestFunction()
{
    if(Timer != 2) Timer ++;//2 minutes past and the timers start working :D
    if(Timer == 2)
    {
        //Code
    }
}



Re: Little Question About Timers - Mowgli - 21.09.2015

Quote:
Originally Posted by iZN
Посмотреть сообщение
This is a tutorial from awhile back, you should read this up. It's quite important, also do read the points given by AndreT below. If you can't find the post, I've posted the link below aswell.

Tutorial: https://sampforum.blast.hk/showthread.php?tid=356005
AndreT's post: http://forum.sa-mp.com/showpost.php?...57&postcount=6
Tutorial about UNIX timestamp: https://sampforum.blast.hk/showthread.php?tid=254915
How important actually is this though?

Where is the proof this improves CPU usage?