daily pastebin goal
5%
SHARE
TWEET

aimbot by mackenzi

a guest Jun 14th, 2018 157 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <a_samp>
  2.  
  3. new AimWarningBrt[MAX_PLAYERS];
  4.  
  5. Float:DistanceCameraTargetToLocation(Float:CamX, Float:CamY, Float:CamZ, Float:ObjX, Float:ObjY, Float:ObjZ, Float:FrX, Float:FrY, Float:FrZ)
  6. {
  7.         new Float:TGTDistance;
  8.  
  9.         TGTDistance = floatsqroot((CamX - ObjX) * (CamX - ObjX) + (CamY - ObjY) * (CamY - ObjY) + (CamZ - ObjZ) * (CamZ - ObjZ));
  10.  
  11.         new Float:tmpX, Float:tmpY, Float:tmpZ;
  12.  
  13.         tmpX = FrX * TGTDistance + CamX;
  14.         tmpY = FrY * TGTDistance + CamY;
  15.         tmpZ = FrZ * TGTDistance + CamZ;
  16.  
  17.         return floatsqroot((tmpX - ObjX) * (tmpX - ObjX) + (tmpY - ObjY) * (tmpY - ObjY) + (tmpZ - ObjZ) * (tmpZ - ObjZ));
  18. }
  19.  
  20. Float:GetPointAngleToPoint(Float:x2, Float:y2, Float:X, Float:Y)
  21. {
  22.  
  23.   new Float:DX, Float:DY;
  24.   new Float:angle;
  25.  
  26.   DX = floatabs(floatsub(x2,X));
  27.   DY = floatabs(floatsub(y2,Y));
  28.  
  29.   if (DY == 0.0 || DX == 0.0)
  30.   {
  31.     if(DY == 0 && DX > 0) angle = 0.0;
  32.     else if(DY == 0 && DX < 0) angle = 180.0;
  33.     else if(DY > 0 && DX == 0) angle = 90.0;
  34.     else if(DY < 0 && DX == 0) angle = 270.0;
  35.     else if(DY == 0 && DX == 0) angle = 0.0;
  36.   }
  37.   else
  38.   {
  39.     angle = atan(DX/DY);
  40.  
  41.     if(X > x2 && Y <= y2) angle += 90.0;
  42.     else if(X <= x2 && Y < y2) angle = floatsub(90.0, angle);
  43.     else if(X < x2 && Y >= y2) angle -= 90.0;
  44.     else if(X >= x2 && Y > y2) angle = floatsub(270.0, angle);
  45.   }
  46.   return floatadd(angle, 90.0);
  47. }
  48.  
  49. GetXYInFrontOfPoint(&Float:x, &Float:y, Float:angle, Float:distance)
  50. {
  51.         x += (distance * floatsin(-angle, degrees));
  52.         y += (distance * floatcos(-angle, degrees));
  53. }
  54.  
  55. IsPlayerAimingAt(playerid, Float:x, Float:y, Float:z, Float:radius)
  56. {
  57.         new Float:camera_x,Float:camera_y,Float:camera_z,Float:vector_x,Float:vector_y,Float:vector_z;
  58.         GetPlayerCameraPos(playerid, camera_x, camera_y, camera_z);
  59.         GetPlayerCameraFrontVector(playerid, vector_x, vector_y, vector_z);
  60.  
  61.         new Float:vertical, Float:horizontal;
  62.  
  63.         switch (GetPlayerWeapon(playerid))
  64.         {
  65.                         case 34,35,36: {
  66.                         if (DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, vector_x, vector_y, vector_z) < radius) return true;
  67.                         return false;
  68.                         }
  69.                         case 30,31: {vertical = 4.0; horizontal = -1.6;}
  70.                         case 33: {vertical = 2.7; horizontal = -1.0;}
  71.                         default: {vertical = 6.0; horizontal = -2.2;}
  72.         }
  73.  
  74.         new Float:angle = GetPointAngleToPoint(0, 0, floatsqroot(vector_x*vector_x+vector_y*vector_y), vector_z) - 270.0;
  75.         new Float:resize_x, Float:resize_y, Float:resize_z = floatsin(angle+vertical, degrees);
  76.         GetXYInFrontOfPoint(resize_x, resize_y, GetPointAngleToPoint(0, 0, vector_x, vector_y)+horizontal, floatcos(angle+vertical, degrees));
  77.  
  78.         if (DistanceCameraTargetToLocation(camera_x, camera_y, camera_z, x, y, z, resize_x, resize_y, resize_z) < radius) return true;
  79.         return false;
  80. }
  81.  
  82. bool:IsPlayerAimingAtPlayer(playerid, target)
  83. {
  84.         new Float:x, Float:y, Float:z;
  85.         GetPlayerPos(target, x, y, z);
  86.         if (IsPlayerAimingAt(playerid, x, y, z-0.75, 0.25)) return true;
  87.         if (IsPlayerAimingAt(playerid, x, y, z-0.25, 0.25)) return true;
  88.         if (IsPlayerAimingAt(playerid, x, y, z+0.25, 0.25)) return true;
  89.         if (IsPlayerAimingAt(playerid, x, y, z+0.75, 0.25)) return true;
  90.         return false;
  91. }
  92.  
  93. public OnFilterScriptInit()
  94. {
  95.     return print("Filterscript-a Anti-Aimbot by Mackenzi uspesno ucitana!");
  96. }
  97.  
  98. public OnPlayerConnect(playerid)
  99. {
  100.         AimWarningBrt[playerid] = 0;
  101.         return 1;
  102. }
  103.  
  104.  
  105. public OnPlayerWeaponShot(playerid, weaponid, hittype, hitid, Float:fX, Float:fY, Float:fZ)
  106. {
  107.         switch(weaponid){ case 0..18, 39..54: return 1;} //nevazeca oruzja
  108.  
  109.         if(hittype == BULLET_HIT_TYPE_PLAYER && IsPlayerConnected(hitid) && !IsPlayerNPC(hitid))
  110.         {
  111.                 new Float:Shot[3], Float:Hit[3];
  112.                 GetPlayerLastShotVectors(playerid, Shot[0], Shot[1], Shot[2], Hit[0], Hit[1], Hit[2]);
  113.  
  114.                 new playersurf = GetPlayerSurfingVehicleID(playerid);
  115.                 new hitsurf = GetPlayerSurfingVehicleID(hitid);
  116.                 new Float:metapaketlost = NetStats_PacketLossPercent(hitid);
  117.                 new Float:igracpaketlost = NetStats_PacketLossPercent(playerid);
  118.  
  119.                 if(~(playersurf) && ~(hitsurf) && !IsPlayerInAnyVehicle(playerid) && !IsPlayerInAnyVehicle(hitid))
  120.                 {
  121.                         if(!IsPlayerAimingAtPlayer(playerid, hitid) && !IsPlayerInRangeOfPoint(hitid, 5.0, Hit[0], Hit[1], Hit[2]))
  122.                         {
  123.                                 new string[128], issuer[24];
  124.                                 GetPlayerName(playerid, issuer, 24);
  125.                                 AimWarningBrt[playerid] ++;
  126.  
  127.                                 format(string, sizeof(string), "{FFFFFF}Igrac %s sumnjam da koristi aim bot ili laguje [Meta: %f | Pucac:%f]!", issuer, metapaketlost, igracpaketlost);
  128.  
  129.                                 for(new p; p < MAX_PLAYERS;p++)
  130.                                     if(IsPlayerConnected(p) && IsPlayerAdmin(p))
  131.                                          SendClientMessage(p, -1, string);
  132.  
  133.                                 if(AimWarningBrt[playerid] > 10)
  134.                                 {
  135.                                         if(metapaketlost < 1.2 && igracpaketlost < 1.2) return Kick(playerid);
  136.                                         else
  137.                                         {
  138.                                                 format(string, sizeof(string), "{FFFFFF}Igrac %s verovatno koristi aim-bot [Meta: %f | Pucac PL:%f]!", issuer, metapaketlost, igracpaketlost);
  139.                                                 for(new p; p < MAX_PLAYERS;p++) if(IsPlayerConnected(p) && IsPlayerAdmin(p)) SendClientMessage(p, -1, string);
  140.                                         }
  141.                                 }
  142.                                 return 0;
  143.                         }
  144.                         else return 1;
  145.                 }
  146.                 else return 1;
  147.         }
  148.         return 1;
  149. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top