local state = {} local epressed = 0 local camPosX = 0 local camPosY = 0 local camPosZ = 0 local camFollowDist = 80 local camFollowHeight = 40 local camFollowAngleX = 5 function rotate_camera_init(e) state[e] = "idle" end function rotate_camera_main(e) if state[e] == "idle" then if GetPlayerDistance(e) < 200 then PromptLocal(e,"Fix Camera?") if g_KeyPressE == 1 and epressed == 0 then epressed = 1 state[e] = "fixed" SetCameraOverride(3) end end elseif state[e] == "fixed" then if g_KeyPressE == 1 and epressed == 0 then epressed = 1 state[e] = "idle" SetCameraOverride(0) end CollisionOff(e) temp = 0 if g_KeyPressA == 1 then temp = -1 elseif g_KeyPressD == 1 then temp = 1 end SetRotation(e,g_Entity[e]['anglex'],GetEntityAngleY(e)+temp,g_Entity[e]['anglez']) if g_KeyPressW == 1 then MoveForward(e,160) elseif g_KeyPressS == 1 then MoveForward(e,-160) end CollisionOn(e) SetCameraAngle(0,camFollowAngleX,GetEntityAngleY(e),0) new_y = math.rad(GetEntityAngleY(e)) camPosX = g_Entity[e]['x'] + (math.sin(new_y) * -camFollowDist) camPosY = GetEntityPositionY(e) + camFollowHeight camPosZ = g_Entity[e]['z'] + (math.cos(new_y) * -camFollowDist) SetCameraPosition(0,camPosX,camPosY,camPosZ) end if g_KeyPressE == 0 then epressed = 0 end end function rotate_camera_preexit(e) end function rotate_camera_exit(e) end