What is better? - 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: What is better? (
/showthread.php?tid=647752)
What is better? -
zsoolt997 - 10.01.2018
Create a timer for all players (~500ms timer) or looping through all the connected players in a ~500ms timer too.
I will use y_timers.
Re: What is better? -
RIDE2DAY - 10.01.2018
If the code you're going to execute isn't too heavy you might use a task and loop through the connected players with y_iterate:
PHP Code:
task my_task[500]()
{
// General code here.
foreach(new i : Player)
{
// Per-player code here.
}
}
As an alternative, you might use a ptask, much better in my opinion:
PHP Code:
ptask my_player_task[500](playerid)
{
// Per-player code here.
}
Player tasks start to run when players connect while global tasks run always. You can read more about tasks here:
https://sampforum.blast.hk/showthread.php?tid=571044
Anyway, if you're wondering what's better regarding your original question, a timer for each player is the way to go. Take a look to this thread:
https://sampforum.blast.hk/showthread.php?tid=643553
Re: What is better? -
zsoolt997 - 10.01.2018
Thanks!