[FilterScript] Aimbot Detection
#1

Ok, so i made this script to help admins find aimbot users. NOT TO KICK OR BAN THEM AUTOMATICALLY! They way it detects it is a comparison of the shots that a player fires and the shots that hit another moving player. I made 3 classes of weapons to test, each with different accuracy settings due to different firing rates. I have 2 versions, 1 for lag shooting servers, and 1 for non-lag shooting servers (only the non-lag shooting is tested). I think it's pretty reliable. If you spot any problems or ways to improve it please don't hesitate to post them, and keep in mind that I don't really know what I'm doing.

NOTE: the hit / miss ratio can be edited by changing the total2 value in each of the three weapon classes.
ex: for handguns, shotguns, snipers.
- "if(hitsA[issuerid] == 12)" is the amount of hits that it takes before the shots the player has fired are calculated.
- "if(total1A[issuerid] - total2A[issuerid] < 15)" is the amount of shots the player has taken.
- so that means that if the player hits the target 12 out of 14 shots he fails the test and the message is sent.
- if you change the number 15 to let's say 18, then if the player hits the target 12 out of 17 shots he fails the test.
- I noticed that on servers with no lag shooting a good player's accuracy will often be as good or better than aimbot
- I suggest using this on lag shooting servers, but do as you wish

