Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <zcmd>
- #include <foreach>
- #include <callbacks>
- #define COLOR_NOTES 0x2894FFFF
- #define COLOR_NOTES2 0xFF0000AA
- #define BULLET_HIT_TYPE_PLAYER 1
- #define PUB:%0(%1) forward %0(%1); \
- public %0(%1)
- //------------------------------ VARIABLEs ---------------------------------------
- new
- bool:IsAFK[ MAX_PLAYERS char ],
- TimesDetected[ MAX_PLAYERS ] = 0
- ;
- //------------------------------ FILTERSCRIPT-CALLBACKs ---------------------------------------
- #if defined FILTERSCRIPT
- public OnFilterScriptInit()
- {
- print("\n[abd] Aimbot Detection enabled\n[abd] Version: 4.0.0\n[abd] Created by: Kyance");
- return 1;
- }
- public OnFilterScriptExit()
- {
- foreach(Player, i) ResetStats(i);
- print("\n[abd] Aimbot Detection disabled\n[abd] Version: 4.0.0\n[abd] Created by: Kyance");
- return 1;
- }
- #endif
- //------------------------------ MAIN-CALLBACKs ----------------------------------
- public OnPlayerPause(playerid)
- {
- IsAFK{ playerid } = true;
- return 1;
- }
- public OnPlayerResume(playerid, time)
- {
- IsAFK{ playerid } = false;
- return 1;
- }
- public OnPlayerConnect(playerid)
- {
- ResetStats(playerid);
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- ResetStats(playerid);
- return 1;
- }
- public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
- {
- if(hittype == BULLET_HIT_TYPE_PLAYER && !IsPlayerNPC(hitid))
- {
- if(!IsAFK{ hitid })
- {
- new
- surf = GetPlayerSurfingVehicleID(playerid),
- tsurf = GetPlayerSurfingVehicleID(hitid)
- ;
- if(surf == INVALID_VEHICLE_ID && tsurf == INVALID_VEHICLE_ID && !IsPlayerInAnyVehicle(hitid))
- {
- new
- Float:targetpkl = NetStats_PacketLossPercent(hitid),
- Float:playerpkl = NetStats_PacketLossPercent(playerid)
- ;
- if(targetpkl < 0.8 && playerpkl < 0.8)
- {
- new
- Float:fOriginX, Float:fOriginY, Float:fOriginZ,
- Float:fHitPosX, Float:fHitPosY, Float:fHitPosZ
- ;
- GetPlayerLastShotVectors(playerid, fOriginX, fOriginY, fOriginZ, fHitPosX, fHitPosY, fHitPosZ);
- CheckForAimbot(playerid, hitid, fHitPosX, fHitPosY, fHitPosZ);
- }
- }
- }
- }
- return 1;
- }
- //------------------------------ STOCKs and TIMERs ----------------------------------
- stock CheckForAimbot(playerid, targetid = INVALID_PLAYER_ID, Float:fX, Float:fY, Float:fZ)
- {
- if(targetid != INVALID_PLAYER_ID)
- {
- if(!IsPlayerInRangeOfPoint(targetid, 3.0, fX, fY, fZ))
- {
- new string[78];
- TimesDetected[playerid]++;
- printf("[abd] %s(%s) has %d/10 aimbot warnings.", GetName(playerid), PlayerIP(playerid), TimesDetected[playerid]);
- if(TimesDetected[playerid] >= 3 && TimesDetected[playerid] <= 5)
- {
- format(string, sizeof(string), "* %s(%d) is POSSIBLY using aimbot - %d warnings", GetName(playerid), playerid, playerid, playerid, TimesDetected[playerid]);
- SendClientMessageToAll(COLOR_NOTES2, string);
- }
- else if(TimesDetected[playerid] >= 10)
- {
- format(string, sizeof(string), "* %s(%d) is kicked for receiving 10 aimbot warnings.", GetName(playerid), playerid);
- SendClientMessageToAll(COLOR_NOTES2, string), printf("[abd] %s(%s) has been kicked for receiving 10 aimbot warnings.", GetName(playerid), PlayerIP(playerid));
- Kick(playerid);
- }
- }
- }
- }
- stock GetName(playerid)
- {
- new name[24];
- GetPlayerName(playerid,name,sizeof(name));
- return name;
- }
- stock PlayerIP(playerid)
- {
- new ip[16];
- GetPlayerIp(playerid, ip, sizeof(ip));
- return ip;
- }
- stock ResetStats(playerid)
- {
- IsAFK{ playerid } = false;
- TimesDetected[playerid] = 0;
- }
- //------------------------------ COMMANDs ----------------------------------
- CMD:suspects(playerid, params[]) {
- new count = 0, string[64];
- SendClientMessage(playerid, -1, "[ Suspect List ]");
- foreach(Player, i)
- {
- if(TimesDetected[i] >= 3)
- {
- count++;
- format(string, sizeof(string), "{FC4949}%s{FFFFFF}({FC4949}%d{FFFFFF})", GetName(i), i);
- SendClientMessage(playerid, -1, string);
- }
- }
- if(!count) SendClientMessage(playerid, -1, "No suspects detected.");
- return 1;
- }
- CMD:clearsuspects(playerid, params[]) {
- if(!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_NOTES2, "* You're not an admin!");
- foreach(Player, i)
- {
- ResetStats(i);
- }
- SendClientMessage(playerid, COLOR_NOTES, "* Suspect list successfully cleared!");
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement