bridge/phone.lua

-- ==========================================
-- PHONE / TABLET BRIDGE  (client-side only)
-- ==========================================
-- Wraps phone and tablet close calls so the main script works
-- with different phone/tablet resources.
--
-- Default: lb-phone + lb-tablet
-- If your server uses a different phone (e.g. qs-smartphone,
-- gcphone), change ClosePhone below.
--
-- Global table:  Phone
-- ==========================================

Phone = {}

local hasLBPhone  = GetResourceState('lb-phone') == 'started'
local hasLBTablet = GetResourceState('lb-tablet') == 'started'

--- Close all open phone/tablet UIs.
--- Called when flight begins so the HUD can take over the screen.
function Phone.CloseAll()
    if hasLBPhone then
        pcall(function() exports['lb-phone']:ToggleOpen(false) end)
    end
    if hasLBTablet then
        pcall(function() exports['lb-tablet']:ToggleOpen(false) end)
    end
end

Last updated