LquenS
  • Welcome
  • ls-core
    • 💾Installation
    • 🔧Errors
  • ls-phone
    • 💾Installation
    • 🖥️Configurations, Exports & Events
    • 🔧Errors
    • 📄Changelog
  • ls-inventory
    • 💾Installation
    • 🖥️Basics, Configurations, Exports & Events
    • 🔧Errors
    • 📄Changelog
  • ls-mdt
    • 💾Installation
    • 🔧Errors
  • ls-mdt-v3
    • 💾Installation
    • 🔧Errors
  • ls-inventoryhud
    • 💾Installation
      • 💻QBCore
      • 💻ESX
    • 🔧Errors
    • 🖥️Classes
    • 🔩Basics
Powered by GitBook
On this page
  • Basics
  • Configuration
  • Webhook (Images)
  • Custom Billing
  • Custom Garage
  • Disabling Metadata
  • Battery
  • Internet
  • Server Side Exports & Events
  • Phone
  1. ls-phone

Configurations, Exports & Events

Phone has exports, events, you can find all these from this list

PreviousInstallationNextErrors

Last updated 1 year ago

Basics

You can learn in this guide for how to use phone, and phone how it works.

Phone usage mainly preffered as consume/usage, this means when you use phone like other items(water, sandwich etc.) it will appear to your screen!

Using by key can works too! Assigned to M key by default but it can have errors/glitches.

Phone is using metadata, this means when someone stole your phone all data is gone and they can use everything in your phone.

This option can be configured by disabling! You can check for how to disable metadata.

Phone have a battery & internet, this means if you want to download an app or use probably requires an internet and can battery runout when over usage!

This option can be configured by disabling! You can check for how to disable battery and for how to disable internet.

Configuration

We're prefer to configuring phone, after configuring it will looks like how you're wanted.

Webhook (Images)

You need to webhooks for take an photo in this section you'll learn how to add webhooks. First locate configs/config_server.lua and scroll to end find Config.Server.Webhook and modify.

configs/config_server.lua
Config.Server.Webhook = "your webhook link"

Custom Billing

If you're using custom billing script, locate configs/config_server.lua and find Config.Server.Paybilling after that you can modify the whole code,

configs/config_server.lua
Config.Server.PayBilling = function(Ply, society, amount, invoiceId, sendercitizenid) 
    local Invoices = {}
    -- Your code
    return Invoices
end

After that locate server/others.lua and find ls-phone:s:getAllBilling modify the whole code,

server/others.lua
LS_CORE.Callback.Functions.CreateCallback("ls-phone:s:getAllBilling", function(source, cb)
    local invoices = LS_CORE.Config.DATABASE(LS_CORE.Config.DATABASE_NAME, 'fetchAll', 'SELECT * FROM phone_invoices WHERE citizenid = ?', {Config.Server.GetPlayerIdentifier(source)})
    if invoices[1] ~= nil then
        cb(invoices)
    end
end)

If you're using client side paid function, locate client/others.lua and find PayInvoice modify the whole code,

client/others.lua
RegisterNUICallback('PayInvoice', function(data, cb)
    local senderCitizenId = data.senderCitizenId
    local society = data.society
    local amount = data.amount
    local invoiceId = data.invoiceId
    -- Your code
end)

Custom Garage

If you're using custom garage script, locate server/others.lua and find these code snippet and edit whole code,

server/others.lua
Framework.Functions.CreateCallback("ls-phone:s:getCars", function(source, cb)
    local Player = Config.Server.GetPlayer(source)
    if not Player then return end
    local result = LS_CORE.Config.DATABASE(LS_CORE.Config.DATABASE_NAME, 'fetchAll', 'SELECT * FROM player_vehicles WHERE citizenid = ?', { Config.Server.GetPlayerIdentifier(source) })

    local results = {} 
    for key, value in ipairs(result) do
        table.insert(results, {["garage"] = value["garage"], ["plate"] = value["plate"], ["model"] = value["vehicle"]})
    end
    cb(results)
end)

RegisterNetEvent("ls-phone:s:deletePed", function()
    local src = source
    Config.Server.GetPlayer(src, true).Functions.RemoveMoney("bank", Config.ValetCost, "Money taken from bank")

    TriggerClientEvent("ls-phone:c:sendNotification", src, {
        app = "garage",
        message = "VALET_COST",
    })
end)

RegisterNetEvent("ls-phone:s:changeVehicleDatabaseStatus", function(plate)
    LS_CORE.Config.DATABASE( LS_CORE.Config.DATABASE_NAME, 'execute', 'UPDATE `player_vehicles` SET `garage` = @garage WHERE `plate` = @plate', {
        ["@plate"] = plate,
        ["@garage"] = nil,
    })
end)

Framework.Functions.CreateCallback("ls-phone:s:getVehicleFromPlate", function(source, cb, plate)
    cb(LS_CORE.Config.DATABASE(LS_CORE.Config.DATABASE_NAME, 'fetchAll', 'SELECT * FROM player_vehicles WHERE plate = ?', { plate })[1])
end)

Disabling Metadata

Some inventory does not support metadata usage, for reason best choice is closing metadata.

For changing metadata, configs/config_server.lua

If you close the metadata, you need to add metadata sql to your own server.

CREATE TABLE IF NOT EXISTS `phone_metadata` (
  `identifier` varchar(255) NOT NULL,
  `data` longtext NOT NULL,
  PRIMARY KEY (`identifier`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

Battery

Only way to charge your phone is powerbank. If you dont have "powerbank" item in your database, create one.

When holding phone, using battery will charge phone.

For changing battery, configs/config.js

Internet

There is 2 way to use internet, mobile data or wi-fi. Some apps requires internet for use. For disabling Internet, configs/config.js

Server Side Exports & Events

Phone

GivePhoneToPlayer - Default code for give phones to player. It can be used everywhere

exports["ls-phone"]:GivePhoneToPlayer(source)

ReCharge - Recharges the phone battery.

exports["ls-phone"]:ReCharge(source)

AirPods - Enables earphones to phone.

exports["ls-phone"]:AirPods(source)

SendOfflineMail - Sends mail to player

exports["ls-phone"]:SendOfflineMail(identifier, {
    sender = "Sender",
    subject = "Mail Subject",
    message = "Message",
})

Phone Metadata layout

        local PhoneData = {
            MetaData = {
                phonenumber = math.random(11111111, 99999999),
                owner = "Unknown",
                serialnumber = tostring(LS_CORE.Config.RandomInt(3) .. LS_CORE.Config.RandomStr(3) .. LS_CORE.Config.RandomInt(3)):upper(),

                profilepicture = "img/default.png",
                background = "img/backgrounds/iphone.png",
                wallpapers = Config.Shared.DefaultWallpapers,
                brightness = 100.0,
                volumeprogress = 100.0,
                layout = "4-6",
                widgetApp ={},
                phonePages = { [1] = true },
                phonePage = 1,
                notifications = {},
                oldConnections = {},
                Password = 1234,
    
                instagramUser = false,
                twitterUser = false,
                snapchatUser = false,
                darkchatUser = false,
    
                snapchatFriendRequests = { },
    
                phoneLocation = { x = 100, y = 100},
                phoneZoom = 100,
                bluetooth = false,
                LockScreen = false,

                beforeApps = {},
            },

            Notification = true,
            DarkMode = false,
            Airplane = false,
            MobileData = false,
            Wifi = false,
            WifiData = nil,
            DND = false,
            PhoneLocked = false,
            Battery = 100,
            PhoneClosed = false,

            gallery = {},
            clock = { alarms = {} },

            notes = {},
            mails = {},
            contacts = {},

            applications = {
                settings = {
                    app = "settings",
                    color = "transparent",
                    
                    photo = "settings.png",
                    label = "Settings",
                    style = "padding-right = .08vh; font-size = 2.3vh",
                    
                    slot = 1,
                    page = 0,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                gallery = {
                    app = "gallery",
                    color = "transparent",
                    
                    photo = "gallery.png",
                    label = "Gallery",
                    
                    slot = 4,
                    page = 0,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                appstore = {
                    app = "appstore",
                    color = "transparent",
                    
                    photo = "appstore.png",
                    label = "App Store",
                    
                    slot = 5,
                    page = 1,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                camera = {
                    app = "camera",
                    color = "transparent",
                    
                    photo = "camera.png",
                    label = "Camera",
                    
                    slot = 6,
                    page = 1,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                clock = {
                    app = "clock",
                    color = "transparent",
                    
                    photo = "clock.png",
                    label = "Clock",
                    
                    slot = 7,
                    page = 1,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                messages = {
                    app = "messages",
                    color = "transparent",
                    
                    photo = "messages.png",
                    label = "Messages",
                    
                    slot = 2,
                    page = 0,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                contacts = {
                    app = "contacts",
                    color = "transparent",
                    
                    photo = "contacts2.png",
                    label = "Phone",
                    
                    slot = 3,
                    page = 0,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                phonecontacts = {
                    app = "phonecontacts",
                    color = "transparent",
                    
                    photo = "contacts.png",
                    label = "Contacts",
                    
                    slot = 9,
                    page = 1,
                    
                    currentPage = nil,
                    pageDetails = {},
                },
                calculator = {
                    app = "calculator",
                    color = "transparent",
                    
                    photo = "calculator.png",
                    label = "Calculator",
                    
                    slot = 8,
                    page = 1,
                    
                    currentPage = nil,
                    pageDetails = {},
            
                    rating = 3.2,        
                    downloadsize = 15,
                    apptype = "app",
                    appbuild = "LOS",
                },  
            }
        }
🖥️
this link
this link
this link
How to create an webhook
Page cover image