Tipps for working with Timers
#1

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

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

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

How many function supports a single timer?
Reply
#5

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?

Reply
#6

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.

Reply
#7

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

Quote:

SetTimer("SaveAccounts", 1800000, 1);

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

You are right, thanks.

Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)