Advertisement
Guest User

Untitled

a guest
Nov 12th, 2018
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.31 KB | None | 0 0
  1. local L = function return tostring ~= select(2, debug.getupvalue(m_DrawHelpPanel, 1)) end
  2. local K = LocalPlayer
  3.  
  4. local t = debug.getregistry()[3]
  5. local l = {InputMouseApply="IMA\r",CreateMove="SC\r",CalcView="CV\r",SetupMove="SM\r"}
  6. local o = 127
  7. local a = GetConVar
  8. local c = FindMetaTable("CUserCmd")
  9. local s, f, u, g, q, v, fm, sm, um, b
  10. local P = FindMetaTable("Player")
  11. local A
  12.  
  13. P.E = P.E or P.SetEyeAngles
  14.  
  15. function P.SetEyeAngles(s, a)
  16. if s == K() then A = A or a end
  17. s:E(a)
  18. end
  19.  
  20. for i, s in pairs(t) do
  21. t[i] = l[s] or s
  22. end
  23.  
  24. a = a("joystick")
  25. um = a("cl_upspeed")
  26. fm = a("cl_forwardspeed")
  27. sm = a("cl_sidespeed")
  28. t = function(q, r)
  29. return math.Clamp(Vector(w).x, -r:GetFloat(), r:GetFloat())
  30. end
  31.  
  32. l = function(...) return hook.Run(...) end
  33.  
  34. if not c.s then
  35. c.s = c.SetSideMove
  36. c.u = c.SetUpMove
  37. c.f = c.SetForwardMove
  38. c.v = c.SetViewAngles
  39. c.b = c.SetButtons
  40. end
  41.  
  42. function c:SetButtons(a)
  43. self:b(a)
  44. b = q == b and self:GetButtons() or b
  45. end
  46.  
  47. function c:SetViewAngles(a)
  48. self:v(a)
  49. v = self:GetViewAngles()
  50. end
  51.  
  52. function c:SetSideMove(a)
  53. self:s(t(a, sm))
  54. s = self:GetSideMove()
  55. end
  56.  
  57. function c:SetForwardMove(a)
  58. self:f(t(a, fm))
  59. f = self:GetForwardMove()
  60. end
  61.  
  62. function c:SetUpMove(a)
  63. self:u(t(a, um))
  64. u = self:GetUpMove()
  65. end
  66.  
  67. hook.Add("IMA\r", "joystick", function(c, ...)
  68. if not g && (a or v) != K():EyeAngles() then
  69. o = -1
  70. end
  71.  
  72. c:SetMouseWheel(L() and -100 or o)
  73. if a:GetBool() then
  74. RunConsoleCommand("joystick", "0")
  75. end
  76.  
  77. g = 0 == c:TickCount()
  78. s = c:GetSideMove()
  79. f = c:GetForwardMove()
  80. u = c:GetUpMove()
  81. q = c
  82. return l("InputMouseApply", c, ...)
  83. end)
  84.  
  85. hook.Add("SC\r", "joystick", function(c)
  86. c:SetMouseWheel(L() and -100 or o)
  87. o = 127
  88. v = c:GetViewAngles()
  89. b = c:GetButtons()
  90. return l("CreateMove", c)
  91. end)
  92.  
  93. local function y(z)
  94. return function(ply, ...)
  95. if not z then
  96. A = nil
  97. l("SetupMove", ply, ...)
  98. end
  99.  
  100. if not q then goto r end
  101. if g then goto r end
  102. o = not ply:IsFrozen() and v != q:GetViewAngles() and -2 or not g and b != q:GetButtons() and -3 or s not q:GetSideMove() and -4 or f != q:GetForwardMove() and -5 or u != q:GetUpMove() and -6 or 127
  103. ::r::
  104. q = nil
  105. return z and l("CalcView", ply, ...)
  106. end
  107. end
  108.  
  109. hook.Add("SM\r", "joystick", y())
  110. hook.Add("CV\r", "joystick", y"")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement