# lb-tablet App

Guide Created by `Jhookcrook617`

{% hint style="info" %}

1. Create Lua File (lb-tablet/client/apps/custom)
   {% endhint %}

{% hint style="info" %}
2\. Paste code below into the file
{% endhint %}

```lua
local APP_IDENTIFIER, APP_NAME = 'boosting', 'BoostNet'
local LEO_JOBS = { police=true, sheriff=true, bcso=true, lspd=true, sasp=true, statepolice=true, highway=true, ranger=true, park_ranger=true }
local appRegistered, lastVisible = false, nil

local function getJobName()
    if GetResourceState('qbx_core') == 'started' then
        local pd = exports['qbx_core']:GetPlayerData()
        return pd and pd.job and pd.job.name and string.lower(pd.job.name)
    elseif GetResourceState('qb-core') == 'started' then
        local pd = exports['qb-core']:GetCoreObject().Functions.GetPlayerData()
        return pd and pd.job and pd.job.name and string.lower(pd.job.name)
    elseif GetResourceState('es_extended') == 'started' then
        local job = exports['es_extended']:getSharedObject().PlayerData.job
        return job and job.name and string.lower(job.name)
    end
end

local function shouldShowApp()
    local j = getJobName()
    return not (j and LEO_JOBS[j])
end

local function addApp()
    if appRegistered then return end
    exports['lb-tablet']:AddCustomApp({
        identifier  = APP_IDENTIFIER,
        name        = APP_NAME,
        icon        = 'https://i.ibb.co/3YspJmNp/image.png',
        defaultApp  = true,
        onOpen      = function()
            exports['lb-tablet']:ToggleOpen(false)
            TriggerServerEvent('gg_boosting:server:open_tablet')
        end,
    })
    appRegistered = true
end

local function removeApp()
    if appRegistered then
        exports['lb-tablet']:RemoveCustomApp(APP_IDENTIFIER)
        appRegistered = false
    end
end

local function refreshApp(force)
    local show = shouldShowApp()
    if not force and show == lastVisible then return end
    lastVisible = show
    if show then addApp() else removeApp() end
end

CreateThread(function()
    while not (exports['lb-tablet'] and exports['lb-tablet'].AddCustomApp) do Wait(100) end
    refreshApp(true)
end)

RegisterNetEvent('QBCore:Client:OnJobUpdate', function() refreshApp(true) end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function() refreshApp(true) end)
RegisterNetEvent('esx:setJob', function() refreshApp(true) end)
RegisterNetEvent('esx:playerLoaded', function() refreshApp(true) end)

```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://gg-studio.gitbook.io/gg-studio-docs/gg-studio-scripts/advanced-boosting-system/guides/lb-tablet-app.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
