KillTimer - 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: KillTimer (
/showthread.php?tid=526132)
KillTimer -
SnG.Scot_MisCuDI - 15.07.2014
Im having a problem with killing my timer.. Its excecuting the second timer but its not killing DrugHealth
pawn Код:
SetTimerEx("DrugHealth", 5_000, true, "if", playerid, h);
pawn Код:
public DrugHealth(playerid, float)
{
new Float:h;
GetPlayerHealth(playerid, h);
if(h < 100)
{
SetPlayerHealth(playerid, h+10);
Info[playerid][Grams]--;
}
else if (h >= 100) return SetTimerEx("DrugHealthDone", 1_000, false, "if",playerid, float);
return 1;
}
public DrugHealthDone(playerid, float)
{
SendClientMessage(playerid, COLOR_GREEN, "The drugs have replenished your health");
SetPlayerDrunkLevel(playerid, 0);
KillTimer(DrugHealth(playerid, float));
return 1;
}
Re: KillTimer -
Blast3r - 15.07.2014
Because you didn't create it as anything.
pawn Код:
DrugHealth = SetTimerEx("DrugHealthDone", 1_000, false, "if",playerid, float);
As example.
EDIT: Then kill is as KillTimer(DrugHealth);
Re: KillTimer -
Smileys - 15.07.2014
there's quite a few things I'd like to point out there.
Quote:
SetTimerEx("DrugHealth", 5_000, true, "if", playerid, h);
|
5_000? what's that? lol, shouldn't it be 5000?
second of all:
when you wanna kill a timer, you should define it first, like
pawn Код:
new Timer[ MAX_PLAYERS char ];
Timer{ playerid } = SetTimerEx( ... );
// then in the drughealthdone:
KillTimer( Timer{ playerid } );
Re: KillTimer -
SnG.Scot_MisCuDI - 15.07.2014
Quote:
Originally Posted by Blast3r
Because you didn't create it as anything.
pawn Код:
DrugHealth = SetTimerEx("DrugHealthDone", 1_000, false, "if",playerid, float);
As example.
EDIT: Then kill is as KillTimer(DrugHealth);
|
Thank you
Quote:
Originally Posted by Smileys
there's quite a few things I'd like to point out there.
5_000? what's that? lol, shouldn't it be 5000?
second of all:
when you wanna kill a timer, you should define it first, like
pawn Код:
new Timer[ MAX_PLAYERS char ]; Timer{ playerid } = SetTimerEx( ... );
// then in the drughealthdone: KillTimer( Timer{ playerid } );
|
5_000 is the same exact thing as 5000, i prefer doing it that way
Thank you, also