SA-MP Forums Archive
SetTimerEx being called for one person only? - 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: SetTimerEx being called for one person only? (/showthread.php?tid=533844)



SetTimerEx being called for one person only? - Aerotactics - 26.08.2014

I'm almost certain this has been answered before, and I remember seeing it somewhere...but my script is only calling SetTimerEx for a specific playerid, when it should call for any playerid:



Yes, FlyTimer is defined for MAX_PLAYERS, this section of script is under a command, and FreeCam is a public function:




Re: SetTimerEx being called for one person only? - Abagail - 26.08.2014

You want it to loop/repeat...? That may be the issue... If it's too busy looping for a specific player it might not end up working for the player you want it to. Just a thought.


Re: SetTimerEx being called for one person only? - Aerotactics - 26.08.2014

I don't think that's the issue.


Re: SetTimerEx being called for one person only? - Dignity - 26.08.2014

use a loop

edit; dont use "25", its called in ms, so using 25 is worse than using OnPlayerUpdate


Re: SetTimerEx being called for one person only? - Aerotactics - 26.08.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
use a loop

edit; dont use "25", its called in ms, so using 25 is worse than using OnPlayerUpdate
So would changing to 250 be more efficient? I used 25 in order to be sure that the timer was looping as fast as possible. I didn't know it could stop other loops from functioning.


Re: SetTimerEx being called for one person only? - Dignity - 26.08.2014

Quote:
Originally Posted by Aerotactics
Посмотреть сообщение
So would changing to 250 be more efficient? I used 25 in order to be sure that the timer was looping as fast as possible. I didn't know it could stop other loops from functioning.
Use 1000, which is one second. Also, I doubt it stops other loops from functioning, but judging from your code you're only making the timer function for one player and not more, so it's rather obvious it only works for one player.

Use foreach to loop through all players and then use your code


Re: SetTimerEx being called for one person only? - Aerotactics - 26.08.2014

The problem with that is, it needs to loop at 25 ms to keep the movement of an object as smooth as possible, else the object moves jerky and static-like.

I'm not trying to make the timer start for all players at once, only the player who used the command. For now, it only works on ID 0, or the first player to use the command, I'm guessing.


Re: SetTimerEx being called for one person only? - Dignity - 26.08.2014

It doesn't need to run on 25 ms, because if it does it'll be going faster than necessary. Using 25ms is extremely inefficient as well.

Also, if you showed us your actual code instead of 3 line snippets we'd be able to help you better.


Re: SetTimerEx being called for one person only? - Aerotactics - 26.08.2014

Quote:
Originally Posted by Mionee
Посмотреть сообщение
It doesn't need to run on 25 ms, because if it does it'll be going faster than necessary. Using 25ms is extremely inefficient as well.

Also, if you showed us your actual code instead of 3 line snippets we'd be able to help you better.
100 ms makes the object move static-like, 250 is even worse. I may have figured out the problem...


Re: SetTimerEx being called for one person only? - Pottus - 26.08.2014

You are probably better using OPU than a timer to be honest.