if config.photoBooth then
	local cam
	local active = false
	local currentVeh
	
	RegisterCommand('vmsphotobooth', function(source, args)
		if #args > 1 or #args < 1 then
			print('Invalid args. Please pass model name "/vmsphotobooth <model>".')
		end
		
		if args[1] ~= 'exit' then
			active = true
			LoadVehicle(args[1])
		else
			active = false	
		end
		CustomCam(active)
	end, false)
	TriggerEvent('chat:addSuggestion', '/vmsphotobooth', 'Photobooth utility for capturing VMS images.', { name="model", help="model name or exit" })

	function LoadVehicle(vehicleSpawn)
		ExecuteCommand('dv')
		local hash = GetHashKey(vehicleSpawn)
		RequestModel(hash)
		Wait(500)
		currentVeh = CreateVehicle(hash, 871.08, -1350.47, 26.0, 50.0, false, false)
		TaskWarpPedIntoVehicle(PlayerPedId(), currentVeh, -1)
	end
	
	function CustomCam(state)
		if state then
			cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", true)
			SetCamCoord(cam, 864.0, -1350.25, 26.9)
			SetCamRot(cam, GetGameplayCamRot(2), 2)
			SetCamFov(cam, 50.0)
			RenderScriptCams(true, true, 1, true, false)
		else
			RenderScriptCams(false, false, 1, true, false)
			DestroyCam(cam, true)
		end
	end
	
	-- Player visibility thread
	CreateThread(function()
		local visibility
		while true do
			if active then
				visibility = not active
				SetEntityVisible(PlayerPedId(), visibility, false)
			end
			Wait(0)
		end
	end)	
	
	-- Steer angle
	CreateThread(function()
		local ped, vehicle
		while true do
			if active then
				ped = PlayerPedId()
				if IsPedInAnyVehicle(ped, false) then
					-- vehicle = GetVehiclePedIsIn(ped)
					-- print(GetVehicleSteeringAngle(vehicle))
					-- SetVehicleSteeringAngle(vehicle, -99.0)
					SetControlNormal(0, 59, 1.0)
				end
			end
			Wait(0)
		end
	end)
	
	-- Cam angle
	CreateThread(function()
		while true do
			SetCamRot(cam, -7.0, 0.0, -90.0, 2)
			-- SetCamRot(cam, GetGameplayCamRot(2), 2)
			-- print(GetGameplayCamRot(2))
			Wait(0)
		end
	end)
end
