Timer not being called - 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: Timer not being called (
/showthread.php?tid=356491)
Timer not being called -
SnG.Scot_MisCuDI - 03.07.2012
The timer is called once, but when another player is arrested it doesnt get called.
pawn Код:
CMD:arrest(playerid, params[])
{
//code here
jailed[targetid] = 1;
SetTimer("UnJail",30000,false);
//more code here
return 1;
}
Calling timer
pawn Код:
public UnJail()
{
for(new i; i < MAX_PLAYERS; i++)
{
if(jailed[i] == 1)
{
SetPlayerPos(i, 1555.097900, -1675.848754, 16.195312);
SetPlayerInterior(i, 0);
jailed[i] = 0;
}
return 1;
}
return 1;
}
Re: Timer not being called -
MP2 - 03.07.2012
Use SetTimerEx.
Re: Timer not being called -
SnG.Scot_MisCuDI - 03.07.2012
Quote:
Originally Posted by MP2
Use SetTimerEx.
|
Can you explain SetTimerEx?
Код:
(funcname[], interval, repeating, const format[], {Float,_}:...)
i dont understand the
on the samp wiki.
Re: Timer not being called -
WagnerPM - 03.07.2012
pawn Код:
CMD:arrest(playerid, params[])
{
//code here
jailed[targetid] = 1;
SetTimerEx("UnJail", 30000, true, "i", targetid);
//more code here
return 1;
}
Re: Timer not being called -
DeathTone - 03.07.2012
Quote:
Originally Posted by WagnerPM
pawn Код:
CMD:arrest(playerid, params[]) { //code here
jailed[targetid] = 1; SetTimerEx("UnJail", 30000, true, "i", targetid); //more code here return 1; }
|
Also you gotta change your forward and your function to:
pawn Код:
public UnJail(targetid)
{
if(jailed[targetid] == 1)
{
SetPlayerPos(targetid, 1555.097900, -1675.848754, 16.195312);
SetPlayerInterior(targetid, 0);
jailed[targetid] = 0;
}
return 1;
}
This will make it so every player has their own jail timer instead of everyone being unjailed at once.
Re: Timer not being called -
SnG.Scot_MisCuDI - 03.07.2012
Quote:
Originally Posted by DeathTone
Also you gotta change your forward and your function to:
pawn Код:
public UnJail(targetid) { if(jailed[targetid] == 1) { SetPlayerPos(targetid, 1555.097900, -1675.848754, 16.195312); SetPlayerInterior(targetid, 0); jailed[targetid] = 0; } return 1; }
This will make it so every player has their own jail timer instead of everyone being unjailed at once.
|
Thanks. Works now