SA-MP Forums Archive
Fixes2 - 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: Fixes2 (/showthread.php?tid=524281)



Fixes2 - anou1 - 06.07.2014

Hi, I wanted to know if someone could explain me, how to use fixes2, cause I use SetTimer, and I wanted it to be more accurate.
But I dont understood how to use fixes2. Do I just have to download the plugin, set it and that's all ?
Or do I have to do something more to get more accurate timers with SetTimer ?



Thank you !



Source: https://sampforum.blast.hk/showthread.php?tid=375925


Re: Fixes2 - anou1 - 06.07.2014

UP

No one know please ?


Re: Fixes2 - BroZeus - 06.07.2014

to use it download the plugin
and paste this in at top of your script
pawn Code:
native SetTimer_(const func[], const delay, const interval, const count);
native SetTimerEx_(const func[], const delay, const interval, const count, const format[], {Float, _}:...);
native KillTimer_(timer) = KillTimer;
and use "SetTimer_" and "SetTimerEx_" instead of "SetTimer and "SetTimerEx"
the usage of them is pretty well explained in the topic


Re: Fixes2 - anou1 - 06.07.2014

I though that those native were here for an other usage. But if it's exactly the same than SetTimer, thank you


EDIT:

If I got this for exemple:
"SetTimer("SauvegardeJoueurs", 60000 * TEMPS_ENTRE_SAUVEGARDE_JOUEUR, true);"

How will it be with this plugin ? Thank you


Re: Fixes2 - BroZeus - 06.07.2014

like this
SetTimer_("SauvegardeJoueurs", 0, 60000 * TEMPS_ENTRE_SAUVEGARDE_JOUEUR, - 1);"


Re: Fixes2 - anou1 - 06.07.2014

Thank you !

I will try if it works IG.

+rep


Re: Fixes2 - anou1 - 06.07.2014

Sorry for the double post,


I actually have a problem, so I did this: "SetTimer_("SauvegardeJoueurs", 0, 60000 * TEMPS_ENTRE_SAUVEGARDE_JOUEUR, -1);"


And then in my SauvegardeJoueurs function I added a SendClientMessageToAll, to see IG when the timer starts.

So normally I should get a message every minute, but now I got sometime one message, sometimes 2 or 3 per min.


Code:
public SauvegardeJoueurs()
{
	SendClientMessageToAll(-1, "Save");
	foreach(new i : Player)
	{
		if(Connecte[i] == 1)
		{
			SauvegardeJoueur(i);
		}
	}
}
Do anyone know where's my problem ?

Thank you.


Re: Fixes2 - Crayder - 06.07.2014

Show us where you defined TEMPS_ENTRE_SAUVEGARDE_JOUEUR, that is what you are multiplying what the minute should be... 1 minute = 60000 ms, TEMPS_ENTRE_SAUVEGARDE_JOUEUR = ?...?


Re: Fixes2 - anou1 - 06.07.2014

TEMPS_ENTRE_SAUVEGARDE_JOUEUR = 1 So it should be a minute.



As you can see the message is repeated 2 times or 3 times in a minute sometimes.


Re: Fixes2 - Crayder - 06.07.2014

Is the timer set multiple times for some reason?