Client Exports

Within this asset you will find more snippets in client/custom/examples.lua, also if you are creating a custom application, make use of the documents section for Create Custom Apps.

Here you will find all the useful exports for this asset, please read each step and example carefully to better understand how it works, we do not recommend using these if you are not an experienced developer.


InPhone

Check if your phone is open or not, useful to avoid opening menus while using the phone.

-- Check if you are with the phone open
exports['qs-smartphone-pro']:InPhone()

An example of using this system would be the following.

RegisterCommand('phoneCheck', function(source)
    local isUsingPhone = exports['qs-smartphone-pro']:InPhone()
    if isUsingPhone then
        print('User is using phone.')
    else
        print('User is not using phone.')
    end
end, false)

SetCanOpenPhone

This export allows you to use or block the phone.

-- bool: true/false to use phone
exports['qs-smartphone-pro']:SetCanOpenPhone(bool)

An example of using this system would be the following.

canOpenPhone = true
RegisterCommand('toggleCanOpenPhone', function()
    SetCanOpenPhone(not canOpenPhone)
end, false)

ClosePhone

Exports to close the simple phone

-- No value inside, just close the phone
exports['qs-smartphone-pro']:ClosePhone()

handleClosePhone

Add external events inside this AddEventHablder to handle closing the phone.

AddEventHandler('qs-smartphone-pro:handleClosePhone', function(meta)
    -- Add your codes here to close the phone
end)

IsInCamera

Use the camera to deactivate or activate the map on your hud.

-- No value inside, just check example
exports['qs-smartphone-pro']:IsInCamera()

An example of using this system would be the following.

if exports['qs-smartphone-pro']:IsInCamera() then
    -- block your show render map loop
end

Last updated