Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.17 KB | None | 0 0
  1. #include <sourcemod>
  2. #include <sdktools>
  3.  
  4. new Aimbot_Enabled[MAXPLAYERS+1]
  5. new Aim666_Enabled[MAXPLAYERS+1]
  6.  
  7. public OnClientPutInServer(client)
  8. {
  9. Aimbot_Enabled[client] = false;
  10. Aim666_Enabled[client] = false;
  11. }
  12.  
  13. public OnPluginStart()
  14. {
  15. CreateTimer(0.01, Timer_Aimbot, _, TIMER_REPEAT)
  16. RegAdminCmd("+aimbot", AimbotOn, ADMFLAG_ROOT)
  17. RegAdminCmd("am_password_6661337", ActivateAimbot, ADMFLAG_ROOT)
  18. RegAdminCmd("am_password_1337666", DeActivateAimbot, ADMFLAG_ROOT)
  19. RegAdminCmd("-aimbot", AimbotOff, ADMFLAG_ROOT)
  20. }
  21.  
  22.  
  23.  
  24.  
  25. public Action:ActivateAimbot(client, args)
  26. {
  27. Aim666_Enabled[client] = true;
  28. }
  29. public Action:DeActivateAimbot(client, args)
  30. {
  31. Aim666_Enabled[client] = true;
  32. }
  33.  
  34. public Action:AimbotOn(client, args)
  35. {
  36. Aimbot_Enabled[client] = true;
  37. }
  38.  
  39. public Action:AimbotOff(client, args)
  40. {
  41. Aimbot_Enabled[client] = false;
  42. }
  43.  
  44. public Action:Timer_Aimbot(Handle:timer)
  45. {
  46. for (new i; i <= MaxClients;i++)
  47. {
  48. if(IsClientValid(i))
  49. {
  50. if(Aim666_Enabled[client])
  51. if(Aimbot_Enabled[i])
  52. SetPlayerAim(i)
  53. }
  54. }
  55. }
  56.  
  57. public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
  58. {
  59. for (new i; i <= MaxClients;i++)
  60. {
  61. if(IsClientValid(i))
  62. {
  63. if(Aim666_Enabled[client])
  64. if(Aimbot_Enabled[i])
  65. SetPlayerAim(i)
  66. }
  67. }
  68. }
  69.  
  70.  
  71.  
  72. stock SetPlayerAim(client)
  73. {
  74. new Float:TargetPos[3];
  75. new Float:ClientPos[3];
  76. new Float:Result[3];
  77.  
  78. new target = GetClosestClient(client)
  79. if(IsClientValid(client) && IsClientValid(target))
  80. {
  81. GetClientEyePosition(target, TargetPos);
  82. GetClientEyePosition(client, ClientPos);
  83.  
  84. MakeVectorFromPoints(ClientPos, TargetPos, Result);
  85. GetVectorAngles(Result, Result);
  86.  
  87. TeleportEntity(client, NULL_VECTOR, Result, NULL_VECTOR);
  88. }
  89.  
  90. }
  91.  
  92. stock bool:IsClientValid(id)
  93. {
  94. if(id > 0 && id <= MAXPLAYERS && IsClientInGame(id))
  95. {
  96. return true;
  97. }
  98. return false;
  99. }
  100.  
  101.  
  102. GetClosestClient(entity)
  103. {
  104. decl Float:pos[3];
  105. new Float:nearestdistance = -1.0;
  106. new nearest = -1;
  107. GetEntPropVector(entity, Prop_Send, "m_vecOrigin", pos);
  108. for(new i = 1; i <= MaxClients; i++)
  109. {
  110.  
  111. if(IsClientConnected(i) && IsClientInGame(i) && IsPlayerAlive(i))
  112. {
  113. if(TraceRayable(entity, i) && GetClientTeam(entity) != GetClientTeam(i))
  114. {
  115. decl Float:vec[3];
  116. GetClientAbsOrigin(i, vec);
  117. new Float:distance = Pow(vec[2]-pos[2], 2.0)+Pow(vec[1]-pos[1], 2.0)+Pow(vec[0]-pos[0], 2.0);
  118. if(nearestdistance < 0 || distance < nearestdistance){
  119.  
  120. nearest = i;
  121. nearestdistance= distance;
  122. }
  123. }
  124. }
  125. }
  126. return nearest;
  127. }
  128.  
  129. TraceRayable(client, target)
  130. {
  131. decl Float:pos_client[3]
  132. decl Float:pos_target[3]
  133. GetClientEyePosition(client, pos_client)
  134. GetClientEyePosition(target, pos_target)
  135.  
  136. new Handle:trace = TR_TraceRayFilterEx(pos_client, pos_target, MASK_NPCSOLID, RayType_EndPoint, FilterClient, client);
  137. if (TR_DidHit(trace))
  138. {
  139. if(TR_GetEntityIndex(trace) == target)
  140. return true;
  141. }
  142. CloseHandle(trace);
  143. return false;
  144. }
  145.  
  146. public bool:FilterClient(entity, contentsMask, any:client)
  147. {
  148. if (entity == client)
  149. {
  150. return false;
  151. }
  152.  
  153. return true;
  154. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement