Integrate with phone
Learn how to integrate the call list with your phone.
Choose the phone the server uses below and follow the guide to integrate the call list with the phone
- high_phone
- qb-phone
- gcphone
- gksphone
- qs-smartphone
- qbus-phone
- roadphone
- lb-phone
- npwd
- ls-phone
- ESX
- QBCore
- Open the folder
high_phone
and go into the filesh_config.lua
- Find the line
Config.CustomCallbacks
and scroll down to ["sendMessage"]
Now you insert the highlighted bit of code and it should send a call to the police or ems when a message is sent to them
-- Messages app
["sendMessage"] = function(data)
local service = ""
if data.number == "01" then -- Make sure the number is correct
service = "police"
elseif data.number == "02" then -- Make sure the number is correct
service = "ambulance"
end -- Add more lines if you have additional services
TriggerServerEvent("omik_callist:newCall", nil, data.content, service)
TriggerServerEvent("high_phone:sendMessage", data.number, data.content, data.attachments, data.time)
end,
- Open the folder
high_phone
and go into the filesh_config_QB.lua
- Find the line
Config.CustomCallbacks
and scroll down to ["sendMessage"]
Now you insert the highlighted bit of code and it should send a call to the police or ems when a message is sent to them
-- Messages app
["sendMessage"] = function(data)
local service = ""
if data.number == "01" then -- Make sure the number is correct
service = "police"
elseif data.number == "02" then -- Make sure the number is correct
service = "ambulance"
end -- Add more lines if you have additional services
TriggerServerEvent("omik_callist:newCall", nil, data.content, service)
TriggerServerEvent("high_phone:sendMessage", data.number, data.content, data.attachments, data.time)
end,
- QBCore
I have investigated qb-phone
and I'm afraid I can't see a way to register when players write to the police
You can however register calls in another way follow the guide
Police
- Open the folder
qb-policejob
and go into the fileserver/main.lua
- Find the line
QBCore.Commands.Add('911p'...
Linje 467 - Then scroll down to the line
local players = QBCore.Functions.GetQBPlayers()
Linje 473
After the line, you insert the highlighted bit of code. Now the police should receive calls when a police alert is sent
QBCore.Commands.Add('911p', Lang:t("commands.police_report"), {{name='message', help= Lang:t("commands.message_sent")}}, false, function(source, args)
local src = source
local message
if args[1] then message = table.concat(args, " ") else message = Lang:t("commands.civilian_call") end
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
local players = QBCore.Functions.GetQBPlayers()
exports["omik_callist"]:newCall(src, message, "police", coords.xy) -- Add this line
for _, v in pairs(players) do
if v and v.PlayerData.job.name == 'police' and v.PlayerData.job.onduty then
local alertData = {title = Lang:t("commands.emergency_call"), coords = {x = coords.x, y = coords.y, z = coords.z}, description = message}
TriggerClientEvent("qb-phone:client:addPoliceAlert", v.PlayerData.source, alertData)
TriggerClientEvent('police:client:policeAlert', v.PlayerData.source, coords, message)
end
end
end)
You can also do the same with ems so they receive a call when they get an ems alert
Ambulance
- Open the folder
qb-ambulancejob
and go into the fileserver/main.lua
- Find the line
QBCore.Commands.Add('911e'...
Linje 331 - Then scroll down to the line
local players = QBCore.Functions.GetQBPlayers()
Linje337
After the line, you insert the highlighted bit of code. Now the doctors should receive calls when an ems alert is sent
QBCore.Commands.Add('911e', Lang:t('info.ems_report'), {{name = 'message', help = Lang:t('info.message_sent')}}, false, function(source, args)
local src = source
local message
if args[1] then message = table.concat(args, " ") else message = Lang:t('info.civ_call') end
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
local players = QBCore.Functions.GetQBPlayers()
exports["omik_callist"]:newCall(src, message, "ambulance", coords.xy) -- Add this line
for _, v in pairs(players) do
if v.PlayerData.job.name == 'ambulance' and v.PlayerData.job.onduty then
TriggerClientEvent('hospital:client:ambulanceAlert', v.PlayerData.source, coords, message)
end
end
end)
- vRP
- ESX
Jobs
To receive calls from gcphone, you need to have all jobs from gcphone/html/static/config/config.json
- Go to
gcphone/html/static/config/config.json
and scroll down to"serviceCall"
Line 96 - Then you copy all jobs as seen in the image below until there are no more - They should go into
omik_callist/config.lua
underConfig.jobs
- Now
Config.jobs
inomik_callist/config.lua
should look like below
Config.jobs = {
"Police",
"Ambulance",
-- remember to add , after each job
}
Send Calls
- If you have an
addons.lua
in thegcphone/server
folder, then go into it otherwise do as below - Go into the
vrp_addons_gcphone
folder and open the fileserver.lua
- Find the event
vrp_addons_gcphone:startCall
orservice:startCall
in the file you have opened - Make a new line at the bottom of the event so it looks like one of the 2 images
- Add the highlighted bit of code to the event and it should send calls to the call list
RegisterServerEvent('service:startCall')
AddEventHandler('service:startCall', function (number, message, coords)
local source = source
local user_id = vRP.getUserId({source})
if PhoneNumbers[number] ~= nil then
vRP.getUserIdentity({user_id, function(identity)
local phone = identity.phone
TriggerEvent("omik_callist:addTable", tostring(source), message, number)
end})
end
if number and message and coords then
exports["omik_callist"]:newCall(source, message, number, coords.xy)
end
end)
Jobs
To receive calls from gcphone, you need to have all jobs from gcphone/html/static/config/config.json
- Go to
gcphone/html/static/config/config.json
and scroll down to"serviceCall"
- Then you copy all jobs as seen in the image below until there are no more - They should go into
omik_callist/config.lua
underConfig.jobs
- Now
Config.jobs
inomik_callist/config.lua
should look like below
Config.jobs = {
"police",
"ambulance",
-- remember to add , after each job
}
Send Calls
- If you have an
esxaddonsgcphone-s.lua
in thegcphone/server
folder, then go into it otherwise do as below - Go into the
esx_addons_gcphone
folder and open the fileserver.lua
- Find the events
esx_addons_gcphone:startCall
andgcPhone:sendMessage
in the file you have opened - Make a new line at the bottom of each event so it looks like the image
- Add the highlighted bit of code to the events and it should send calls to the call list
RegisterServerEvent('gcPhone:sendMessage')
AddEventHandler('gcPhone:sendMessage', function(number, message)
local sourcePlayer = tonumber(source)
if PhoneNumbers[number] ~= nil then
getPhoneNumber(source, function (phone)
notifyAlertSMS(number, {
message = message,
numero = phone,
source = sourcePlayer
}, PhoneNumbers[number].sources)
end)
end
local xPlayer = ESX.GetPlayerFromId(sourcePlayer)
local coords = xPlayer.getCoords()
if number and message and coords then
exports["omik_callist"]:newCall(sourcePlayer, message, number, coords.xy)
end
end)
RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
local sourcePlayer = tonumber(source)
if PhoneNumbers[number] ~= nil then
getPhoneNumber(source, function (phone)
notifyAlertSMS(number, {
message = message,
coords = coords,
numero = phone,
source = sourcePlayer
}, PhoneNumbers[number].sources)
end)
else
print('= WARNING = Trying to call an unregistered service => numero : ' .. number)
end
if number and message and coords then
exports["omik_callist"]:newCall(sourcePlayer, message, number, coords.xy)
end
end)
- ESX
- QBCore
First we need to get all the jobs that are set up in gksphone
and put them into Config.jobs
in omik_callist/config.lua
- Go into the
gksphone
folder and find the filegksphone/html/static/config/config.json
- Find the line that says
"JobMessages"
- Now you need to copy all the jobs that you have in your config.json, you need to take the first string in each array. (See the image below)
- Now put the copied jobs into
Config.jobs
inomik_callist/config.lua
it should look like this:
Config.jobs = {
"police",
"ambulance",
"mechanic",
-- remember to add , after each job
}
- Now you need to go into the
gksphone
folder and open the filegksphone/client/clientAPI.lua
- Scroll down to the line
RegisterNUICallback('JobMMessages', function(data, cb)
and then add the highlighted code in the box below
RegisterNUICallback('JobMMessages', function(data, cb)
local myPos = GetEntityCoords(PlayerPedId())
local GPS = 'GPS: ' .. myPos.x .. ', ' .. myPos.y
TriggerServerEvent('gksphone:gkcs:jbmessage', data.name, data.number, data.message, data.photo, GPS, data.jobm, data.anon)
TriggerServerEvent("omik_callist:newCall", GetPlayerServerId(PlayerId()), data.message, json.decode(data.jobm)[1], myPos.x, myPos.y)
cb('ok')
end)
First we need to get all the jobs that are set up in gksphone
and put them into Config.jobs
in omik_callist/config.lua
- Go into the
gksphone
folder and find the filegksphone/html/static/config/config.json
- Find the line that says
"JobMessages"
- Now you need to copy all the jobs that you have in your config.json, you need to take the first string in each array. (See the image below)
- Now put the copied jobs into
Config.jobs
inomik_callist/config.lua
it should look like this:
Config.jobs = {
"police",
"ambulance",
"mechanic",
-- remember to add , after each job
}
- Now you need to go into the
gksphone
folder and open the filegksphone/client/clientAPI.lua
- Scroll down to the line
RegisterNUICallback('JobMMessages', function(data, cb)
and then add the highlighted code in the box below
RegisterNUICallback('JobMMessages', function(data, cb)
local myPos = GetEntityCoords(PlayerPedId())
local GPS = 'GPS: ' .. myPos.x .. ', ' .. myPos.y
TriggerServerEvent('gksphone:gkcs:jbmessage', data.name, data.number, data.message, data.photo, GPS, data.jobm, data.anon)
TriggerServerEvent("omik_callist:newCall", PlayerData.source, data.message, json.decode(data.jobm)[1], myPos.x, myPos.y)
cb('ok')
end)
- ESX
- QBCore
First we need to get all the jobs that are set up in qs-smartphone
and put them into Config.jobs
in omik_callist/config.lua
- Go into the
qs-smartphone
folder and find the fileqs-smartphone/config/config.lua
- Find the line that says
Config.Jobs
- Now you need to copy all the jobs that are first in the row (the ones that are marked in the image below)
- Now put the copied jobs into
Config.jobs
inomik_callist/config.lua
it should look like this:
Config.jobs = {
"police",
"ambulance",
"mechanic",
-- remember to add a , after each job
}
This phone is a bit special so it requires a bit of fiddling to get it to work
We need to listen to the conversation between the phone's UI and its backend code, so we need to put some code into a file that can send a call when it receives what it is listening for
- Go into the
qs-smartphone/client
folder and create a new file calledomik_callist.lua
- Open the new file and copy all the code below into it
RegisterNUICallback("SendNewMessage", function(data, cb) -- When a new message is sent, the code checks if it is a message to a job, if it is, it creates a call in the call list
local coords = GetEntityCoords(PlayerPedId(), false)
for key, value in pairs(Config.Jobs) do -- check if the phone number is a job
if data.phone == value.job then
TriggerServerEvent("omik_callist:newCall", nil, data.message, data.phone, coords.xy)
break -- stop when it has sent a call
end
end
end)
It is also very important that we add the file we just created to fxmanifest.lua
- Open the file
fxmanifest.lua
and addclient/omik_callist.lua
to the list (it should be as shown below)
client_scripts {
'config/config.lua',
'config/config_framework.lua',
'client/functions_framework.lua',
'client/omik_callist.lua', -- add this line HERE
'client/main.lua',
'client/uber.lua',
'client/photo.lua',
'client/rentel.lua',
'client/valet.lua',
'client/discord.lua',
'client/room_creation.lua',
'client/business.lua',
'client/pincode.lua',
'config/config_discord.lua',
'config/config_vehicles.lua',
'config/config_pincode.lua',
'config/config_animations.lua',
'config/config_rentel.lua',
'config/config_uber.lua',
'config/config_client.lua',
'config/config_radio.lua',
'config/config_calls_client.lua',
'config/config_invoices_client.lua',
'config/config_business.lua',
'config/translations.lua',
}
Now it should send a call when a message is sent to a job through the phone
First we need to get all the jobs that are set up in qs-smartphone
and put them into Config.jobs
in omik_callist/config.lua
- Go into the
qs-smartphone
folder and find the file `qs-smartphone/config/config.lua - Find the line that says
Config.Jobs
- Now you need to copy all the jobs that are first in the row (the ones that are marked in the image below)
- Now put the copied jobs into
Config.jobs
inomik_callist/config.lua
it should look like this:
Config.jobs = {
"police",
"ambulance",
"mechanic",
-- remember to add a , after each job
}
This phone is a bit special so it requires a bit of fiddling to get it to work
We need to listen to the conversation between the phone's UI and its backend code, so we need to put some code into a file that can send a call when it receives what it is listening for
- Go into the
qs-smartphone/client
folder and create a new file calledomik_callist.lua
- Open the new file and copy all the code below into it
RegisterNUICallback("SendNewMessage", function(data, cb) -- When a new message is sent, the code checks if it is a message to a job, if it is, it creates a call in the call list
local coords = GetEntityCoords(PlayerPedId(), false)
for key, value in pairs(Config.Jobs) do -- check if the phone number is a job
if data.phone == value.job then
TriggerServerEvent("omik_callist:newCall", nil, data.message, data.phone, coords.xy)
break -- stop when it has sent a call
end
end
end)
It is also very important that we add the file we just created to fxmanifest.lua
- Open the file
fxmanifest.lua
and addclient/omik_callist.lua
to the list (it should be as shown below)
client_scripts {
'config/config.lua',
'config/config_framework.lua',
'client/functions_framework.lua',
'client/omik_callist.lua', -- add this line HERE
'client/main.lua',
'client/uber.lua',
'client/photo.lua',
'client/rentel.lua',
'client/valet.lua',
'client/discord.lua',
'client/room_creation.lua',
'client/business.lua',
'client/pincode.lua',
'config/config_discord.lua',
'config/config_vehicles.lua',
'config/config_pincode.lua',
'config/config_animations.lua',
'config/config_rentel.lua',
'config/config_uber.lua',
'config/config_client.lua',
'config/config_radio.lua',
'config/config_calls_client.lua',
'config/config_invoices_client.lua',
'config/config_business.lua',
'config/translations.lua',
}
Now it should send a call when a message is sent to a job through the phone
Update SQL Queries
- Go into
omik_callist/config.lua
- Update
Config.SQL
queries to look like the following:
...
Config.SQL = {
ESX = {
select_phone = "SELECT JSON_UNQUOTE(JSON_EXTRACT(charinfo, '$.phone')) AS phone FROM users WHERE identifier = @identifier",
select_identifier = "SELECT identifier AS identifier FROM users WHERE phone_number = @phone",
},
vRP = {
select_identifier = "SELECT user_id AS user_id FROM vrp_user_identities WHERE phone = @phone",
}
}
...
- ESX
I have investigated the phone and I can't see a way to register when players write to the police
You can however register calls in another way, follow the guide
Ambulance
- Open the folder
esx_ambulancejob
and go into the fileserver/main.lua
- Find the line
RegisterNetEvent('esx_ambulancejob:onPlayerDistress')
Line 78 - Then scroll down to the line
local source = source
Line 80
After the line, you put in the highlighted code, so the doctors should receive calls when an ems alert is sent
RegisterNetEvent('esx_ambulancejob:onPlayerDistress')
AddEventHandler('esx_ambulancejob:onPlayerDistress', function()
local source = source
local xPlayer = ESX.GetPlayerFromId(source)
local coords = xPlayer.getCoords()
exports["omik_callist"]:newCall(0, "En bevidstløs person er blevet fundet", "ambulance", coords.xy) -- src = 0 to use ensure it shows up as "Unknown" in the call list
if deadPlayers[source] then
deadPlayers[source] = 'distress'
local Ambulance = ESX.GetExtendedPlayers("job", "ambulance")
for _, xPlayer in pairs(Ambulance) do
TriggerClientEvent('esx_ambulancejob:PlayerDistressed', xPlayer.source, source)
end
end
end)
Unfortunatly I have not been able to find a way to record calls and send them to the police via the phone.
If you have a way to do it, I would love to hear from you Contact OMikkel
- ESX
- QBCore
Jobs
To receive calls from lb-phone, you need to have all jobs from lb-phone/config/config.lua
- Go to
lb-phone/config/config.lua
and scroll down to"Config.Companies.Services"
- Then you copy all jobs as seen in the image below until there are no more - They should go into
omik_callist/config.lua
underConfig.jobs
- Now
Config.jobs
inomik_callist/config.lua
should look like below
Config.jobs = {
"police",
-- remember to add , after each job
}
Send Calls
- Go to
lb-phone/server/apps/framework/services.lua
- Scroll down to
line 67
, where you add the highlighted code:
local x, y
if isContacter then
local coords = GetEntityCoords(GetPlayerPed(source))
x = coords.x
y = coords.y
exports["omik_callist"]:newCall(source, message, company, coords.x, coords.y)
end
Jobs
To receive calls from lb-phone, you need to have all jobs from lb-phone/config/config.lua
- Go to
lb-phone/config/config.lua
and scroll down to"Config.Companies.Services"
- Then you copy all jobs as seen in the image below until there are no more - They should go into
omik_callist/config.lua
underConfig.jobs
- Now
Config.jobs
inomik_callist/config.lua
should look like below
Config.jobs = {
"police",
-- remember to add , after each job
}
Send Calls
- Go to
lb-phone/server/apps/framework/services.lua
- Scroll down to
line 67
, where you add the highlighted code:
local x, y
if isContacter then
local coords = GetEntityCoords(GetPlayerPed(source))
x = coords.x
y = coords.y
exports["omik_callist"]:newCall(source, message, company, coords.x, coords.y)
end
Update SQL Queries
- Go to
omik_callist/config.lua
- Update
Config.SQL
queries to look like below:
...
Config.SQL = {
ESX = {
select_phone = "SELECT phone_number AS phone FROM phone_phones WHERE id = @identifier",
select_identifier = "SELECT identifier AS identifier FROM users WHERE phone_number = @phone",
},
vRP = {
select_identifier = "SELECT user_id AS user_id FROM vrp_user_identities WHERE phone = @phone",
}
}
...
Jobs
NPWD can only send calls to jobs that are in omik_callist/config.lua
under Config.jobs
You can change jobs in omik_callist/config.lua
under Config.jobs
Config.jobs = {
"Police",
"Ambulance",
-- remember to add , after each job
}
Send Calls
For NPWD to send calls, a file needs to be created in npwd
called omik_callist.lua
The idea is that this file should listen for the event npwd:sendMessage
and then send it to omik_callist
if it is a job that is in omik_callist/config.lua
- Add the code below into
npwd/omik_callist.lua
RegisterNetEvent("npwd:sendMessage")
AddEventHandler("npwd:sendMessage", function(_, data)
local callistConfig = exports["omik_callist"]:Config()
for number in string.gmatch(data.conversationList, "[^+]+") do
for _, job in pairs(callistConfig.jobs) do
if job == number then
local playerCoords = GetEntityCoords(GetPlayerPed(source))
exports["omik_callist"]:newCall(source, data.message, number, playerCoords.xy)
break
end
end
end
end)
- Add
omik_callist.lua
tofxmanifest.lua
innpwd
...
server_script({
...
"omik_callist.lua"
})
...
Set phone
Set config.phone = "ls-phone" in omik_callist/config.lua
Config.phone = "ls-phone"
Update SQL Queries
- Go to
omik_callist/config.lua
- Update
Config.SQL
queries to look like below:
...
Config.SQL = {
ESX = {
select_phone = "SELECT JSON_UNQUOTE(JSON_EXTRACT(ph.data, '$.MetaData.phonenumber')) AS phone FROM phone_metadata ph WHERE identifier = @identifier",
select_identifier = "SELECT identifier AS identifier FROM users WHERE phone_number = @phone",
},
vRP = {
select_identifier = "SELECT user_id AS user_id FROM vrp_user_identities WHERE phone = @phone",
}
}
...