Originally Posted by
patatescimamut
Hello, I tried to use this but it gives an error.
[ERROR] lua/gmodbh.lua:16: function arguments expected near 's'
Code:
local origAngle = Angle(0,0,0)
hook.Add("CreateMove","betterAutoStrafe",function(ucmd)
if(!IsValid(LocalPlayer())) then return end
if (!origAngle) then origAngle = ucmd:GetViewAngles() end
origAngle = (origAngle + Angle(ucmd:GetMouseY() * 0.023, ucmd:GetMouseX() * -0.023, 0))
origAngle.p, origAngle.y, origAngle.x = math.Clamp(origAngle.p, -89, 89), math.NormalizeAngle(origAngle.y), math.NormalizeAngle(origAngle.x)
if(ucmd:CommandNumber() == 0) then
ucmd:SetViewAngles(origAngle)
return
end
if(!input.IsKeyDown(KEY_SPACE) or LocalPlayer():IsOnGround()) then return end
ucmd:RemoveKey(IN_JUMP)
if(engine.TickCount() % 2 == 0) then
ucmd:SetSideMove(10000)
ucmd:SetViewAngles(LerpAngle(0.6,ucmd:GetViewAngles(),Angle(0,origAngle.y + 3,0)))
else
ucmd:SetSideMove(-10000)
ucmd:SetViewAngles(LerpAngle(0.6,ucmd:GetViewAngles(),Angle(0,origAngle.y - 3,0)))
end
end)