Within this asset you will find more snippets in server/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.
getPhoneNames
You can get phone name by using this export. It returns all phone names.
-- It returns all phone names.exports['qs-smartphone-pro']:getPhoneNames()
An example of using this system would be the following.
This export returns player's phone number. If the user has used the phone. It prioritizes that phone. If the user has never used a phone, it returns the phone number of any phone from its inventory.
-- identifier: Like ESX.GetPlayerFromId(source).identifier-- owner: If its true, checks phone owner is the identifier. So you can handle to a stolen phone.exports['qs-smartphone-pro']:GetPhoneNumberFromIdentifier(identifier, owner)
An example of using this system would be the following.
RegisterCommand('getPhone', function(source,args) local identifier = GetPlayerIdentifier(source) -- This is a player identifier. Like ESX.GetPlayerFromId(source).identifier
local mustBePhoneOwner = true -- If its true, checks phone owner is the identifier. So you can handle to a stolen phone.
local number = exports['qs-smartphone-pro']:GetPhoneNumberFromIdentifier(identifier, mustBePhoneOwner)print(number) -- Phone number or falseend, false)
getMeta
This export returns player's currently using or last used phone meta.
-- source: Debe enviar el player sourceexports['qs-smartphone-pro']:getMetaFromSource(source)
An example of using this system would be the following.
RegisterCommand('getMeta', function(source,args)local meta = exports['qs-smartphone-pro']:getMetaFromSource(source)print(json.encode(meta, { indent =true })) -- Phone meta or falseend, false)
sendSOSMessage
This export sends a SOS message to a phone number, make use of the other exports to find the declared values.
-- phoneNumber: Phone number of the person sending the message-- job: Job where the SOS message will be sent-- coords: Coordinates to send-- type: Type of message, use 'location' to send a locationexports['qs-smartphone-pro']:sendSOSMessage(phoneNumber, job, json.encode(coords), 'location')
An example of using this system would be the following.
RegisterCommand('sendSOSMessage', function(source,args)local src = sourcelocal identifier =GetPlayerIdentifier(src) local phoneNumber = exports['qs-smartphone-pro']:GetPhoneNumberFromIdentifier(identifier, false) -- Sender phone number
local job ='ambulance'local coords =GetEntityCoords(GetPlayerPed(src)) exports['qs-smartphone-pro']:sendSOSMessage(phoneNumber, job, json.encode(coords), 'location')end, false)
sendNewMessageFromApp
This export sends a new message from a app. You can use this to send a message from a app, make use of the other exports to find the declared values. An example of this is the verification message that arrives when registering for some apps.
-- source: Player source-- phoneNumber: Phone number of the person sending the message-- message: Message to send-- appName: Name of the app that sends said messageexports['qs-smartphone-pro']:sendNewMessageFromApp(source, phoneNumber, message, appName)
An example of using this system would be the following.