time help
#1

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

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

public AntiKill(playerid)
{
    SetPlayerHealth(playerid, 100);
}
Reply
#3

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)
}
Reply
#4

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

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

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!!
Reply
#7

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
Reply
#8

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


Forum Jump:


Users browsing this thread: 1 Guest(s)