SA-MP Forums Archive
Timer only killing for ID 0 on pickup - 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 only killing for ID 0 on pickup (/showthread.php?tid=449644)



Timer only killing for ID 0 on pickup - cloudysky - 09.07.2013

Heya straight to the point here, my timer doesnt seem to kill unless you are ID 0, can anyone help.

pawn Код:
public OnPlayerPickUpPickup(playerid, pickupid)
{
    if(pickupid == cure)
    {
        if(PlayerInfo[playerid][Infected] == 1)
        {
            SendClientMessage(playerid, COLOUR_CYAN, "In a panic, you quickly flip the lid of the vial open and down it's contents, feeling refreshed." );
            KillTimer(KillInfectionTimer[playerid]);
            KillTimer(KillSymptomsTimer[playerid]);
            PlayerInfo[playerid][Carrier] = 0;
            PlayerInfo[playerid][Infected] = 0;
            PlayerInfo[playerid][Bit] = 0;
            SaveUser(playerid);
        }



Re: Timer only killing for ID 0 on pickup - ReV. - 09.07.2013

Show us the timer.


Re: Timer only killing for ID 0 on pickup - cloudysky - 09.07.2013

pawn Код:
public InfectionTimer(playerid)
{
    {
        new Float: health;
        PlayerInfo[playerid][Infected] = 1;
        GetPlayerHealth(playerid, health);
        SetPlayerHealth(playerid, health - 10);
        SaveUser(playerid);
    }
    return 1;
}



Re : Timer only killing for ID 0 on pickup - yusei - 09.07.2013

The SetTimerEx line Please


Re: Timer only killing for ID 0 on pickup - cloudysky - 09.07.2013

pawn Код:
KillInfectionTimer[i] = SetTimerEx( "InfectionTimer", 60000, true, "i", i);



Re : Timer only killing for ID 0 on pickup - yusei - 09.07.2013

PHP код:
public InfectionTimer(playerid)
{
        new 
Floathealth;
        
PlayerInfo[playerid][Infected] = 1;
        
GetPlayerHealth(playeridhealth);
        
SetPlayerHealth(playeridhealth 10);
        
SaveUser(playerid);
        return 
1;

dont use loop here

KillInfectionTimer[i] = SetTimerEx( "InfectionTimer", 60000, true, "i", i);


Re: Timer only killing for ID 0 on pickup - cloudysky - 09.07.2013

Sorry i don't follow what you mean :S


AW: Timer only killing for ID 0 on pickup - roym899 - 09.07.2013

Most likely the i when setting the timer is wrong. Please show the code surrounding this KillInfectionTimer[i] = SetTimerEx( "InfectionTimer", 60000, true, "i", i);