OnPlayerTakeDamage.
#5

Here's mine code for health and armour adjusting.

pawn Код:
HealthAdjust(playerid, Float:Health, Float:Armour, Float:Damage)
{
    if(armour <= 100.0)
        Armour -= Damage;
    if(armour <= 0.0)
    {
        Armour = 0.0;
        Health -= Damage;
        if(Health <= 0.0) Health = 0.0;
    }
    SetPlayerHealth(playerid, Health);
    SetPlayerArmour(playerid, Armour);
    return 1;
}
Example:

pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    new Float:health, Float:armour;
    GetPlayerHealth(playerid, health);
    GetPlayerArmour(playerid, armour);
    if(issuerid != INVALID_PLAYER_ID)
    {
        switch(weaponid)
        {
            case 22: { //Colt
                HealthAdjust(playerid, health, armour, amount+27.0);
            }
        }
    }
    return 1;
}
Reply


Messages In This Thread
OnPlayerTakeDamage. - by DaniceMcHarley - 14.06.2013, 18:36
Re: OnPlayerTakeDamage. - by Pottus - 14.06.2013, 18:51
Re: OnPlayerTakeDamage. - by DaniceMcHarley - 14.06.2013, 19:12
Re: OnPlayerTakeDamage. - by DaniceMcHarley - 14.06.2013, 19:28
Re: OnPlayerTakeDamage. - by B-Matt - 14.06.2013, 19:36

Forum Jump:


Users browsing this thread: 3 Guest(s)