Anti Health Hack doesn't work
#1

Hey guys, I am having issues with my anti health hack code
It works just fine, but sometimes it doesn't get fixed through the array
Here is the code:
PHP код:
public OnPlayerTakeDamage(playeridissueridFloat:amountweaponidbodypart)
{
    switch(
weaponid)
    {
        case 
525354:
        {
               if(
Health[playerid] > amountHealth[playerid] -= amount;
            else 
Health[playerid] = 0.0;
        }
        default:
        {
            if(!
SpawnProtected[playerid])
            {
                if(
Armour[playerid] > amountArmour[playerid] -= amount;
                else if(
Armour[playerid])
                {
                    
amount -= Armour[playerid];
                    
Armour[playerid] = 0.0;
                    if(
amount)
                    {
                        if(
Health[playerid] > amountHealth[playerid] -= amount;
                        else 
Health[playerid] = 0.0;
                    }
                }
                else if(
Health[playerid] > amountHealth[playerid] -= amount;
                else 
Health[playerid] = 0.0;
            }
        }
    }
    return 
1;

Here is the function (called every 3 seconds)
PHP код:
forward HealthHack();
public 
HealthHack()
{
    new 
Float:hpFloat:ap;
    foreach(new 
playerid Player)
    {
        if(
PlayerInfo[playerid][pSpawned] && !SpawnProtected[playerid] && !flying[playerid])
        {
            if(!
GivingHealth[playerid] && !GivingArmour[playerid])
            {
                
GetPlayerHealth(playeridhp);
                
GetPlayerArmour(playeridap);
                
printf("Debug Health: %.0f Armour: %.0f || HP: %.0f AP: %.0f"Health[playerid], Armour[playerid], hpap);
                if(
floatround(hpfloatround_tozero) != floatround(Health[playerid], floatround_tozero) || floatround(apfloatround_tozero) != floatround(Armour[playerid], floatround_tozero))
                    
AddBan(playeridRPN(playerid), "Anti Cheat""Health Hacking"RPIP(playerid));
            }
            else
            {
                
GivingHealth[playerid] = 0;
                
GivingArmour[playerid] = 0;
            }
        }
    }
    return 
1;

Anyone ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)