SA-MP Forums Archive
Tipps for working with 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Tipps for working with Timers (/showthread.php?tid=93509)



Tipps for working with Timers - Stas92 - 25.08.2009

Hey Guys,
I noticed that timers in pawn makes some problems. Do somebody have some tipps, how I can work with timers und how optimize them?


Re: Tipps for working with Timers - James_Alex - 25.08.2009

for how the timer works see here
https://sampwiki.blast.hk/wiki/SetTimer


Re: Tipps for working with Timers - Stas92 - 25.08.2009

No no, I know how they work. Look, I mean that, for example you shouldn't use to many Timers ... things like this.


Re: Tipps for working with Timers - Stas92 - 27.08.2009

How many function supports a single timer?


Re: Tipps for working with Timers - Stas92 - 27.08.2009

That I already know, but what i mean is this: (example)

I have a timer (1000ms) and this timer checks, if the player is ... if he is ... and if ... if ... if ... if ... if ... if ... and so on ..

How many statements are good for a single timer? And what I to much?

// Sry, but my English isn't very well

Edit: How many different funtions can i unit in a single timer?




Re: Tipps for working with Timers - kaisersouse - 27.08.2009

You don't want to make it too big. Nested if statements are okay to a point, switch statements are better.

Sometimes people try to reinvent the world in a timer and then wonder why it lags.




Re: Tipps for working with Timers - Stas92 - 29.08.2009

How can I make this timers better:

SetTimer("UpdateData", 5000, 1);
SetTimer("SaveAccounts", 1800000, 1);
SetTimer("PickupGametexts", 995, 1);
SetTimer("FuelTimer", 15000, 1);

SetTimer("PayDay",60000,1);

SetTimer("Timer1", 501, 1);
SetTimer("Timer2", 800, 1);
SetTimer("JailTimer", 1000, 1); // Must be 1000 because of some Textdraw Countdowns


Re: Tipps for working with Timers - ded - 29.08.2009

Quote:

SetTimer("SaveAccounts", 1800000, 1);

Unnecessary really, why not just save them OnPlayerDisconnect? And when they crash, etc. it will save, no?


Re: Tipps for working with Timers - Stas92 - 29.08.2009

You are right, thanks.




Re: Tipps for working with Timers - ded - 29.08.2009

Quote:
Originally Posted by Stas92
You are right, thanks.
No problem