SA-MP Forums Archive
time 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: time help (/showthread.php?tid=239824)



time help - tanush - 14.03.2011

how do i make when player spawn, their health is 600000 for 5sec after it turns to 100(anti kill)


Respuesta: time help - Code8976Man - 14.03.2011

pawn Код:
public OnPlayerSpawn(playerid)
{
    SetPlayerHealth(playerid, 99999);
    SetTimerEx("AntiKill", 5000, false, "i", playerid);
}

public AntiKill(playerid)
{
    SetPlayerHealth(playerid, 100);
}



Re: time help - Medal Of Honor team - 14.03.2011

at top

new Float:healthz;

under OnPlayerSpawn

GetPlayerHealth(playerid, healthz);
SetPlayerHealth(playerid, 600000);
SetTimer("oldhealth", 5000, 0);

at last

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


Re: time help - antonio112 - 14.03.2011

Use:
pawn Код:
public OnPlayerSpawn(playerid)
{
       SetPlayerHealth( playerid, 600000 );
       SetTimer( "Health", 5000, 0 );
}
And out of any function:
pawn Код:
forward Health( playerid );
public Health( playerid )
{
     SetPlayerHealth( playerid, 100 );
}



Re: time help - Ironboy - 14.03.2011

try this
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetTimerEx("AntiSpawnKill",10000,false,"i",playerid);
    Antikill[playerid] = true;
    return 1;
}
pawn Код:
forward AntiSpawnKill(playerid);
public AntiSpawnKill(playerid)
{
    if(Antikill[playerid] == true)
    {
        SetPlayerHealth(playerid,100);
        SendClientMessage(playerid, 0xFF0000AA, "Anti-Spawnkill protection is over now!");
        Antikill[playerid] = false;
    }
    return 1;
}



Respuesta: Re: time help - Code8976Man - 14.03.2011

Quote:
Originally Posted by antonio112
Посмотреть сообщение
Use:
pawn Код:
public OnPlayerSpawn(playerid)
{
       SetPlayerHealth( playerid, 600000 );
       SetTimer( "Health", 5000, 0 );
}
And out of any function:
pawn Код:
forward Health( playerid );
public Health( playerid )
{
     SetPlayerHealth( playerid, 100 );
}
Fail -----> SetTimerEx!!


Re: time help - tanush - 14.03.2011

Quote:
Originally Posted by Ironboy
Посмотреть сообщение
try this
pawn Код:
public OnPlayerSpawn(playerid)
{
    SetTimerEx("AntiSpawnKill",10000,false,"i",playerid);
    Antikill[playerid] = true;
    return 1;
}
pawn Код:
forward AntiSpawnKill(playerid);
public AntiSpawnKill(playerid)
{
    if(Antikill[playerid] == true)
    {
        SetPlayerHealth(playerid,100);
        SendClientMessage(playerid, 0xFF0000AA, "Anti-Spawnkill protection is over now!");
        Antikill[playerid] = false;
    }
    return 1;
}
Actually i want 5000milliseconds but who cares, thanks


Re: Respuesta: Re: time help - antonio112 - 14.03.2011

Quote:
Originally Posted by Code8976Man
Посмотреть сообщение
Fail -----> SetTimerEx!!
Oh yea, you're completely right. Sorry for my mistake and thanks Code8976Man for pointing it out.