Kill Timer Help
#1

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;
}
Reply
#2

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

No need to kill all timers with "SetTimerEX"?
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)