Little Question About Timers
#1

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);
}
Reply
#2

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

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
Reply
#4

Thanks IZN
Reply
#5

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
    }
}
Reply
#6

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?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)