UPDATE: added sniper and country rifle (I didn't know that you can aimbot with sniper )

LAG SHOOTING SERVERS
PHP код:
//This script is designed to help admins to detect when a player is using aimbot NOTE: also works on joypad users
//When aimbot users are detected a message will be sent to admins to spectate that player
//It is possible to get false positives (but rare) ex: player runs away in a straight line (LOL) and gets shot by another player that never misses
//I do not advise using kick or ban instead of the message, you don't want to punish good players do you?
//Use this script on any 0.3d or higher servers that have lag shooting
#include <a_samp>
#include <foreach>
#define red 0xFF0000AA
//#define TEST_MOVEMENT //uncomment this line to use debug, this will send a message to all players OnPlayerUpdate if they are "IN MOTION" or "STOPPED" (returns "STOPPED" in a vehicle)
new ammo1,
    
ammo2,
    
ammo3,
    
ammo4,
    
ammo5,
    
ammo6,
    
ammo7,
    
ammo8,
    
ammo9,
    
ammo10,
    
ammo11,
    
weapon,
    
total1A[MAX_PLAYERS],
    
total2A[MAX_PLAYERS],
    
total1B[MAX_PLAYERS],
    
total2B[MAX_PLAYERS],
    
total1C[MAX_PLAYERS],
    
total2C[MAX_PLAYERS],
    
hitsA[MAX_PLAYERS],
    
hitsB[MAX_PLAYERS],
    
hitsC[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    
#if defined TEST_MOVEMENT
    
IsPlayerMoving(playerid);
    
#endif
    
return 1;
}
public 
OnPlayerTakeDamage(playeridissueridFloatamountweaponid)
{
    if(!
IsPlayerConnected(issuerid)) return 0;
    if(
IsPlayerMoving(playerid) && hitsA[issuerid] == && GetPlayerWeapon(issuerid) > 15 && GetPlayerWeapon(issuerid) < 28
    
|| IsPlayerMoving(playerid) && hitsA[issuerid] == && GetPlayerWeapon(issuerid) > 32 && GetPlayerWeapon(issuerid) < 35//handguns, shotguns, snipers
    
{
        
total1A[issuerid] = GetPlayerTotalAmmo(issuerid);
        
hitsA[issuerid] ++;
    }
    if(
IsPlayerMoving(playerid) && hitsA[issuerid] > && hitsA[issuerid] < 12 && GetPlayerWeapon(issuerid) > 15 && GetPlayerWeapon(issuerid) < 28)
    {
        
hitsA[issuerid] ++;
    }
    if(
hitsA[issuerid] == 12)
    {
        
total2A[issuerid] = GetPlayerTotalAmmo(issuerid);
        if(
total1A[issuerid] - total2A[issuerid] < 15 && total1A[issuerid] - total2A[issuerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(issuerid,name,sizeof(name));
            
hitsA[issuerid] = 0;
            
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameissuerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsA[issuerid] = 0;
        }
    }
    if(
IsPlayerMoving(playerid) && hitsB[issuerid] == && GetPlayerWeapon(issuerid) == 28
    
|| IsPlayerMoving(playerid) && hitsB[issuerid] == && GetPlayerWeapon(issuerid) == 32//tec 9 and uzi
    
{
        
total1B[issuerid] = GetPlayerTotalAmmo(issuerid);
        
hitsB[issuerid] ++;
    }
    if(
IsPlayerMoving(playerid) && hitsB[issuerid] > && hitsB[issuerid] < 26 && GetPlayerWeapon(issuerid) == 28
    
|| IsPlayerMoving(playerid) && hitsB[issuerid] > && hitsB[issuerid] < 26 && GetPlayerWeapon(issuerid) == 32)
    {
        
hitsB[issuerid] ++;
    }
    if(
hitsB[issuerid] == 26)
    {
        
total2B[issuerid] = GetPlayerTotalAmmo(issuerid);
        if(
total1B[issuerid] - total2B[issuerid] < 30 && total1B[issuerid] - total2B[issuerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(issuerid,name,sizeof(name));
            
hitsB[issuerid] = 0;
            
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameissuerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsB[issuerid] = 0;
        }
    }
    if(
IsPlayerMoving(playerid) && hitsC[issuerid] == && GetPlayerWeapon(issuerid) > 28 && GetPlayerWeapon(issuerid) < 32//MP5, AK47, M4
    
{
        
total1C[issuerid] = GetPlayerTotalAmmo(issuerid);
        
hitsC[issuerid] ++;
    }
    if(
IsPlayerMoving(playerid) && hitsC[issuerid] > && hitsC[issuerid] < 20 && GetPlayerWeapon(issuerid) > 28 && GetPlayerWeapon(issuerid) < 32)
    {
        
hitsC[issuerid] ++;
    }
    if(
hitsC[issuerid] == 20)
    {
        
total2C[issuerid] = GetPlayerTotalAmmo(issuerid);
        if(
total1C[issuerid] - total2C[issuerid] < 23 && total1C[issuerid] - total2C[issuerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(issuerid,name,sizeof(name));
            
hitsC[issuerid] = 0;
               
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameissuerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsC[issuerid] = 0;
        }
    }
    return 
1;
}
stock IsPlayerMoving(playerid)
{
    new 
Float:Velocity[3];
    
GetPlayerVelocity(playeridVelocity[0], Velocity[1], Velocity[2]);
    if(
Velocity[0] >= 0.02
    
|| Velocity[1] >= 0.02
    
|| Velocity[2] >= 0.02
    
|| Velocity[0] <= -0.02
    
|| Velocity[1] <= -0.02 //set at 0.02 and -0.02 will detect any on foot movement faster than standing on an escalator
    
|| Velocity[2] <= -0.02//set at 0.07 and -0.07 will detect any on foot movement faster than walking or strafing (running)
     
{
         
#if defined TEST_MOVEMENT
         
SendClientMessage(playerid, -1"IN MOTION");
         
#endif
         
return true;
    }
    else
    {
        
#if defined TEST_MOVEMENT
        
SendClientMessage(playeridred"STOPPED");
        
#endif
        
return false;
    }
}
stock GetPlayerTotalAmmo(playerid//fist and melee weaps excluded
{
    new 
totalammo;
    
GetPlayerWeaponData(playerid2weaponammo1);
    
GetPlayerWeaponData(playerid3weaponammo2);
    
GetPlayerWeaponData(playerid4weaponammo3);
    
GetPlayerWeaponData(playerid5weaponammo4);
    
GetPlayerWeaponData(playerid6weaponammo5);
    
GetPlayerWeaponData(playerid7weaponammo6);
    
GetPlayerWeaponData(playerid8weaponammo7);
    
GetPlayerWeaponData(playerid9weaponammo8);
    
GetPlayerWeaponData(playerid11weaponammo9);
    
GetPlayerWeaponData(playerid12weaponammo10);
    
GetPlayerWeaponData(playerid13weaponammo11);
    
totalammo ammo1+ammo2+ammo3+ammo4+ammo5+ammo6+ammo7+ammo8+ammo9+ammo10+ammo11;
    return 
totalammo;

NON-LAG SHOOTING SERVERS
PHP код:
//This script is designed to help admins to detect when a player is using aimbot NOTE: also works on joypad users
//When aimbot users are detected a message will be sent to admins to spectate that player
//It is possible to get false positives (but rare) ex: player runs away in a straight line (LOL) and gets shot by another player that never misses
//I do not advise using kick or ban instead of the message, you don't want to punish good players do you?
//Use this script on 0.3z servers or any servers 0.3d or higher that have no lag shooting
//Remember to add "bodypart" to OnPlayerGiveDamage for 0.3z servers
#include <a_samp>
#include <foreach>
#define red 0xFF0000AA
//#define TEST_MOVEMENT //uncomment this line to use debug, this will send a message to all players OnPlayerUpdate if they are "IN MOTION" or "STOPPED" (returns "STOPPED" in a vehicle)
new ammo1,
    
ammo2,
    
ammo3,
    
ammo4,
    
ammo5,
    
ammo6,
    
ammo7,
    
ammo8,
    
ammo9,
    
ammo10,
    
ammo11,
    
weapon,
    
total1A[MAX_PLAYERS],
    
total2A[MAX_PLAYERS],
    
total1B[MAX_PLAYERS],
    
total2B[MAX_PLAYERS],
    
total1C[MAX_PLAYERS],
    
total2C[MAX_PLAYERS],
    
hitsA[MAX_PLAYERS],
    
hitsB[MAX_PLAYERS],
    
hitsC[MAX_PLAYERS];
public 
OnPlayerConnect(playerid)
{
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerSpawn(playerid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerDeath(playeridkilleridreason)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    
hitsA[playerid] = 0;
    
hitsB[playerid] = 0;
    
hitsC[playerid] = 0;
    
total1A[playerid] = 0;
    
total2A[playerid] = 0;
    
total1B[playerid] = 0;
    
total2B[playerid] = 0;
    
total1C[playerid] = 0;
    
total2C[playerid] = 0;
    return 
1;
}
public 
OnPlayerUpdate(playerid)
{
    
#if defined TEST_MOVEMENT
    
IsPlayerMoving(playerid);
    
#endif
    
return 1;
}
public 
OnPlayerGiveDamage(playeriddamagedidFloatamountweaponid)
{
    if(!
IsPlayerConnected(playerid)) return 0;
    if(
IsPlayerMoving(damagedid) && hitsA[playerid] == && GetPlayerWeapon(playerid) > 15 && GetPlayerWeapon(playerid) < 28
    
|| IsPlayerMoving(damagedid) && hitsA[playerid] == && GetPlayerWeapon(playerid) > 32 && GetPlayerWeapon(playerid) < 35//handguns, shotguns, snipers
    
{
        
total1A[playerid] = GetPlayerTotalAmmo(playerid);
        
hitsA[playerid] ++;
    }
    if(
IsPlayerMoving(damagedid) && hitsA[playerid] > && hitsA[playerid] < 12 && GetPlayerWeapon(playerid) > 15 && GetPlayerWeapon(playerid) < 28)
    {
        
hitsA[playerid] ++;
    }
    if(
hitsA[playerid] == 12)
    {
        
total2A[playerid] = GetPlayerTotalAmmo(playerid);
        if(
total1A[playerid] - total2A[playerid] < 15 && total1A[playerid] - total2A[playerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(playerid,name,sizeof(name));
            
hitsA[playerid] = 0;
            
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameplayerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsA[playerid] = 0;
        }
    }
    if(
IsPlayerMoving(damagedid) && hitsB[playerid] == && GetPlayerWeapon(playerid) == 28
    
|| IsPlayerMoving(damagedid) && hitsB[playerid] == && GetPlayerWeapon(playerid) == 32//tec 9 and uzi
    
{
        
total1B[playerid] = GetPlayerTotalAmmo(playerid);
        
hitsB[playerid] ++;
    }
    if(
IsPlayerMoving(damagedid) && hitsB[playerid] > && hitsB[playerid] < 26 && GetPlayerWeapon(playerid) == 28
    
|| IsPlayerMoving(damagedid) && hitsB[playerid] > && hitsB[playerid] < 26 && GetPlayerWeapon(playerid) == 32)
    {
        
hitsB[playerid] ++;
    }
    if(
hitsB[playerid] == 26)
    {
        
total2B[playerid] = GetPlayerTotalAmmo(playerid);
        if(
total1B[playerid] - total2B[playerid] < 30 && total1B[playerid] - total2B[playerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(playerid,name,sizeof(name));
            
hitsB[playerid] = 0;
            
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameplayerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsB[playerid] = 0;
        }
    }
    if(
IsPlayerMoving(damagedid) && hitsC[playerid] == && GetPlayerWeapon(playerid) > 28 && GetPlayerWeapon(playerid) < 32//MP5, AK47, M4
    
{
        
total1C[playerid] = GetPlayerTotalAmmo(playerid);
        
hitsC[playerid] ++;
    }
    if(
IsPlayerMoving(damagedid) && hitsC[playerid] > && hitsC[playerid] < 20 && GetPlayerWeapon(playerid) > 28 && GetPlayerWeapon(playerid) < 32)
    {
        
hitsC[playerid] ++;
    }
    if(
hitsC[playerid] == 20)
    {
        
total2C[playerid] = GetPlayerTotalAmmo(playerid);
        if(
total1C[playerid] - total2C[playerid] < 23 && total1C[playerid] - total2C[playerid] >= 0)
        {
            new 
name[MAX_PLAYER_NAME], string[192];
            
GetPlayerName(playerid,name,sizeof(name));
            
hitsC[playerid] = 0;
               
format(stringsizeof string"{FF7D7D}[ATTENTION] {FF0000}%s {FF7D7D}id{FF0000}[%d] {FF7D7D}Needs to be spectated, {FF0000}Reason: {FF7D7D}POSSIBLE AIMBOT."nameplayerid);
            foreach (new 
Player)
            {
                if(
IsPlayerAdmin(i)) SendClientMessage(i,red,string); //will send to rcon admins unless you edit it for your admin script
            
}
        }
        else
        {
            
hitsC[playerid] = 0;
        }
    }
    return 
1;
}
stock IsPlayerMoving(playerid)
{
    new 
Float:Velocity[3];
    
GetPlayerVelocity(playeridVelocity[0], Velocity[1], Velocity[2]);
    if(
Velocity[0] >= 0.02
    
|| Velocity[1] >= 0.02
    
|| Velocity[2] >= 0.02
    
|| Velocity[0] <= -0.02
    
|| Velocity[1] <= -0.02 //set at 0.02 and -0.02 will detect any on foot movement faster than standing on an escalator
    
|| Velocity[2] <= -0.02//set at 0.07 and -0.07 will detect any on foot movement faster than walking or strafing (running)
     
{
         
#if defined TEST_MOVEMENT
         
SendClientMessage(playerid, -1"IN MOTION");
         
#endif
         
return true;
    }
    else
    {
        
#if defined TEST_MOVEMENT
        
SendClientMessage(playeridred"STOPPED");
        
#endif
        
return false;
    }
}
stock GetPlayerTotalAmmo(playerid//fist and melee weaps excluded
{
    new 
totalammo;
    
GetPlayerWeaponData(playerid2weaponammo1);
    
GetPlayerWeaponData(playerid3weaponammo2);
    
GetPlayerWeaponData(playerid4weaponammo3);
    
GetPlayerWeaponData(playerid5weaponammo4);
    
GetPlayerWeaponData(playerid6weaponammo5);
    
GetPlayerWeaponData(playerid7weaponammo6);
    
GetPlayerWeaponData(playerid8weaponammo7);
    
GetPlayerWeaponData(playerid9weaponammo8);
    
GetPlayerWeaponData(playerid11weaponammo9);
    
GetPlayerWeaponData(playerid12weaponammo10);
    
GetPlayerWeaponData(playerid13weaponammo11);
    
totalammo ammo1+ammo2+ammo3+ammo4+ammo5+ammo6+ammo7+ammo8+ammo9+ammo10+ammo11;
    return 
totalammo;

Reply
#2

nice mate.
Reply
#3

The problem with this is that aimbots are not perfect and they miss too. for example if someone suddenly shifts direction the aimbot would probably miss.
Reply
#4

Yeah I know, but I allowed for some misses in the script. ex: for shotguns and handguns if you hit a moving target 12 out of 14 shots, you fail the test.

It won't detect every instance of aimbot, but if a player uses aimbot it will detect it eventually. Probably sooner than later.
Reply
#5

I will try it in my server so do u have any aimbot and will it even detect admins
Reply
#6

it will detect anyone with aimbot even admins
Reply
#7

This Detection has close to 100%? or 80~90%?

But i will try it

Thanks.
Reply
#8

Good one... I really hate hackers...
Reply
#9

I use aimbot.exe on my server

but the Aimbot Detection don't detect me...
Reply
#10

are you using the lag shoot or the no lag shoot version?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)