[Tutorial] Easy Anti-Health hack.
#9

Quote:
Originally Posted by pds2k12
View Post
I believe Health Hack can be easily detected starting in 0.3z because there is a new callback called OnPlayerWeaponShot, I am not sure if my code will work it is un-tested but I know you can detect Health Hack using OnPlayerWeaponShot

pawn Code:
static stock
    AC_StartHPTick[ MAX_PLAYERS ];

#define MAX_HPWARNING (3)

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    new
        string[ 90 ], name[ MAX_PLAYER_NAME ], Float:Health, Float:Armour;

    GetPlayerArmour(hitid, Armour), GetPlayerHealth(hitid, Health), GetPlayerName(hitid, name, MAX_PLAYER_NAME);

    if(hittype == BULLET_HIT_TYPE_PLAYER)
    {
        if(Health >= 99.0 && Armour <= 0.0)
        {  
            ++ AC_StartHPTick[ playerid ];
        }
        else if(AC_StartHPTick[ playerid ] >= MAX_HPWARNING)
        {
            format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
            SendClientMessageToAll(-1, string);
        }
        else
        {
            AC_StartHPTick[ playerid ] = 0;
        }
    }
    return true;
}
You need to get player's armour and health after the if(hittype == BULLET_HIT_TYPE_PLAYER) check, otherwise you are applying them functions on objects and vehicles which is wrong.

It would be like this:

pawn Code:
static stock
    AC_StartHPTick[ MAX_PLAYERS ];

#define MAX_HPWARNING (3)

public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
{
    if(hittype == BULLET_HIT_TYPE_PLAYER)
    {
        new
        string[ 90 ], name[ MAX_PLAYER_NAME ], Float:Health, Float:Armour;

        GetPlayerArmour(hitid, Armour), GetPlayerHealth(hitid, Health), GetPlayerName(hitid, name, MAX_PLAYER_NAME);

        if(Health >= 99.0 && Armour <= 0.0)
        {  
            ++ AC_StartHPTick[ playerid ];
        }
        else if(AC_StartHPTick[ playerid ] >= MAX_HPWARNING)
        {
            format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
            SendClientMessageToAll(-1, string);
        }
        else
        {
            AC_StartHPTick[ playerid ] = 0;
        }
    }
    return true;
}
Also what is 'static stock' and what's wrong with using the 'new' parameter?


About anti-cheat:

You really need to read cessil's thread about making a successful anti-cheat. The way you made it, if somebody uses a vending machine 3 times, it will get him banned. You need to take care of every possible way someone can get healed on your server means, you need to make completely server side health system such as make custom shops, remove vending machines and a lot more.
Reply


Messages In This Thread
Easy Anti-Health hack. - by Kyance - 19.01.2014, 12:22
Re: Easy Anti-Health hack. - by JeromeG - 19.01.2014, 12:37
Re: Easy Anti-Health hack. - by Pottus - 19.01.2014, 12:39
Re: Easy Anti-Health hack. - by Omar55555 - 19.01.2014, 12:56
Re: Easy Anti-Health hack. - by Kyance - 19.01.2014, 13:03
Re: Easy Anti-Health hack. - by Lordzy - 19.01.2014, 13:03
Re: Easy Anti-Health hack. - by Kyance - 19.01.2014, 13:08
Re: Easy Anti-Health hack. - by Patrick - 19.01.2014, 13:25
Re: Easy Anti-Health hack. - by Cypress - 19.01.2014, 15:37
Re: Easy Anti-Health hack. - by Hoborific - 23.01.2014, 02:46

Forum Jump:


Users browsing this thread: 1 Guest(s)