SA-MP Forums Archive
Question about SetTimer(Ex) - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Question about SetTimer(Ex) (/showthread.php?tid=77420)



Question about SetTimer(Ex) - Danny_Costelo - 11.05.2009

I was wondering, do I need a loop when using SetTimer, like for a ping check system? or is all cases?
And for SetTimerEx called on 'OnPlayerConnect', is there a need for a loop?

And the last question, in any case, Is it better to use SetTimer or SetTimerEx?, should I use SetTimerEx when it's possible?

The last question is regarding an anti-cheat.

I would appreciate a reply, from someone who actually understands this.


Re: Question about SetTimer(Ex) - MenaceX^ - 11.05.2009

Using SetTimerEx or SetTimer is depends on your case, it's totaly different, take it like Kick and Ban.
Both do the same but they have not the same format.


Re: Question about SetTimer(Ex) - Cueball - 11.05.2009

Ergh, this is exactly what the wiki is for - checking the function descriptions would have told you everything you need to know.

SetTimer() calls a function without specifiying the parameter values for that function. If there are any parameters for that function, they will all be set to 0.

SetTimerEx() calls a function the same way that SetTimer() does, but you can specify the values for the functions.

Here's an example:
pawn Код:
public MyFunction(param1, Float:param2)
{
  printf("%d, %.2f", param1, param2);
  return 1;
}

//---------------------------------------

SetTimer("MyFunction", 1000, 0); // The output from MyFunction() with this method will be: 0, 0.00

SetTimerEx("MyFunction", 1000, 0, "df", 10, 17.85); // The output from MyFunction() with this method will be: 10, 17.85

//---------------------------------------

forward MyFunction(param1, Float:param2); // Just so nobody whinges >.>
I hope this clears it up for you - SetTimerEx() is for setting parameters, SetTimer() will set them to 0 for you if there are any, or if not, it won't use any.

~Cueball~