[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


Messages In This Thread
Aero's Anti-Cheat - by Aerotactics - 27.05.2014, 22:00
Re: Respuesta: Aero's Anti-Cheat - by Aerotactics - 27.05.2014, 22:19
Re: Aero's Anti-Cheat - by awsomedude - 27.05.2014, 22:45
Re: Aero's Anti-Cheat - by VenomMancer - 27.05.2014, 23:16
Re: Aero's Anti-Cheat - by Aerotactics - 27.05.2014, 23:19
Re: Aero's Anti-Cheat - by SickAttack - 27.05.2014, 23:31
Re: Aero's Anti-Cheat - by GeekSiMo - 27.05.2014, 23:34
Re: Aero's Anti-Cheat - by Aerotactics - 27.05.2014, 23:36
Re: Aero's Anti-Cheat - by iAnonymous - 27.05.2014, 23:36
Re: Aero's Anti-Cheat - by Dangjai - 27.05.2014, 23:37
Re: Aero's Anti-Cheat - by SickAttack - 28.05.2014, 00:06
Re: Aero's Anti-Cheat - by Team_PRO - 28.05.2014, 00:27
Re: Aero's Anti-Cheat - by VenomMancer - 28.05.2014, 03:12
Re: Aero's Anti-Cheat - by punklord - 28.05.2014, 03:19
Re: Aero's Anti-Cheat - by iRaiDeN - 28.05.2014, 03:30
Re: Aero's Anti-Cheat - by KayJ - 28.05.2014, 05:06

Forum Jump:


Users browsing this thread: 7 Guest(s)