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



Timer - emokidx - 14.02.2012

pawn Код:
timerid = SetTimer("Health", 1000, true); // this is in /god command
 KillTimer(timerid); // in /godoff


forward Health(playerid);
public Health(playerid)
{
    SetPlayerHealth(playerid, 100);
}
this only makes id 0 invulnerable and m confused


Re: Timer - Fires - 14.02.2012

post the god cmd


Re: Timer - vakhtang - 14.02.2012

Try
pawn Код:
timerid = SetTimer("Health", 1000, true); // this is in /god command
 KillTimer("timerid"); // in /godoff


forward Health(playerid);
public Health(playerid)
{
    SetPlayerHealth(playerid, 100);
}



Re: Timer - emokidx - 14.02.2012

edit: deleted


Re: Timer - vakhtang - 14.02.2012

EDIT:
pawn Код:
timerid = SetTimer("Health", 1000, true); // this is in /god command
 KillTimer(timerid); // in /godoff


forward Health(playerid);
public Health(playerid)
{
    SetPlayerHealth(playerid, 100);
}



Re: Timer - emokidx - 14.02.2012

oh yeah sorry it is like this


Re: Timer - Universal - 14.02.2012

pawn Код:
// Change timerid variable into array
// Find the new timerid; and change it into this:
new timerid[MAX_PLAYERS];

// Its SetTimerEx not SetTimer!
timerid[playerid] = SetTimerEx("Health", 1000, true, "d", playerid);

// In /godoff
KillTimer(timerid[playerid]);

// This'll be called each second
forward Health(playerid);
public Health(playerid)
{
    // Checking if player's connected
    if(!IsPlayerConnected(playerid))
        KillTimer(timerid[playerid]);
    else
        SetPlayerHealth(playerid, 100.0);
    return 1;
}



Re: Timer - sansko - 14.02.2012

you know you wont be invulnerable to explosives that kill you at once


Re: Timer - emokidx - 14.02.2012

yup i will be changed the setplayerhealth to something greater

thnx a lot!