is it possible to add health not set health?
#9

This will return the amount of health that went over 100
pawn Код:
stock GivePlayerHealth(playerid,Amount)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    new fcalc; fcalc = health + Amount;
    if(fcalc > 100)
    {
        fcalc = fcalc - 100;
        SetPlayerHealth(playerid,100);
        return fcalc;
    }else SetPlayerHealth(playerid,fcalc);
}
This is just more simple just a limit so doesn't go over 100
pawn Код:
stock GivePlayerHealth(playerid,Amount)
{
    new Float:health;
    GetPlayerHealth(playerid,health);
    new fcalc; fcalc = health + Amount;
    if(fcalc > 100) return SetPlayerHealth(playerid,100);
    SetPlayerHealth(playerid,fcalc);
    return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)