Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Angle = Angle;
- local pcall = pcall;
- local require = require;
- local print = print;
- local Vector = Vector;
- local math = math;
- local me = LocalPlayer();
- local em = FindMetaTable("Entity");
- local fa;
- local e, err = pcall(function() require("dickwrap") end);
- if(err) then print("nononono"); return; end
- local ofb = em.FireBullets;
- local cones = {};
- local nullvec = Vector() * -1;
- function em.FireBullets(p, data)
- local spread = data.Spread * -1;
- local class = p:GetActiveWeapon():GetClass();
- if (spread != cones[class] && spread != nullvec) then
- cones[class] = spread;
- end
- return(ofb(p, data));
- end
- local function PredictSpread(ucmd, ang)
- local w = me:GetActiveWeapon();
- if (!w || !w:IsValid() || !cones[w:GetClass()]) then return ang; end
- local ang = (dickwrap.Predict(ucmd, ang:Forward(), cones[w:GetClass()])):Angle();
- ang.y, ang.x = math.NormalizeAngle(ang.y), math.NormalizeAngle(ang.x);
- return(ang);
- end
- hook.Add("CalcView", "", function(p, o, a, f)
- local view = {};
- view.angles = (fa && fa || a);
- view.fov = f;
- view.origin = o;
- return view;
- end);
- hook.Add("CreateMove", "", function(ucmd)
- if(!fa) then fa = ucmd:GetViewAngles(); end
- fa = fa + Angle(ucmd:GetMouseY() * .023, ucmd:GetMouseX() * -.023, 0);
- fa.p, fa.y, fa.x = math.Clamp(fa.p, -89, 89), math.NormalizeAngle(fa.y), math.NormalizeAngle(fa.x);
- local ang = fa;
- if(ucmd:KeyDown(IN_ATTACK)) then
- ang = PredictSpread(ucmd, ang);
- end
- ucmd:SetViewAngles(ang);
- end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement