Client Exports

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

Misc

Send Notification


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"]:Notification(NotifData)

Mail

Send Mail

local waitingDelivery = { location = { x = 0, y = 0, z = 0 }, name = "Test Location" }
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 = "gksphone:client:mailtest",
       buttonData = waitingDelivery,  -- data
       buttonname = "Test Button"
  }
}
exports["gksphone"]:SendNewMail(MailData)

------

RegisterNetEvent("gksphone:client:mailtest", function (data)
    debugprint("gksphone:client:mailtest")
    print(data.name)  -- Test Location
    print(data.location) -- { x = 0, y = 0, z = 0 }
end)

Call

Create Call

local options = {
    number = "1111", --string
    videoCall = true, -- true or false / boolean
    hideNumber = false, -- true or false / boolean
}
exports["gksphone"]:CreateCall(options)

End Call

exports["gksphone"]:EndCall()

Is In Call

local inCall = exports["gksphone"]:IsInCall()
print(inCall) -- true or false

CreateCallNumber

-- Do not use the number in the service application
---@class IncomingCall
---@field id string
---@field accept fun()
---@field deny fun()
local createcall, reason = exports['gksphone']:CreateCallNumber("911", {
    displayName = "Police",
    onCall = function(incomingCall)
        print("Incoming call from: " .. incomingCall.id)
        Wait(6000)  -- 6sn
        incomingCall.accept() -- Automatically accept the call
    end,
    onEnd = function()
        print("Call ended")
    end
})
if createcall then
    print("Create call created successfully")
else
    print("Failed to create custom call")
end

RemoveCallNumber

local removecall, reason = exports['gksphone']:RemoveCallNumber("911")
if removecall then
    print("Call deleted successfully")
else
    print(reason)
end

CallEndCustom

exports['gksphone']:CallEndCustom()

Custom App

Add Custom App

local appData = {
	name = "mdt", --- A unique name
	description = ""  -- App description that will appear in the app store
	icons = "/html/img/icons/mdt.png",  -- logo url
        appurl = "https://cfx-nui-gksphone-app/ui/index.html",  -- custom app url
	url = "/customapp",   -- do not touch this part
	blockedjobs = {},
	allowjob = {},
	signal = true,
	show = true,
	labelLangs = {   -- App name by languages
		af = "MDT",
		ar = "MDT",
		cs = "MDT",
		de = "MDT",
		en = "MDT",
		es = "MDT",
		fr = "MDT",
		id = "MDT",
		nl = "MDT",
		["pt-PT"] = "MDT",
		ro = "MDT",
		sv = "MDT",
		th = "MDT",
		tr = "MDT",
		uk = "MDT",
		["zh-TW"] = "MDT"
	}
}
exports["gksphone"]:AddCustomApp(appData)

Phone

isPhoneOpen

local isPhoneOpen = exports["gksphone"]:isPhoneOpen()
print(isPhoneOpen) -- true / false

PhoneOpen

In order for the phone to be open, a player must first open it from the inventory.

exports["gksphone"]:PhoneOpen()

PhoneClose

exports["gksphone"]:PhoneClose()

PhoneOpenBlock

Prevent the phone from turning on

local reason = "Phone cannot be used while handcuffed"
exports["gksphone"]:PhoneOpenBlock(reason)

PhoneOpenUnBlock

If you have blocked the phone from turning on, you can activate it again with this export.

exports["gksphone"]:PhoneOpenUnBlock()

PhoneOpenBlockStatus

local status, reason = exports["gksphone"]:PhoneOpenBlockStatus()
print(status, reason) -- true/false, reason

PhoneNumber

local phoneNumber = exports["gksphone"]:PhoneNumber()
print(phoneNumber) -- nil or 5555555

PhoneUniqueId

local phoneUniqId = exports["gksphone"]:PhoneUniqueId()
print(phoneUniqId) -- GKS2222222

Is Camera Open

local isCameraOpen = exports["gksphone"]:IsCameraOpen()
print(isCameraOpen) -- true or false

Services

Send Report

local reportMessage = "Report Message"
local reportPhoto = "Image Link" or nil
local job = "ambulance" -- job code
local anonymous = false -- or true

exports["gksphone"]:SendReport(reportMessage, reportPhoto, job, anonymous)

Battery

GetPhoneBattery

local battery = exports["gksphone"]:GetPhoneBattery()
print(battery) -- The battery percentage, 0-100

SetPhoneBattery

local battery = 100 -- The battery percentage, 0-100
exports["gksphone"]:SetPhoneBattery(battery)

SavePhoneBattery

local battery = 100 -- The battery percentage, 0-100
exports["gksphone"]:SavePhoneBattery(battery)

ToggleCharging

local charging = true -- true or false
exports["gksphone"]:ToggleCharging(charging)

IsPhoneBatteryDead

local isBatteryDead = exports["gksphone"]:IsPhoneBatteryDead()
print(isBatteryDead) -- true or false / If the phone has 0% battery

IsPhoneCharging

local isCharging = exports["gksphone"]:IsPhoneCharging()
print(isCharging) -- true or false

Signal

You must enable Config.Signal (gksphone/config/signal/config.lua) to use Export. Signal requires polyzone

addSignal

local coord = vec3(-1378.91, -74.53, 51.29) -- v3
local radius = 5
local signalId = exports["gksphone"]:addSignal(coord, radius)
print(signalId) -- This information is required to remove the region.

destroySignal

exports["gksphone"]:destroySignal(signalId)

Misc

heavyJammer

This export renders the phone unusable and only a message section appears in the middle of the screen.

local status = true -- true or false
local message = "The message you want to write on the screen"
exports["gksphone"]:heavyJammer(status, message)

Last updated