Posts: 1,648
Threads: 482
Joined: Jun 2010
pawn Код:
new Float: armour, Float:Health;
GetPlayerArmour(playerid, armour);
GetPlayerHealth(playerid, Health);
new Float: newam, Float: newam2;
newam = armour;
newam2 = Health;
if(armour > 0)
{
if(weaponid == 22) SetPlayerArmour(playerid, newam-15);//m4
if(weaponid == 31) SetPlayerArmour(playerid, newam-25);//m4
if(weaponid == 30) SetPlayerArmour(playerid, newam-20);//ak
if(weaponid == 34) SetPlayerArmour(playerid, newam-90);//sniper
if(weaponid == 29) SetPlayerArmour(playerid, newam-20);//mp5
if(weaponid == 24) SetPlayerArmour(playerid, newam-30);//deagle
if(weaponid == 4) SetPlayerArmour(playerid, newam-35);//knife
if(weaponid == 26) SetPlayerArmour(playerid, newam-25);
}
Basically, it reduces the damage but eventually regenerates to 100% again.
This is under OnPlayerTakeDamage.
Posts: 1,648
Threads: 482
Joined: Jun 2010
That won't make a difference..
Posts: 1,648
Threads: 482
Joined: Jun 2010
Posts: 1,506
Threads: 13
Joined: Jun 2015
PHP код:
new Float:armour, Float:hp;
GetPlayerArmour(playerid, armour);
if(Float:armour > 0.0)
{
if(Float:armour > FIST_DAMAGE)
{
GetPlayerArmour(playerid, armour);
SetPlayerArmour(playerid, armour - FIST_DAMAGE);
}
else
{
new Float:newer;
newer = FIST_DAMAGE - armour;
SetPlayerArmour(playerid, 0);
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid, hp - newer);
}
}
else
{
GetPlayerHealth(playerid, hp);
SetPlayerHealth(playerid, hp - FIST_DAMAGE);
}
}
Your code isn't perfect, see my code and you will understand, and yes, its your anti-cheat fucking with it.
Posts: 10,066
Threads: 38
Joined: Sep 2007
Reputation:
0
If "newam" is less than the amount of damage to begin with then you will end up with a negative number. That's basic math. Since SetPlayerArmour presumbably only works with unsigned number it will interpret a negative number as an extremely huge positive number.