settimer
#1

Im not sure if i shuld use Settimer or SetTimerEx... i want it to be for the player, and it starts wen they player connects, and its gonig to check the players health... im using SEttimer atm, and its ongamemodeinit is wen it starts...

on the public can i still use playerid? or do i need to use 'i' because its checking everyone....

if i cant use playerid, how can i make the timer use playerid?

thanks
Reply
#2

Firstly, about timers.
SetTimer should be used when you run global timer (for all server) while SetTimerEx should be used on the players.

If you want to put timer OnPlayerConnect then do next:
pawn Код:
SetTimerEx("FUNCTION",TIME,1,"d",playerid);
It will call a FUNCTION (which needs to be public and forwarded) each TIME milliseconds. If you use 0 instead of 1 timer will be called only one time, while 1 means repeately.

If you want to check something very frequently (anticheat?), I suggest you to use OnPlayerUpdate callback instead of very frequent timer.
More about it https://sampwiki.blast.hk/wiki/OnPlayerUpdate
and about SetTimerEx: https://sampwiki.blast.hk/wiki/SetTimerEx
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)