Well, I think Pawn has gone crazy
#1

Heya, Here is my HealthHack code:
PHP код:
forward HealthHack();
public 
HealthHack()
{
    new 
Float:hpFloat:ap;
    foreach(new 
playerid Player)
    {
        if(
PlayerInfo[playerid][pSpawned] && !SpawnProtected[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(
hp != Health[playerid] || ap != Armour[playerid]) AddBan(playeridRPN(playerid), "Anti Cheat""Health Hacking"RPIP(playerid));
            }
            else
            {
                
GivingHealth[playerid] = 0;
                
GivingArmour[playerid] = 0;
            }
        }
    }
    return 
1;

That's the latest printf on the console:
Код:
Debug Health: 100 Armour: 17 || HP: 100 AP: 17
I got banned after this, what the hell ...
Reply
#2

Try floatcmp

and you should print with %f to look exactly
Reply
#3

Comparing floats like this is risky, theres a rounding error in certain circumstances, so you got 100.000001 instead of 100.0. Better compare rounded values.

if(floatround(hp) != floatround(Health[playerid]) || floatround(ap) != floatround(Armour[playerid])) AddBan(playerid, RPN(playerid), "Anti Cheat", "Health Hacking", RPIP(playerid));
Reply
#4

Quote:
Originally Posted by Mauzen
Посмотреть сообщение
Comparing floats like this is risky, theres a rounding error in certain circumstances, so you got 100.000001 instead of 100.0. Better compare rounded values.

if(floatround(hp) != floatround(Health[playerid]) || floatround(ap) != floatround(Armour[playerid])) AddBan(playerid, RPN(playerid), "Anti Cheat", "Health Hacking", RPIP(playerid));
Had a quick edit to round method tozero since regular rounding was buggy
Now working smoothly, thank you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)