Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local function OnCreateMoveMain(UserCmd)
- if Target ~= nil then
- local LocalAngles = {UserCmd:GetViewAngles()}
- local VecForward = {vector.Subtract( {Target:GetAbsOrigin()}, {LocalPlayer:GetAbsOrigin()} )}
- local AimAngles = {vector.Angles( VecForward )}
- local TargetSpeed = vector.Length(Target:GetPropFloat("localdata", "m_vecVelocity[0]"), Target:GetPropFloat("localdata", "m_vecVelocity[1]"), Target:GetPropFloat("localdata", "m_vecVelocity[2]"))
- if CrouchBlock then
- UserCmd:SetForwardMove( ( (math.sin(math.rad(LocalAngles[2]) ) * VecForward[2]) + (math.cos(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 200 )
- UserCmd:SetSideMove( ( (math.cos(math.rad(LocalAngles[2]) ) * -VecForward[2]) + (math.sin(math.rad(LocalAngles[2]) ) * VecForward[1]) ) * 200 )
- else
- local DiffYaw = AimAngles[2] - LocalAngles[2]
- if DiffYaw > 180 then
- DiffYaw = DiffYaw - 360
- elseif DiffYaw < -180 then
- DiffYaw = DiffYaw + 360
- end
- if DiffYaw > 0.001 then
- UserCmd:SetSideMove(-450)
- elseif DiffYaw < -0.001 then
- UserCmd:SetSideMove(450)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement