Health/Armour bug
#1

I'm making my anti-cheat, however, the health and armour doesn't "decrease" in the OnPlayerTakeDamage.

Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid, bodypart)
{
	printf("Armour amount: %d", PlayerInfo[playerid][Armour]);
	if(PlayerInfo[playerid][Armour] >= 1)
	{
	    PlayerInfo[playerid][Armour] -= amount;
	    printf("(A)Amount taken: %f", amount);
	    SetArmour(playerid, PlayerInfo[playerid][Armour]);
	    printf("New armour: %f", PlayerInfo[playerid][Armour]);
	    if(PlayerInfo[playerid][Armour] == 1)
	    {
	        SetArmour(playerid, 0);
	    }
	}
	if(PlayerInfo[playerid][Health] >= 1)
	{
	    PlayerInfo[playerid][Health] -= amount;
	    printf("(H)Amount taken: %f", amount);
	    SetHealth(playerid, PlayerInfo[playerid][Health]);
	    printf("New Health: %f", PlayerInfo[playerid][Health]);
	    if(PlayerInfo[playerid][Health] == 1)
	    {
	        SetHealth(playerid, 0);
	    }
	}
    return 1;
}
As you can see I've tried debugging to see if it works, though that doesn't even print.
Note that the "SetArmour" and "SetHealth" are apart of my anticheat.
Reply
#2

Anyone?
Reply
#3

https://sampwiki.blast.hk/wiki/SetPlayerHealth
https://sampwiki.blast.hk/wiki/SetPlayerArmour

SetPlayerHealth, SetPlayerArmour

So you obviously have a custom SetHealth, show us that.
Reply
#4

Also, can you see if OnPlayerTakeDamage prints anything at all? Try printing the amount value instead of the armour value.

Another thing;

pawn Код:
printf("Armour amount: %d", PlayerInfo[playerid][Armour]);
Correct me if wrong but I think PlayerInfo[playerid][Armour] is a float, not an integer.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)