SA-MP Forums Archive
Kill Timer Help - 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: Kill Timer Help (/showthread.php?tid=486918)



Kill Timer Help - MahdiGames - 11.01.2014

I want like that: "AntiSpawnTimerKill" because if not killed the timer this may cause lagg, Here is the CODE
OnPlayerSpawn:
Код:
   if(DMZone[playerid] >= 0)
    {
    SetPlayerHealth(playerid, 100000);
    SetTimerEx("AntiSpawnkill",4000,0,"i",playerid);
	}
Called this:
Код:
forward AntiSpawnkill(playerid);
public AntiSpawnkill(playerid)
{
    if(DMZone[playerid] == 0)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 1)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 2)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 3)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 4)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 5)
    {
    SetPlayerArmour(playerid,50);
   	SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 6)
    {
    SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 7)
    {
	SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 8)
    {
	SetPlayerHealth(playerid,100);
	}
    if(DMZone[playerid] == 9)
    {
	SetPlayerHealth(playerid,40);
    }
    if(DMZone[playerid] == 10)
    {
	SetPlayerHealth(playerid,40);
    }
    if(DMZone[playerid] == 11)
    {
	SetPlayerHealth(playerid,100);
    }
    if(DMZone[playerid] == 12)
    {
	SetPlayerHealth(playerid,100);
    }
    return 1;
}



Re: Kill Timer Help - Burridge - 11.01.2014

You're using SetTimerEx, and you have already set its repeating Boolean to 0. Therefore you don't need to kill that specific timer.


Re: Kill Timer Help - MahdiGames - 11.01.2014

No need to kill all timers with "SetTimerEX"?


Re: Kill Timer Help - Burridge - 11.01.2014

https://sampwiki.blast.hk/wiki/SetTimerEx - Have a read.

It depends what you set repeating parameter as. If you set it to 0 it only gets called once, and there is no need to kill it. However if you set it to 1 you need to kill it using KillTimer.