Health and Armour Hacks Anticheat
#7

I mean something like that
pawn Код:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(issuerid != INVALID_PLAYER_ID) {
        new Float:armour; GetPlayerArmour(playerid, armour);
        if(armour > 0)
        {
            ACArmour[playerid] = ACArmour[playerid] - amount;
            SetPlayerArmourEx(playerid, ACArmour[playerid]);
        }
        else
        {
            new Float:hp; GetPlayerHealth(playerid, hp);
            ACHealth[playerid] = ACHealth[playerid] - amount;
            SetPlayerHealthEx(playerid, ACHealth[playerid]);
        }
    } else {
        SetPVarInt(playerid,"SafeBan",1);
        new Float:hp; GetPlayerHealth(playerid, hp);
        ACHealth[playerid] = ACHealth[playerid] - amount;
        SetPlayerHealthEx(playerid, ACHealth[playerid]);
    }
    return 1;
}

public OnPlayerGiveDamage(playerid, damagedid, Float: amount, weaponid)
{
    new Float:armour; GetPlayerArmour(damagedid, armour);
    if(armour > 0)
    {
        ACArmour[damagedid] = ACArmour[damagedid] - amount;
        SetPlayerArmourEx(damagedid, ACArmour[damagedid]);
    }
    else
    {
        new Float:hp; GetPlayerHealth(damagedid, hp);
        ACHealth[damagedid] = ACHealth[damagedid] - amount;
        SetPlayerHealthEx(damagedid, ACHealth[damagedid]);
    }
    return 1;
}

//ACHealth[playerid] = 100.0; ACArmour[playerid] = 0.0; OnPlayerConnect/Disconnect
//ACHealth[playerid] = 0.0; OnPlayerDeath.

public AntiCheat()
{
    new Query[200],
        ip[24]
    ;
    new string[250];
    foreach(new i : Player)
    {
        new weap = GetPlayerWeapon(i),
            Float:health,
            Float:armour
        ;
        GetPlayerHealth(i, health);
        GetPlayerArmour(i, armour);
        if(health > 0 && health != ACHealth[i])
        {
            if(GetPVarInt(playerid,"SafeBan") == 0) {
                ClearChatBox(i, 100);
                GetPlayerIp(i, ip, 24);
                format(string, sizeof string, "» %s(%d) has been banned by AntiCheat | Reason: Health Hack", GetName(i), i);
                SendClientMessageToAllEx(COLOR_RED, string);
                SendClientMessageEx(i, COLOR_YELLOW, "AntiCheat: "white"[30] Wassup with your heal, Hahaha i caught you!");
                SendClientMessageEx(i, COLOR_RED, "You've been banned from the server, Reason: Health Hacks!");
                SendClientMessageEx(i, COLOR_GREEN, "If you think this is mistake create a ban appeal on the forum!");
                format(Query, sizeof(Query), "UPDATE `bans` SET `Temporary` = 0, `IP` = '%s', `Month` = 1, `Days` = 1, `Years` = 1970, `NAME` = '%s', `REASON` = 'Health Hacks', `BannedBy` = 'AC' WHERE `NAME` = '%s'", ip, DB_Escape(GetName(i)), DB_Escape(GetName(i)));
                db_query(Database, Query);
                db_free_result(db_query(Database, Query));
                KickDelay(i);
                format(string, sizeof string, "%s has been banned by Anitcheat, Reason: Health Hack", GetName(i));
                SaveLogs("aclog", string);
                return 1;
            } else {
                SetPVarInt(playerid,"SafeBan",0);
            }
        }
        if(armour > 0 && armour != ACArmour[i])
        {
            ClearChatBox(i, 100);
            GetPlayerIp(i, ip, 24);
            format(string, sizeof string, "» %s(%d) has been banned by AntiCheat | Reason: Armour Hack", GetName(i), i);
            SendClientMessageToAllEx(COLOR_RED, string);
            SendClientMessageEx(i, COLOR_YELLOW, "AntiCheat: "white"[30] Wassup with your armour shield, Hahaha i caught you!");
            SendClientMessageEx(i, COLOR_RED, "You've been banned from the server, Reason: Armour Hacks!");
            SendClientMessageEx(i, COLOR_GREEN, "If you think this is mistake create a ban appeal on the forum!");
            format(Query, sizeof(Query), "UPDATE `bans` SET `Temporary` = 0, `IP` = '%s', `Month` = 1, `Days` = 1, `Years` = 1970, `NAME` = '%s', `REASON` = 'Armour Hacks', `BannedBy` = 'AC' WHERE `NAME` = '%s'", ip, DB_Escape(GetName(i)), DB_Escape(GetName(i)));
            db_query(Database, Query);
            db_free_result(db_query(Database, Query));
            KickDelay(i);
            format(string, sizeof string, "%s has been banned by Anitcheat, Reason: Armour Hack", GetName(i));
            SaveLogs("aclog", string);
            return 1;
        }
    }
    return 1;
}

forward SetPlayerHealthEx(playerid, Float:health);
public SetPlayerHealthEx(playerid, Float:health)
{
    ACHealth[playerid] = health;
    return SetPlayerHealth(playerid, ACHealth[playerid]);
}
forward SetPlayerArmourEx(playerid, Float:armour);
public SetPlayerArmourEx(playerid, Float:armour)
{
    ACArmour[playerid] = armour;
    return SetPlayerArmour(playerid, ACArmour[playerid]);
}
Or you can try run the function (anticheat) between getplayerhealth and setplayerhealthex without a timer
Reply


Messages In This Thread
Health and Armour Hacks Anticheat - by JaKe Elite - 30.10.2013, 11:11
Re: Health and Armour Hacks Anticheat - by JaKe Elite - 31.10.2013, 08:44
Re: Health and Armour Hacks Anticheat - by iJumbo - 31.10.2013, 08:53
Re: Health and Armour Hacks Anticheat - by Ninad - 31.10.2013, 08:53
Re: Health and Armour Hacks Anticheat - by iJumbo - 31.10.2013, 08:57
Re: Health and Armour Hacks Anticheat - by JaKe Elite - 31.10.2013, 10:36
Re: Health and Armour Hacks Anticheat - by iJumbo - 31.10.2013, 10:43
Re: Health and Armour Hacks Anticheat - by JaKe Elite - 01.11.2013, 13:59
Re: Health and Armour Hacks Anticheat - by Konstantinos - 01.11.2013, 14:08
Re: Health and Armour Hacks Anticheat - by JaKe Elite - 01.11.2013, 14:19

Forum Jump:


Users browsing this thread: 2 Guest(s)