KillTimer not work - 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 not work (
/showthread.php?tid=435750)
KillTimer not work -
Guest123 - 08.05.2013
hello i created filterscripts called " health hack "
it works but i can't off it
header
pawn Код:
#include <a_samp>
new endhack[MAX_PLAYERS];
#pragma tabsize 0
This Is Error
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cchackon", cmdtext, true) == 0)
{
endhack[playerid] = SetTimerEx("SetPlayerHealth70", 100, false, "i", playerid);
return 1;
}
if (strcmp("/cchackoff", cmdtext, true) == 0)
{
KillTimer(endhack[playerid]);
return 1;
}
return 0;
}
How To Make The Random Health (Health Hack)
pawn Код:
forward SetPlayerHealth70(playerid);
public SetPlayerHealth70(playerid)
{
SetPlayerHealth(playerid, 70);
SetPlayerArmour(playerid, 70);
SetTimerEx("SetPlayerHealth50", 100, false, "i", playerid);
return 1;
}
forward SetPlayerHealth50(playerid);
public SetPlayerHealth50(playerid)
{
SetPlayerHealth(playerid, 50);
SetPlayerArmour(playerid, 50);
SetTimerEx("SetPlayerHealth20", 100, false, "i", playerid);
return 1;
}
forward SetPlayerHealth20(playerid);
public SetPlayerHealth20(playerid)
{
SetPlayerHealth(playerid, 20);
SetTimerEx("SetPlayerHealth100", 100, false, "i", playerid);
SetPlayerArmour(playerid, 20);
return 1;
}
forward SetPlayerHealth100(playerid);
public SetPlayerHealth100(playerid)
{
SetPlayerArmour(playerid, 100);
SetPlayerHealth(playerid, 100);
SetTimerEx("SetPlayerHealth70", 100, false, "i", playerid);
return 1;
}
Re: KillTimer not work -
Guest123 - 08.05.2013
help ??
Re: KillTimer not work -
SuperViper - 08.05.2013
Inside your functions you need to declare the variable
endhack to the timer once again because another timer is created.
Re: KillTimer not work -
IceCube! - 08.05.2013
THat is a fairly un-optimized way of creating a Health Hack... Just activate a variable called HealthHack then do this
pawn Код:
OnPlayerTakeDamage()
if(HealthHack == 1)
{
SetPlayerHealth(playerid, 99999):
}
return 1;
}
Re: KillTimer not work -
LarzI - 08.05.2013
Quote:
Originally Posted by SuperViper
[...] you need to re-assign the variable [...]
|
Declaration is when you use new, static, stock infront of the variable names to add it to your script
Assignment is when you use symbols like =, +=, -=.