Advertisement
spinsquad

aimbot

Mar 22nd, 2015
1,909
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.19 KB | None | 0 0
  1. -- shit aimbot, get nospread yourself
  2.  
  3. local util = util;
  4. local player = player;
  5. local input = input;
  6. local bit = bit;
  7. local hook = hook;
  8. local me = LocalPlayer();
  9. local aimtarget;
  10. local KEY_LALT = KEY_LALT;
  11. local MASK_SHOT = MASK_SHOT;
  12.  
  13. local function GetPos(v)
  14.     local eyes = v:LookupAttachment("eyes");
  15.     return(eyes && v:GetAttachment(eyes).Pos || v:LocalToWorld(v:OBBCenter()));
  16. end
  17.  
  18. local function Valid(v)
  19.     if(!v || !v:IsValid() || v:Health() < 1 || v:IsDormant() || v == me) then return false; end
  20.     local trace = {
  21.         mask = MASK_SHOT,
  22.         endpos = GetPos(v),
  23.         start = me:EyePos(),
  24.         filter = {me, v},
  25.     };
  26.     return(util.TraceLine(trace).Fraction == 1);
  27. end
  28.  
  29. local function GetTarget()
  30.     if (Valid(aimtarget)) then return; end
  31.     aimtarget = nil;
  32.     local allplys = player.GetAll();
  33.     for i = 1, #allplys do
  34.         local v = allplys[i];
  35.         if (!Valid(v)) then continue; end
  36.         aimtarget = v;
  37.         return;
  38.     end
  39. end
  40.  
  41. hook.Add("CreateMove", "", function(ucmd)
  42.     GetTarget();
  43.     if (input.IsKeyDown(KEY_LALT) && aimtarget) then
  44.         local pos = (GetPos(aimtarget) - me:EyePos()):Angle();
  45.         ucmd:SetViewAngles(pos);
  46.         --ucmd:SetButtons(bit.bor(ucmd:GetButtons(), 1));
  47.         -- ^autofire
  48.     end
  49. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement