[FilterScript] Aero's Anti-Cheat
#1

Aero's Anti-Cheat
About
I couldn't find an anti-cheat that fit my needs, and I wanted one that didn't require me to change my GM in order to see if it worked. This script runs right out of the box, and you don't need to edit your gamemode AT ALL! This filterscript is very basic, in that it will spot obvious hacks, but won't catch everything. If you want to get a better anti-cheat than this, expect to rewrite half your gamemode just to see if it still works.

Features
pawn Код:
/*
Features:
-Anti Weapon Hack
-Anti Money Hack
-Anti Health Hack
-Anti Armour Hack
-Anti Vehicle Health Hack
-Anti God Mode
-Anti Fly Hack
*/
Settings
pawn Код:
new BanWeap[] = { 35, 36, 37, 38, 44, 45};
new Max_Cash = 9999999;
new Cash_Increment = 1000;
new bool:BanPlayers = false;
BanWeap[] - These are the weapon IDs you wish to ban from the server

Max_Cash - exactly as it sounds, the maximum amount of cash a player is able to have at any time.

Cash_Increment - the maximum amount of money a player can receive at any given time.

BanPlayers - if set to true, bans any cheating players, else it just kicks them.

Script
pawn Код:
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
//                            Aero's Anti-Cheat                               //
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\//
/*
Features:
-Anti Weapon Hack
-Anti Money Hack
-Anti Health Hack
-Anti Armour Hack
-Anti Vehicle Health Hack
-Anti God Mode
-Anti Fly Hack
*/

#define FILTERSCRIPT

#include <a_samp>

#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
    print("\n--------------------------------------");
    print(" Aero's Anticheat Filterscript");
    print("--------------------------------------\n");
    return 1;
}
#endif

//Defines
#define COLOR_WHITE 0xFFFFFFFF
#define COLOR_RED 0xAA0000FF
#define COLOR_GOLD 0xDCB700FF
#define COLOR_GREEN 0x00AA00FF
#define COLOR_BLUE 0x0000AAFF

#define SCM SendClientMessage
#define SCMA SendClientMessageToAll
#define SCMX SendClientMessageEx

//Settings and Variables
new BanWeap[] = { 35, 36, 37, 38, 44, 45};
new Max_Cash = 9999999;
new Cash_Increment = 1000;
new bool:BanPlayers = false;

new Tag[6] = "[AAC]";
new NewCash[MAX_PLAYERS];
new OldCash[MAX_PLAYERS];
new TIMER_Kick[MAX_PLAYERS];
new TIMER_Spawn[MAX_PLAYERS];
new bool:Damaged[MAX_PLAYERS] = false;
new bool:Spawned[MAX_PLAYERS] = false;
new Float:GodHealth, Float: GodArmour;
forward OneSecTimer();
forward KickTimer(playerid);
forward SpawnTimer(playerid);

//Stocks
stock SendClientMessageEx(playerid, color, message[128])
{
    new str[128];
    format(str,sizeof(str),"%s: %s", Tag, message);
    SCM(playerid,color,str);
    return 1;
}
stock KickMessages(playerid, reason[128])
{
    new str[128];
    format(str,sizeof(str),"%s: You were kicked from the server for %s.", Tag, reason);
    SCM(playerid,COLOR_RED,str);
    new str2[128];
    format(str2,sizeof(str2),"%s: %s was kicked from the server for %s.", Tag, GetName(playerid), reason);
    SCMA(COLOR_GREEN,str2);
    return 1;
}
stock GetName(playerid)
{
    new name[48];
    GetPlayerName(playerid,name,sizeof(name));
    return name;
}
stock BanKick(playerid)
{
    if(BanPlayers == true){Ban(playerid);}
    else{Kick(playerid);}
    return 1;
}

//Timers
public OneSecTimer()
{
    for (new playerid=0;playerid<MAX_PLAYERS;playerid++)
    {
        if(Spawned[playerid] == false) continue;
        new Gun = 0;
        GunLoop:
        if(GetPlayerWeapon(playerid) == BanWeap[Gun])
        {
            KickMessages(playerid,"Weapon Hacking");
            TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
        }
        Gun++;
        if(Gun < sizeof(BanWeap))goto GunLoop;
        NewCash[playerid] = GetPlayerMoney(playerid);
        if(NewCash[playerid] > Max_Cash || OldCash[playerid] + Cash_Increment < NewCash[playerid])
        {
            KickMessages(playerid,"Money Hacking");
            TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
            ResetPlayerMoney(playerid);
            GivePlayerMoney(playerid, OldCash[playerid]);
        }
        OldCash[playerid] = GetPlayerMoney(playerid);
        new Float:Health, Float:Armour;
        GetPlayerHealth(playerid, Health);
        GetPlayerArmour(playerid, Armour);
        if (Health > 100 || Armour > 100)
        {
            KickMessages(playerid,"Health/Armour Hacking");
            TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
        }
        GodHealth = Health;
        GodArmour = Armour;
        if(IsPlayerInAnyVehicle(playerid))
        {
            new vehicleid = GetPlayerVehicleID(playerid), Float: vHealth;
            if(GetVehicleHealth(vehicleid, vHealth) > 1000)
            {
                KickMessages(playerid,"Vehicle Health Hacking");
                TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
            }
        }
        new Float:Pos_x,Float:Pos_y,Float:Pos_z;
        new anim = GetPlayerAnimationIndex(playerid);
        GetPlayerVelocity(playerid,Pos_x,Pos_y,Pos_z);
        if((Pos_x <= -0.800000  || Pos_y <= -0.800000 || Pos_z <= -0.800000) && (anim == 1008 || anim == 1539))
        {
            KickMessages(playerid,"Fly Hacking");
            TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
        }
    }
    return 1;
}

