Anti Health Hack doesn't work
#1

Hey guys, here is a quick script I made using someone's help from the forums, and I was wondering why is it bugged ...
Here is the code:
PHP код:
public OnPlayerGiveDamage(playeriddamagedidFloat:amountweaponidbodypart)
{
    if(!
SpawnProtected[damagedid])
    {
        if(
Armour[damagedid] > amountArmour[damagedid] -= amount;
        else if(
Armour[damagedid])
        {
            
amount -= Armour[damagedid];
            
Armour[damagedid] = 0.0;
            if(
amount)
            {
                if(
Health[damagedid] > amountHealth[damagedid] -= amount;
                else 
Health[damagedid] = 0.0;
            }
        }
        else if(
Health[damagedid] > amountHealth[damagedid] -= amount;
        else 
Health[damagedid] = 0.0;
        new 
Float:hpFloat:ap;
        
GetPlayerHealth(damagedidhp);
        
GetPlayerArmour(damagedidap);
        if(
Health[damagedid] != hp || Armour[damagedid] != ap) return AddBan(damagedidRPN(damagedid), "Anti Cheat""Health Hacking"RPIP(damagedid));
    }
    return 
1;

When you get hit, your HP&AP lost is reduced from your HP & AP server sided array, if it's different = get banned.
The bug is: Even if I am not using any hacks, I am getting banned, anyone ?
Reply
#2

I guess it's because when you do something under OnPlayerTakeDamage it does all the stuff before player loses health so basically you recude the amount from the variable and after that you get the player's actual health which didn't lose that "amount" of health yet so they differ. For example you got 100 health, the amount is 50, you remove amount from the variable, there's 50 left in the variable, but when you get the actual health after that it's still 100, because it will take the actual health after all of that stuff so I guess only way is adding serversided weapon damages.
Reply
#3

OnPlayerGiveDamage/OnPlayerTakeDamage is called AFTER the health&armour is reduced or before ?
Reply
#4

Before.
Reply
#5

Best way for anti health & armour hacks = set max HP and Armour to 99, in ammunitions admin cmds & check with a timer if its > 99 : Ban.

Worked for my CnR at least, you gotta remove vendor machines tho
Reply
#6

Quote:
Originally Posted by iLearner
Посмотреть сообщение
Best way for anti health & armour hacks = set max HP and Armour to 99, in ammunitions admin cmds & check with a timer if its > 99 : Ban.

Worked for my CnR at least, you gotta remove vendor machines tho
Don't you think it's possible to set less than 99 HP ? (using hacks)
Reply
#7

Usually & most likely they set to 100%.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)