Timers
#1

I completely have no clue how SetTimer works and i can't wrap my head around how the samp wiki explains it, i dont understand how to put it into a command etc. could anyone explain it with examples please? it will be much appreciated.
Reply
#2

SetTimer("message", 1000, false);

message - your name of your function ( need a public + forward )

1000 - the timer of 1000 miliseconds ( 1 second )

false -its repeating,if the timer should repeatedly or only once

SetTimerEx - Is setting the timer with more parameters,example for one player

i really dont know how to explain this in other version .. i think wiki it says good xd
Reply
#3

I'll try to explain from what I believe you ask for.

pawn Code:
new timer = SetTimerEx("KickInactivePlayers",1000*60*10,true,playerid);

forward KickInactivePlayers(playerid);
public KickInactivePlayers(playerid)
{
     if(!IsPlayerActive(playerid)) Kick(playerid);
     return 1;
}
Where "1000*60*10" is actually:
Code:
1000 milliseconds * 60 (= 1 minute) * 10 (= 10 minutes)
Anytime you need to cancel this timer, just use:

pawn Code:
KillTimer(timer);
And ofcourse you'd have to state a function for:
pawn Code:
IsPlayerActive(playerid)
Hope it helps!
Reply
#4

thanks <3
Reply
#5

Quote:
Originally Posted by Mr.Valdez
View Post
thanks <3
No problem
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)