public KickTimer(playerid)
{
    BanKick(playerid);
    KillTimer(TIMER_Kick[playerid]);
    return 1;
}

public SpawnTimer(playerid)
{
    OldCash[playerid] = GetPlayerMoney(playerid);
    Spawned[playerid] = true;
    KillTimer(TIMER_Spawn[playerid]);
    return 1;
}

//General Script
public OnGameModeInit()
{
    SetTimer("OneSecTimer",1000,true);
    return 1;
}

public OnGameModeExit()
{
    return 1;
}

public OnPlayerConnect(playerid)
{
    SCMX(playerid, COLOR_GOLD, "This server is protected by Aero's Anti-Cheat.");
    Damaged[playerid] = false;
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    Spawned[playerid] = false;
    Damaged[playerid] = false;
    return 1;
}

public OnPlayerSpawn(playerid)
{
    TIMER_Spawn[playerid] = SetTimerEx("SpawnTimer",3000,true,"i",playerid);
    return 1;
}

public OnPlayerDeath(playerid, killerid, reason)
{
    Spawned[playerid] = false;
    Damaged[playerid] = false;
    return 1;
}

public OnPlayerTakeDamage(playerid, issuerid, Float:amount, weaponid, bodypart)
{
    if(issuerid != INVALID_PLAYER_ID)
    {
        new Float:Health,Float:Armour;
        if(GetPlayerHealth(playerid, Health) == GodHealth || GetPlayerArmour(playerid, Armour) == GodArmour)
        {
            KickMessages(playerid,"God Mode");
            TIMER_Kick[playerid] = SetTimerEx("KickTimer",1000,false,"i",playerid);
            return 1;
        }
    }
    return 1;
}
Download: Mediafire
Reply
#2

Quote:
Originally Posted by SkyT
Посмотреть сообщение
pawn Код:
if(GetPlayerHealth(playerid, Health) == GodHealth)
Well, if "1" == "GodHealth", is because the player got GodMode?
GodHealth is a variable used to get their health before they take damage, and after they take damage, if it's the same as before taking damage, then they are cheating.
Reply
#3

For health hacks OnPlayerTakeDamage does not get called.
Reply
#4

Fly hack works ?
Reply
#5

Quote:
Originally Posted by VenomMancer
Посмотреть сообщение
Fly hack works ?
Yup, but it wont detect airbrake, sorry.

Quote:
Originally Posted by awsomedude
Посмотреть сообщение
For health hacks OnPlayerTakeDamage does not get called.
Alright, I'll look into an update on this FS, thanks for the feedback!
Reply
#6

You should add more features, and what awesomedude said is true.
Reply
#7

Good '!!
Reply
#8

Quote:
Originally Posted by SickAttack
Посмотреть сообщение
You should add more features, and what awesomedude said is true.
Alright thanks. If you've got more ideas, lay them on me. So far I was thinking of adding anti-airbrake.
Reply
#9

Neat work buddy
Reply
#10

good job
Reply
#11

Okay here's some of my ideas/suggestions:
- Don't ban players, prevent them from using it (Ex exception: Anti no-reload hacks - kick).
- Add more cheat detections (Ex: Anti refill health hacks, Anti armour refill hacks, Anti no-reload hacks, Anti money spawn hacks, Anti unlimited health hacks, Anti vehicle teleportation (Mass & normal), Anti airbreak, Anti weapon spawn hacks, Anti speed hacks (Vehicle), Anti run-fast hacks, Anti cam hacks (Player is able to shoot other players while he's in a different position), Anti pro-aim.cs hacks, Anti dialog spoof, Anti joystick (Controller) system, Anti keybinds (Ex: You'll have to wait 0.75ms to use another command), etc).
- Code optimization.

Good luck!
Reply
#12

good job
Reply
#13

I will text when i am at home
Reply
#14

Good work Aero. Looks clean and nice.
Reply
#15

Nice!
Reply
#16

Super Cool, +rep
Reply


Forum Jump:


Users browsing this thread: 7 Guest(s)