SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Scripting Help

Reply
 
Thread Tools Display Modes
Old 07/06/2016, 06:32 AM   #1
Dokins
Banned
 
Join Date: Jun 2010
Posts: 1,651
Reputation: 53
Default Which is better Per Player Timer or Global timer? (issue with timer)

Several and randomly timers stop working in samp.

I use 1 global timer for all players using foreach however it seems that it suddenly stops working and won't run every minute.
It updates variables like
Jail time etc.

I've been having a lot of issues with timers including inaccuracies and I have to restart the server just to fix.

I have killed all timers ongamemodeexit

I don't think using per player timers is exactly efficient? I mean say I had 500 players online (not likely just saying) wouldn't that cause serious issue?

Thanks,
Grant
Dokins is offline   Reply With Quote
Old 07/06/2016, 07:10 AM   #2
Onfroi
Banned
 
Join Date: Jan 2012
Location: Dallas, Texas
Posts: 1,509
Reputation: 226
Default Re: Which is better Per Player Timer or Global timer? (issue with timer)

Yes, use y_timers or try to use gettime instead of timers anywhere you can, starting with that jail time
Onfroi is offline   Reply With Quote
Old 07/06/2016, 07:21 AM   #3
justice96
Guest
 
Posts: n/a
Default Re: Which is better Per Player Timer or Global timer? (issue with timer)

global timer,

task dokinstimer[1000](){ return 1;}
  Reply With Quote
Old 07/06/2016, 09:49 AM   #4
Vince
Spam Machine
 
Vince's Avatar
 
Join Date: Sep 2007
Location: Belgium
Posts: 10,089
Reputation: 2655
Default Re: Which is better Per Player Timer or Global timer? (issue with timer)

This has been discussed many, many times already and it was established that many timers with tiny bits of fast code would be better than one large timer with slow code. Timers are also roughly 20% too fast. If you want a true 1 second timer you should actually use something like 850 ms instead.
__________________
Vince is offline   Reply With Quote
Old 07/06/2016, 10:50 AM   #5
Dokins
Banned
 
Join Date: Jun 2010
Posts: 1,651
Reputation: 53
Default Re: Which is better Per Player Timer or Global timer? (issue with timer)

I see but would this cause my timers to mess up and ultimately stop working? My timer is actually about 25% slow but the other is accurate. When I use timer fix it appears not to work and a random timer stops I'm completely lost.

The code under the one minute timer is pretty big wouldn't this cause a lot of issues if I did per player?
Dokins is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Slice's Timer Fix include --> timer public function isn't getting called Riwerry Scripting Help 0 02/01/2016 04:50 PM
What's better: per-player timers or a global timer? Aerotactics Scripting Help 3 29/10/2015 07:51 AM
One "global" timer or "Per-player" timer? Kyance Scripting Help 8 15/11/2014 05:30 PM
A timer that loops through all players or a timer for each player? x-cutter Help Archive 2 28/05/2011 04:35 PM
Global Timer? UberSocks Help Archive 2 29/01/2010 12:13 PM


All times are GMT. The time now is 11:50 PM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.