Advertisement
spinsquad

spinbot

Mar 23rd, 2015
1,067
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.09 KB | None | 0 0
  1. local hook = hook;
  2. local Angle = Angle;
  3. local Vector = Vector;
  4. local fa;
  5. local math = math;
  6. local CreateClientConVar = CreateClientConVar;
  7.  
  8. local var = CreateClientConVar("spinbot", 0);
  9. local speed = CreateClientConVar("spinbot_speed", 4);
  10.  
  11. local function FixMovement(ucmd)
  12.     local move = Vector(ucmd:GetForwardMove(), ucmd:GetSideMove(), 0);
  13.     local move = (move:Angle() + ( ucmd:GetViewAngles() - fa ) ):Forward() * move:Length();
  14.     ucmd:SetForwardMove(move.x);
  15.     ucmd:SetSideMove(move.y);
  16. end
  17.  
  18. hook.Add("CalcView", "", function(p, o, a, f)
  19.     local view = {};
  20.     view.fov = f;
  21.     view.origin = o;
  22.     view.angles = fa;
  23.     return view;
  24. end);
  25.  
  26. hook.Add("CreateMove", "", function(ucmd)
  27.     if (!fa) then fa = ucmd:GetViewAngles(); end
  28.     fa = (fa + Angle(ucmd:GetMouseY() * .023, ucmd:GetMouseX() * -.023, 0));
  29.     fa.p, fa.y, fa.x = math.Clamp(fa.p, -89, 89), math.NormalizeAngle(fa.y), math.NormalizeAngle(fa.x);
  30.     if(ucmd:KeyDown(1) || var:GetInt() != 1) then
  31.         ucmd:SetViewAngles(fa);
  32.         return;
  33.     end
  34.     ucmd:SetViewAngles(ucmd:GetViewAngles() + Angle(0, speed:GetInt(), 0));
  35.     FixMovement(ucmd);
  36. end);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement