[Include] Irresistible Anticheat & Weapon Shot Sync System (Lightweight)
#1

Irresistible Anticheat

An extension of my renowned fuckCleo project. More up to date and more powerful.

The anticheat handles everything included in this enumerator (including the commented parts).

The whole system is modular, so ideally you can copy the things you need.

An example, is the recent bot attack hack. I have made a script recently to mitigate this as much as possible.

I'm making a seperate thread for this because it is a key take from open sourcing my gamemode.

90% of the hacks your server will face will automatically be mitigated with the help from this anticheat.

Download

zeelorenc/sf-cnr/tree/master/gamemodes/irresistible/anticheat

(All the files in that link are a part of the anticheat). Put them all in a folder.

Documentation

CHEAT_TYPE_MONEY

This has its own functions. I haven't bothered to hook giveplayermoney just to be absolutely safe. Only thing not Plug n Play is this.

GivePlayerCash( playerid, amount )
GetPlayerCash( playerid )

Introduces OnPlayerMoneyChanged callback as well.
pawn Code:
#if defined AC_INCLUDED
    public OnPlayerMoneyChanged( playerid, amount )
    {
        // save player money on each monetary movement
        if ( IsPlayerLoggedIn( playerid ) )
        {
            mysql_single_query( sprintf( "UPDATE `USERS` SET `CASH` = %d WHERE `ID` = %d", GetPlayerCash( playerid ), GetPlayerAccountID( playerid ) ) );
        }
        return 1;
    }
#endif
CHEAT_TYPE_PLAYERBUGGER

Restores player position if it is very exaggerated/far at random.

CHEAT_TYPE_WEAPON

Almost flawless. But no ammo detection. Just simple weapon hack detection. I'd say 99% accurate.

CHEAT_TYPE_CARWARP

If a car flies randomly it won't be synced to other players.

CHEAT_TYPE_FAKEKILL

When a player spams deaths / or death by another individual.

CHEAT_TYPE_REMOTE_JACK

Abnormal remote jacking detection. Large credit to JernejL.

CHEAT_TYPE_HEALTH / ARMOUR

While writing this I noticed these types are redundant due to my new system.

It is based off client-sided shooting and has the most basic/lightweight validation.

10x more lightweight than slice's one. 600 lines. His is 6000. Not a diss.

Replaced callbacks:
pawn Code:
#if defined AC_INCLUDED
public OnPlayerDeathEx( playerid, killerid, reason, Float: damage, bodypart )
#else
public OnPlayerDeath( playerid, killerid, reason )
#endif
{
    return 1;
}

#if defined AC_INCLUDED
public OnPlayerTakePlayerDamage( playerid, issuerid, &Float: amount, weaponid, bodypart )
{
    return 1; // returning 0 will prevent user from taking damage (THIS IS A BIG FEATURE!)
}
#endif
Note, has a RARE bug when a player dies with 99 damage. It simply will not register their death, nothing big. To be fixed by someone hopefully soon.

CHEAT_TYPE_AIRBRAKE

Credit to Emmet_. I don't think I made this, but I do recall Kar helping to improve this.

This was years ago. I don't speak frequently with these blokes anymore.

CHEAT_TYPE_PROAIM

90% accurate at first detection. 99% accurate after 3 lines of spam.

CHEAT_TYPE_AUTOCBUG

Same thing.

90% accurate at first detection. 99% accurate after 3 lines of spam.

CHEAT_TYPE_FLYHACKS

Pretty accurate for basic fly hack detection.

CHEAT_TYPE_RAPIDFIRE

That annoying hack where people shoot snipers, and other weapons very fast.

CHEAT_TYPE_CAR_PARTICLE_SPAM

When a car's doors etc are spammed all over the place by a hacker. Pretty accurate (should desync the player ideally).

CHEAT_TYPE_PICKUP_SPAM

When a user picks up a lot of pickups in a short timespan.

90% accurate at first detection. 99% accurate after 3 lines of spam.

Instructions

It is designed to be plug and play. REQUIRES YSI 3.
  1. Copy the anticheat folder into your includes folder
  2. #include "anticheat\_anticheat.pwn"
Sample code in your gamemode after including (more samples in the whole sf-cnr project e.g gamemodes/sf-cnr.pwn):

