28.11.2013, 10:21
This is a calculation error.
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 Код:
new Float:CashDamage = 10/100*amount;
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;
}

