Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- shit aimbot, get nospread yourself
- local util = util;
- local player = player;
- local input = input;
- local bit = bit;
- local hook = hook;
- local me = LocalPlayer();
- local aimtarget;
- local KEY_LALT = KEY_LALT;
- local MASK_SHOT = MASK_SHOT;
- local function GetPos(v)
- local eyes = v:LookupAttachment("eyes");
- return(eyes && v:GetAttachment(eyes).Pos || v:LocalToWorld(v:OBBCenter()));
- end
- local function Valid(v)
- if(!v || !v:IsValid() || v:Health() < 1 || v:IsDormant() || v == me) then return false; end
- local trace = {
- mask = MASK_SHOT,
- endpos = GetPos(v),
- start = me:EyePos(),
- filter = {me, v},
- };
- return(util.TraceLine(trace).Fraction == 1);
- end
- local function GetTarget()
- if (Valid(aimtarget)) then return; end
- aimtarget = nil;
- local allplys = player.GetAll();
- for i = 1, #allplys do
- local v = allplys[i];
- if (!Valid(v)) then continue; end
- aimtarget = v;
- return;
- end
- end
- hook.Add("CreateMove", "", function(ucmd)
- GetTarget();
- if (input.IsKeyDown(KEY_LALT) && aimtarget) then
- local pos = (GetPos(aimtarget) - me:EyePos()):Angle();
- ucmd:SetViewAngles(pos);
- --ucmd:SetButtons(bit.bor(ucmd:GetButtons(), 1));
- -- ^autofire
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement