Skip to main content

Configuration

Backgrounds

If you want more default backgrounds, for example of your server logo, you can add it.

To do this, you need to add the image to the lb-phone/ui/assets/img/backgrounds/custom folder. The file must be JPG, although we have plans to support more files in the future.

Once you have added the image, you need to add it to the config.json file which can be located at lb-phone/config/config.json You need to add it to the wallpapers array at the top, like this:

lb-phone/config/config.json
// before
{
"wallpapers": ["BlueSabers", "GreenSabers", "NeonSabers"],
// ...
}
// after
{
"wallpapers": ["BlueSabers", "GreenSabers", "NeonSabers", "CustomWallpaper"],
// ...
}

Unique phones

LB Phone offers unique phones. It allows you to steal phones. This requires one of the following inventories:

To enable this feature, you need to set Config.Item.Unique to true in lb-phone/config/config.lua.

ox_inventory

If you use ox_inventory, you need to set Config.Item.Inventory to "ox_inventory". You also need to add the phone item to ox_inventory. To do this, navigate to ox_inventory/data/items.lua and modify it to look like this:

ox_inventory/data/items.lua
["phone"] = {
label = "Phone",
weight = 190,
stack = false,
consume = 0,
client = {
export = "lb-phone.UsePhoneItem",
remove = function()
TriggerEvent("lb-phone:itemRemoved")
end,
add = function()
TriggerEvent("lb-phone:itemAdded")
end
}
},

qb-inventory

