onPlayerTakeDamage
#1

Hi,

It's possible to do, if player take that amount of damage when player is dieding,to make player not die?
Reply
#2

Yes its possible
new Float:CurrentHealth[MAX_PLAYERS];

+

SetPlayerTeam
Reply
#3

Yes , it is
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:health;//declaring
    GetPlayerHealth(playerid,health);//checking his health
    if (health < 30.0)//if his health less than 30 you can edit that.
    {
        SetPlayerHealth(playerid, 100);//re-heal him back to full health amount.
    }
    return 1;
}
EDIT: Ops sorry jefff.
Reply
#4

But i try.. When player have a 1 HP, i jump from high build, and i have dead.. Yes, i got 100HP, but i want to make, you don't die.
Reply
#5

Use SetPlayerHealth(playerid, Float:0x7F800000);
Reply
#6

I don't want to have a lot of HP.. I just want, when you have to die, you will be will alive, you will get HP.
Reply
#7

I can think of two ways to make this but you will have to script them yourself.

#1: If you want to fix that player dies when you fall from high, you gotta check for animations. If player has the falling animation, set the timer and set his health to Float:0x7F800000. When the animation will stop kill the timer and set players health to 100 or to what it was before player fell. If this method is not going to work, use MapAndreas plugin or include and set players pos to the ground to prevent him from falling.

#2: This way is a bit of noticeable but will work. When player dies, get his current position and set a death variable to true. After, under OnPlayerSpawn, if death variable is true, set players pos to where he died. This is tricky and if you have stats system, you will need variable for death so other statements won't not be counting or whatever.

Good luck.

EDIT: You will still need to use the OnPlayerTakeDamage callback for both methods.

Also, I'm not sure if you can somehow return 0 under OnPlayerDeath callback, don't know what will happen but once you start scripting, test it as well besides to what you actually going to script. If it would work like this, it would of prevent from the rest of the code being executed.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)