pawn Code:
#if defined AC_INCLUDED
    public OnPlayerCheatDetected( playerid, detection, params )
    {
        if ( detection == CHEAT_TYPE_REMOTE_JACK )
        {
            if ( GetPlayerScore( playerid ) < 200 )
            {
                SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for abnormally jacking vehicles.", ReturnPlayerName( playerid ), playerid );
                SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL JACKING]"COL_GREY" %s(%d) - %d score - %d ping - %s IP", ReturnPlayerName( playerid ), playerid, GetPlayerScore( playerid ), GetPlayerPing( playerid ), ReturnPlayerIP( playerid ) );
                return Kick( playerid ), 1;
            }
            SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL JACKING]"COL_GREY" %s(%d) is a suspect of jacking vehicles abnormally.", ReturnPlayerName( playerid ), playerid );
        }
        else if ( detection == CHEAT_TYPE_RAPIDFIRE )
        {
            SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for rapid-firing.", ReturnPlayerName( playerid ), playerid );
            Kick( playerid );
        }
        else if ( detection == CHEAT_TYPE_FAKEKILL )
        {
            SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for fake-killing.", ReturnPlayerName( playerid ), playerid );
            BanEx( playerid, "Fake-kill" );
        }
        else if ( detection == CHEAT_TYPE_CARWARP )
        {
            if ( ! GetPlayerAdminLevel( playerid ) )
            {
                SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for car warping.", ReturnPlayerName( playerid ), playerid );
                BanEx( playerid, "Car Warp" );
            }
        }
        else if ( detection == CHEAT_TYPE_AIRBRAKE )
        {
            //SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for airbraking.", ReturnPlayerName( playerid ), playerid );
            //AdvancedBan( playerid, "Server", "Airbrake", ReturnPlayerIP( playerid ) );
            SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL MOVEMENT]"COL_GREY" %s(%d) has been detected for airbrake.", ReturnPlayerName( playerid ), playerid );
        }
        else if ( detection == CHEAT_TYPE_FLYHACKS )
        {
            SendClientMessageToAdmins( -1, ""COL_PINK"[ABNORMAL MOVEMENT]"COL_GREY" %s(%d) has been detected for fly hacks.", ReturnPlayerName( playerid ), playerid );
            // SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for fly hacks.", ReturnPlayerName( playerid ), playerid );
            // AdvancedBan( playerid, "Server", "Fly Hacks", ReturnPlayerIP( playerid ) );
        }
        else if ( detection == CHEAT_TYPE_WEAPON )
        {
            SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for weapon hack (%s).", ReturnPlayerName( playerid ), playerid, ReturnWeaponName( params ) );
        }
        else if ( detection == CHEAT_TYPE_CAR_PARTICLE_SPAM )
        {
            SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been kicked for car particle spam.", ReturnPlayerName( playerid ), playerid );
            Kick( playerid );
        }
        else if( detection == CHEAT_TYPE_PICKUP_SPAM )
        {
            SendGlobalMessage( -1, ""COL_PINK"[ANTI-CHEAT]{FFFFFF} %s(%d) has been banned for rapid pickup spam.", ReturnPlayerName( playerid ), playerid );
            BanEx( playerid, "Pickup Spam" );
        }
        else
        {
            SendClientMessageToAdmins( -1, ""COL_PINK"[ANTI-CHEAT]"COL_GREY" %s(%d) has been detected for %s.", ReturnPlayerName( playerid ), playerid, AC_DetectedCheatToString( detection ) );
        }
        return 1;
    }
#endif
Designed to work with all my (Irresisitible Gaming) gamemodes (currently only the SF-CNR & COD projects).

Then you are done.

Final notes

I have honestly rushed to make this thread, but yeah. I've made my anticheat so simple that it should be pretty understandable to most scripters.

There are a lot of samples in the SF-CNR repo. Just use the GitHub search feature for specific things etc.

I'll try attend simple questions here but for now my help is honestly limited.
Reply


Messages In This Thread
Irresistible Anticheat & Weapon Shot Sync System (Lightweight) - by Lorenc_ - 19.04.2019, 07:52

Forum Jump:


Users browsing this thread: 1 Guest(s)