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



Questions.. - viddo - 20.03.2012

This code is a part of a filterscript that suppose to set the player frozen and in an anim for some time like in a death way But in someway the player wont use the animation nor gets frozen

Код:
public OnPlayerSpawn(playerid)
{
        IsAfterLifing[playerid] = 0;
        if (IsDead[playerid] == 1)
        {
            TogglePlayerControllable(playerid,false);
            ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_DIE", 4.0, 0, 0, 0, 1, 0);
            SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
            SCM(playerid,CYAN,"------------------ Health Advise -----------------");
            SCM(playerid,WHITE,"You are bleeding to death.");
            SCM(playerid,WHITE,"If you are lucky, the medics will help you.");
            SCM(playerid,WHITE,"You can type /acceptdeath to give up and die.");
            SCM(playerid,CYAN,"--------------------------------------------------------");
            return 1;
        }
        return 1;
}
Another question
I have made that auto bleeding code that makes the player loses hp every 1 minute if his hp is 20 or lower but it wont lose after any time !!!

Код:
public CheckHealth(playerid)
{
    new Float:Health;
    GetPlayerHealth(playerid,Health);
    if(Health < 20)
    {
        new hptimer;
        hptimer = SetTimer("losehp",1000,true);
    }
    return 1;
}

forward hptimer(playerid);
public hptimer(playerid)
{
   new Float:Health;
   GetPlayerHealth(playerid, Health);
   SetPlayerHealth(playerid, Health -5); 
   return 1;
}



Re: Questions.. - MP2 - 21.03.2012

Debug it to check what IsDead is set to. Make sure you set it under OnPlayerDeath correctly, including making sure killerid != INVALID_PLAYER_ID.


Re: Questions.. - Ricey - 21.03.2012

Not Sure... But Try Something like This.

Quote:

public OnPlayerSpawn(playerid)
{
IsAfterLifing[playerid] = 0;
if (IsDead[playerid] == 1)
{
ApplyAnimation(playerid,"PARACHUTE","FALL_skyDive_ DIE", 4.0, 0, 0, 0, 1, 0);
SetTimerEx("AutoDeath",AUTODEATH_SECONDS * 1000,false,"i",playerid);
TogglePlayerControllable(playerid,0);
SCM(playerid,CYAN,"------------------ Health Advise -----------------");
SCM(playerid,WHITE,"You are bleeding to death.");
SCM(playerid,WHITE,"If you are lucky, the medics will help you.");
SCM(playerid,WHITE,"You can type /acceptdeath to give up and die.");
SCM(playerid,CYAN,"--------------------------------------------------------");
return 1;
}
return 1;
}