14.06.2013, 19:36
Here's mine code for health and armour adjusting.
Example:
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;
}
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;
}