If you use qb-inventory, you need to set Config.Item.Inventory to "qb-inventory", and change useable and shouldClose to true in qb-inventory/shared/items.lua for the ['phone'] item. You also need to do some modifications to the code of qb-inventory.

  1. Go to qb-inventory/js/app.js and find the function function FormatItemInfo(itemData) {, by default at line 384. After if (itemData != null && itemData.info != "") {, add the following code:
    qb-inventory/js/app.js
    if (itemData.name == "phone" && itemData.info.lbPhoneNumber) {
    $(".item-info-title").html("<p>" + (itemData.info.lbPhoneName ?? itemData.label) + "</p>")
    $(".item-info-description").html(
    "<p><strong>Phone Number: </strong><span>" + (itemData.info.lbFormattedNumber ?? itemData.info.lbPhoneNumber) + "</span></p>"
    )
    return
    }
    Screenshot of how it looked before and after
  2. Go to qb-inventory/server/main.lua and find the line if (totalWeight + (itemInfo['weight'] * amount)) <= Config.MaxInventoryWeight then inside the function local function AddItem(source, item, amount, slot, info), add the following code after that line:
    qb-inventory/server/main.lua
    if item == "phone" then
    TriggerClientEvent('lb-phone:itemAdded', source)
    end
    Screenshot of how it looked before and after
  3. Go to qb-inventory/server/main.lua and find the line slot = tonumber(slot) inside the function local function RemoveItem(source, item, amount, slot), add the following code after that line:
    qb-inventory/server/main.lua
    if item == "phone" then
    TriggerClientEvent('lb-phone:itemRemoved', source)
    end
    Screenshot of how it looked before and after

core-inventory

If you use core-inventory, First of all, set UsingLbPhoneUniqueItemFeature to true in the core-inventory config and make sure to have the right item set at LbPhoneItemName. Then you need to add the following category below the itemCategories section:

["uniqueItem"] = {
color = "#f2f2f2",
takeSound = 'take',
putSound = 'put',
},

If you use ESX, you also need to apply uniqueItem in the category column for the phone item. If you use QB, you need to add ["category"] = "uniqueItem", to the phone item in items.lua

Music

You can add music to the music app. To do this, you need to add the music to the lb-phone/ui/assets/sound/songs folder, alternatively you can use links to audio files. Once you have added the music, you need to add it to the music.lua file which can be located at lb-phone/config/music.lua.

You need to add it to the Music.Songs table, like this:

lb-phone/config/music.lua
["song_file.mp3"] = { -- The song file or a link to the song. (Youtube links does NOT work, it needs to be a direct link to a .mp3, .ogg, etc... file)
Title = "Song Title", -- The title of the song
Artist = "Artist Name", -- The name of the artist
Album = "Album", -- optional
Cover = "cover.jpg" -- optional. a link to the cover image
}

Make sure that the artist exists in the Music.Artists table, following this format:

lb-phone/config/music.lua
["Artist Name"] = { -- The name of the artist
Avatar = "avatar.jpg" -- optional. a link to the artist's avatar
}

If the song is part of an album, make sure that the album exists in the Music.Albums table, following this format:

lb-phone/config/music.lua
["Album Name"] = { -- The name of the album
Artist = "Artist Name", -- The name of the artist
Cover = "cover.jpg" -- A link to the cover image.
}

Custom ringtones & app specific notifications

To add a custom ringtone, you need to add the ringtone to the lb-phone/ui/assets/sound/ringtones folder. Once you have added the ringtone, you need to add it to the config.json file which can be located at lb-phone/config/config.json, in the "ringtone" object.

"ringtone": {
"default": "default.mp3"
}

To add an app specific notification sound, you first need to add the sound to the lb-phone/ui/assets/sound/notifications folder. Once you have added the sound, you need to add it to the "notifications" object in the config.json file which can be located at lb-phone/config/config.json.

"notifications": {
"default": "twitter-notification.mp3"
}

Removing apps

To remove an app, simply remove the app from lb-phone/config/config.json.

Before
"apps": {
"Phone": {
"name": "Phone",
"removable": false,
"size": 1900
},
"Twitter": {
"name": "Twitter",
"description": "Live news, sports and chat",
"removable": true,
"size": 256700,
"images": ["https://cdn.discordapp.com/attachments/1036595856989753345/1036621576931643493/unknown.png", "https://cdn.discordapp.com/attachments/1036595856989753345/1036621630090268723/unknown.png", "https://cdn.discordapp.com/attachments/1036595856989753345/1036623616911081533/unknown.png", "https://cdn.discordapp.com/attachments/1036595856989753345/1036621683005587476/unknown.png"]
}
}
After
"apps": {
"Phone": {
"name": "Phone",
"removable": false,
"size": 1900
}
}

Custom housing scripts

By default the phone supports qb-houses, loaf_housing and qs-housing. If you are using one of these scripts, you can simply set Config.HouseScript to the one you are using. If you are using another housing script, set it to the script name and follow the instructions below.

  1. Create a new file in lb-phone/client/apps/framework/home/ and lb-phone/server/apps/framework/home/ and name it housingscriptname.lua, where housingscriptname is the name of the housing script you are using.

  2. Add the following snippet to the top of the files:

    if Config.HouseScript ~= "housingscriptname" then
    return
    end

    local lib = exports.loaf_lib:GetLib()
  3. In the client-sided file, add the following code:

    RegisterNUICallback("Home", function(data, cb)
    local action, houseData = data.action, data.houseData

    if action == "getHomes" then
    cb({})
    elseif action == "removeKeyholder" then
    cb({})
    elseif action == "addKeyholder" then
    cb({})
    elseif action == "toggleLocked" then
    cb(locked == true)
    elseif action == "setWaypoint" then
    cb("ok")
    end
    end)
  4. Implement logic to the functions in the client-sided file. You can use the existing scripts as a reference. See below for the expected data.

getHomes

This is called when opening the app. It should return an array of houses. A house has the following properties:

  • label: string - The name of the house
  • locked: boolean - Whether the house is locked or not
  • keyholders: keyholder[] - An array of the keyholders
  • id: number (optional) - The id of the house

You can also add any other properties you want to the house object that will be included in data.houseData in the NUI callback.

A keyholder has the following properties:

  • identifier: string - The identifier of the keyholder (not shown to the user)
  • name: string - The name of the keyholder (shown to the user)

--> Return: house[]

removeKeyholder

Triggered when the user attempts to remove a key from a player. data.identifier is the identifier of the player to remove the key from.

--> Return: false or keyholder[], where keyholder[] is the updated keyholders array.

addKeyholder

Triggered when the user attempts to add a key to a player. data.source is the source of the player to add the key to. Use houseData to know what house the key is being added to.

--> Return: false or keyholder[], where keyholder[] is the updated keyholders array.

toggleLocked

Triggered when the user attempts to toggle the lock of a house.

--> Return: boolean - Whether the house is locked or not.

setWaypoint

Triggered when the user attempts to set a waypoint to a house. Use houseData to know what house the waypoint is being set to.

--> Return: "ok"