01.01.2015, 20:03
I'm trying to get those who have variable ARMADURA, receives less damage, and it will have 3 levels, which would lose more, because it is not working properly?
code
no errors in compilation, but in game have this error
Life .... 100
Slapped player ARMOR == 0 (without this script)
His life was for: 81
A ARMOR player == 3 his life was for: 108
code
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
if(ARMADURA[playerid] > 0) {
if(ARMADURA[playerid] == 1)
{
new Float: Colete,
Float: Vida;
GetPlayerArmour(playerid, Colete);
GetPlayerHealth(playerid, Vida);
if(Colete-amount > 0.0)
{
SetPlayerArmour(playerid, Colete+amount*15.0/100.0);
}else{
SetPlayerHealth(playerid, Vida+amount*15.0/100.0);
}
}
if(ARMADURA[playerid] == 2)
{
new Float: Colete,
Float: Vida;
GetPlayerArmour(playerid, Colete);
GetPlayerHealth(playerid, Vida);
if(Colete-amount > 0.0)
{
SetPlayerArmour(playerid, Colete+amount*30.0/100.0);
}else{
SetPlayerHealth(playerid, Vida+amount*30.0/100.0);
}
}
if(ARMADURA[playerid] == 3)
{
new Float: Colete,
Float: Vida;
GetPlayerArmour(playerid, Colete);
GetPlayerHealth(playerid, Vida);
if(Colete-amount > 0.0)
{
SetPlayerArmour(playerid, Colete+amount*50.0/100.0);
}else{
SetPlayerHealth(playerid, Vida+amount*50.0/100.0);
}
}
}
return 1;
}
pawn Код:
SetPlayerArmour(playerid, Colete+amount*50.0/100.0);
}else{
SetPlayerHealth(playerid, Vida+amount*50.0/100.0);
Slapped player ARMOR == 0 (without this script)
His life was for: 81
A ARMOR player == 3 his life was for: 108