SetPlayerHealth problem
#4

This is a calculation error.
pawn Код:
new Float:CashDamage = 10/100*amount;
Lets say for example, that you take an amount of damage '8'. (Thus, amount = 8 )

CashDamage = 10 / 100 * amount
CashDamage = 10 / 100 * 8
CashDamage = 0.1 * 8
CashDamage = 0.8

Therefore, you're pretty much only taking away less than 1 health at a time if a player is taking 8 damage. Reducing the damage dramatically.

I have a feeling this is not the outcome you were looking for, so I think this might be a more appropriate code:
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    switch(weaponid)
    {
        case 27, 28, 33, 37 .. 39, 41:
        {
            new Float:CashDamage = 10 * amount; //Because 100 * amount / 10 = 100 / 10 * amount = 10 * amount'
            //Now 10x the damage is a very drastic increase in damage, I would suggest 4x or 5x, making it CashDamage = 4 * amount || CashDamage = 5 * amount
            new Float:PHealth;
            GetPlayerHealth(playerid, PHealth);
            SetPlayerHealth(playerid, (PHealth - CashDamage));
        }
    }
    return 1;
}
Reply


Messages In This Thread
SetPlayerHealth problem - by SlonCHL - 28.11.2013, 05:44
Re: SetPlayerHealth problem - by vakhtang - 28.11.2013, 06:11
Re: SetPlayerHealth problem - by SlonCHL - 28.11.2013, 06:21
Re: SetPlayerHealth problem - by Threshold - 28.11.2013, 10:21

Forum Jump:


Users browsing this thread: 1 Guest(s)