Server

You will find server events of our gksphonev2 that you can use in this page.

Exports

Send Mail

-- src => Player's ID
local src = source
local MailData = {
  sender = 'GKSHOP',
  image = '/html/img/icons/mail.png',
  subject = "GKSPHONE",
  message = 'TEST',
  button = {   --- If you don't want it to be a button, please remove it.
       enabled = true,
       buttonEvent = "xxxxx:client:setLocation",
       buttonData = waitingDelivery,  -- data
       buttonname = "Test Button"
  }
}
exports["gksphone"]:SendNewMail(src, MailData)

Send Offline Mail

-- citizenID => ESX identifier
local xPlayer = ESX.GetPlayerFromId(source)
local citizenID = xPlayer.identifier
local MailData = {
  sender = 'GKSHOP',
  image = '/html/img/icons/mail.png',
  subject = "GKSPHONE",
  message = 'TEST',
  button = {   --- If you don't want it to be a button, please remove it.
       enabled = true,
       buttonEvent = "xxxxx:client:setLocation",
       buttonData = waitingDelivery,  -- data
       buttonname = "Test Button"
  }
}
exports["gksphone"]:SendNewMailOffline(citizenID, MailData)

New Billing

-- src => Player's ID
-- label => Billing description
-- society => By which job the billingwas created
-- senderBilling => Who is the person sending the billing?
-- senderID => ESX Identifier of the billing originator
-- amount => Billing price
local src = source
local label = "Excessive Speed"
local society = "police"
local senderBilling = "GKSHOP XENKNIGHT"  -- Player Name
local senderID = "char1:4b110a7811" -- xPlayer.identifier
local amount = 500
exports["gksphone"]:NewBilling(src, label, society, senderBilling, senderID, amount)

Send Notification

-- src => Player's ID
local src = source
local NotifData = {
    title = "Notification header", -- Notification header
    message = "Notification Message", -- Notification content message
    icon    = '/html/img/icons/messages.png', -- Icon of the notification
    duration = 5000, -- specify how many seconds,
    type = "success", -- the home screen will also appear on the notification side.
    buttonactive = false, -- Activate if you want to use the button function
    button = {
       buttonEvent = "gksphone:client:Test", -- event name to use if the button approves
       buttonData = "test", -- If you want to transfer any data in the button
    }
}
exports["gksphone"]:sendNotification(src, NotifData)

New Number

local source = src -- player id
local phoneID = uniqID or nil
local NewNumber = "555555" -- example
local newNumber = exports["gksphone"]:NewNumber(source, phoneID, NewNumber)
print(newNumber) -- true/false

Send Dispatch

local src = source
local ped = GetPlayerPed(player)

local reportMessage = "Dispatch Message"
local reportPhoto = "Image Link" or nil
local job = "police" -- job code 
local anonymous = false -- or true
local playerCoords = GetEntityCoords(ped)
local streedZone = "Street name" or "Unknown"
local sendDispatch = exports["gksphone"]:SendDispatch(src, reportMessage, reportPhoto, job, anonymous, playerCoords, streedZone)
print(sendDispatch) -- true/false

Bank History Save

local src = source
local type = 1 -- 1 (-) or 2 (+)
local amount = 500
local description = "Bank History Desc"

local historySave = exports["gksphone"]:BankSaveHistory(src, type, amount, description)
print(historySave) -- true/false

Job Status Change

The job in the Dispatch section is for opening and closing

local job = "police" -- job code
local status = true -- true or false
exports["gksphone"]:JobStatusChange(job, status)

Is Unpaid Bill

To inquire if the player has any outstanding bills

local xPlayer = ESX.GetPlayerFromId(source)
local citizenID = xPlayer.identifier
local isBills = exports["gksphone"]:IsUnpaidBillsbyCid(citizenID)
print(isBills) -- true or false

Phone Data Exports

GetPhoneBySource

Find phone number with Source

local src = source
local phoneNumber = exports["gksphone"]:GetPhoneBySource(src)
print(phoneNumber)

-- OR

local xPlayer = ESX.GetPlayerFromId(source)
local phoneNumber = xPlayer.getMeta("phoneNumber")
print(phoneNumber)

GetSourceByPhone

Finding a source by phone number

local phoneNumber = number
local source = exports["gksphone"]:GetSourceByPhone(phoneNumber)
print(source)

GetPhoneDataBySource

Access the data of the phone used with the Source number

local src = source
local phoneData = exports["gksphone"]:GetPhoneDataBySource(src)
print(json.encode(phoneData))

GetPhoneDataByNumber

Accessing the phone's data with the phone number

local phoneNumber = number
local phoneData = exports["gksphone"]:GetPhoneDataByNumber(phoneNumber)
print(json.encode(phoneData))

GetPhoneDataBySetupOwner

Accessing all phone data of the player

local xPlayer = ESX.GetPlayerFromId(source)
local citizenID = xPlayer.identifier
local phoneData = exports["gksphone"]:GetPhoneDataBySetupOwner(citizenID)
print(json.encode(phoneData))

GetPhoneDataByPhoneUniqID

Access phone data with the phone's UniqID

local phoneUniqID = id
local phoneData = exports["gksphone"]:GetPhoneDataByPhoneUniqID(phoneUniqID)
print(json.encode(phoneData))

GetPhoneDataByCitizenID

Access phone data with the user's ID (You will access the data of the last phone the user opened)

local xPlayer = ESX.GetPlayerFromId(source)
local citizenID = xPlayer.identifier
local phoneData = exports["gksphone"]:GetPhoneDataByCitizenID(citizenID)
print(json.encode(phoneData))

GetPhoneLangBySource

The language the user chooses on the phone

local src = source
local PhoneLang = exports["gksphone"]:GetPhoneLangBySource(src)
print(PhoneLang)

Last updated