Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- looking_up = 0
- looking_down = 0
- looking_left = 0
- looking_right = 0
- ysens = CreateConVar("y_sens", "0.5")
- xsens = CreateConVar("x_sens", "0.5")
- function upStart(player,command,args)
- if looking_up == 0 then
- hook.Add("CreateMove", "ViewFix", ViewFix)
- looking_up = 1
- end
- end
- function upStop(player,command,args)
- looking_up = 0
- if looking_up == 0 & looking_down == 0 & looking_left == 0 & looking_right ==0 then
- hook.Remove("CreateMove", "ViewFix")
- end
- end
- function downStart(player,command,args)
- if looking_down == 0 then
- hook.Add("CreateMove", "ViewFix", ViewFix)
- looking_down = 1
- end
- end
- function downStop(player,command,args)
- looking_down = 0
- if looking_up == 0 & looking_down == 0 & looking_left == 0 & looking_right ==0 then
- hook.Remove("CreateMove", "ViewFix")
- end
- end
- function leftStart(player,command,args)
- if looking_left == 0 then
- hook.Add("CreateMove", "ViewFix", ViewFix)
- looking_left = 1
- end
- end
- function leftStop(player,command,args)
- looking_left = 0
- if looking_up == 0 & looking_down == 0 & looking_left == 0 & looking_right ==0 then
- hook.Remove("CreateMove", "ViewFix")
- end
- end
- function rightStart(player,command,args)
- if looking_right == 0 then
- hook.Add("CreateMove", "ViewFix", ViewFix)
- looking_right = 1
- end
- end
- function rightStop(player,command,args)
- looking_right = 0
- if looking_up == 0 & looking_down == 0 & looking_left == 0 & looking_right ==0 then
- hook.Remove("CreateMove", "ViewFix")
- end
- end
- function ViewFix(cmd)
- local pitch = LocalPlayer():EyeAngles().p
- local yaw = LocalPlayer():EyeAngles().y
- local roll = LocalPlayer():EyeAngles().r
- local y = ysens:GetFloat()
- local x = xsens:GetFloat()
- if looking_up==1 then
- pitch = pitch-y
- elseif looking_down==1 then
- pitch = pitch+y
- end
- if looking_left==1 then
- yaw = yaw+x
- elseif looking_right==1 then
- yaw = yaw-x
- end
- local fPitch = math.Clamp(pitch, -180, 180)
- local fAng = Angle(fPitch, yaw, roll)
- cmd:SetViewAngles(fAng)
- end
- -- Console commands
- concommand.Add("+up",upStart)
- concommand.Add("-up",upStop)
- concommand.Add("+down",downStart)
- concommand.Add("-down",downStop)
- concommand.Add("+right2",rightStart)
- concommand.Add("-right2",rightStop)
- concommand.Add("+left2",leftStart)
- concommand.Add("-left2",leftStop)
Add Comment
Please, Sign In to add comment