how do i get Press E to take call and then i get a destination on the gps ?
In english please, if you want help
You can update this files for change traduction : gcphone/html/static/config/config.json
With vdk_call maybe ?
Yes i see, but i don’t know why, because i don’t modify client.lua
Send this files
--====================================================================================
-- #Author: Jonathan D @ Gannon
--====================================================================================
-- Configuration
local KeyToucheCloseEvent = {
{ code = 172, event = 'ArrowUp' },
{ code = 173, event = 'ArrowDown' },
{ code = 174, event = 'ArrowLeft' },
{ code = 175, event = 'ArrowRight' },
{ code = 176, event = 'Enter' },
{ code = 177, event = 'Backspace' },
}
local KeyOpenClose = 288 -- F1
local KeyTakeCall = 38 -- E
local menuIsOpen = false
local contacts = {}
local messages = {}
local myPhoneNumber = ''
local isDead = false
local USE_RTC = false
local PhoneInCall = {}
local currentPlaySound = false
local soundId = 1485
--====================================================================================
-- Active ou Deactive une application (appName => config.json)
--====================================================================================
RegisterNetEvent('gcPhone:setEnableApp')
AddEventHandler('gcPhone:setEnableApp', function(appName, enable)
SendNUIMessage({event = 'setEnableApp', appName = appName, enable = enable })
end)
--====================================================================================
-- Gestion des appels fixe
--====================================================================================
function startFixeCall (fixeNumber)
local number = ''
DisplayOnscreenKeyboard(1, "FMMC_MPM_NA", "", "", "", "", "", 10)
while (UpdateOnscreenKeyboard() == 0) do
DisableAllControlActions(0);
Wait(0);
end
if (GetOnscreenKeyboardResult()) then
number = GetOnscreenKeyboardResult()
end
if number ~= '' then
TriggerEvent('gcphone:autoCall', number, {
useNumber = fixeNumber
})
PhonePlayCall(true)
end
end
function TakeAppel (infoCall)
TriggerEvent('gcphone:autoAcceptCall', infoCall)
end
RegisterNetEvent("gcPhone:notifyFixePhoneChange")
AddEventHandler("gcPhone:notifyFixePhoneChange", function(_PhoneInCall)
PhoneInCall = _PhoneInCall
end)
--[[
Affiche les imformations quant le joueurs est proche d'un fixe
--]]
function showFixePhoneHelper (coords)
for number, data in pairs(FixePhone) do
local dist = GetDistanceBetweenCoords(
data.coords.x, data.coords.y, data.coords.z,
coords.x, coords.y, coords.z, 1)
if dist <= 2.0 then
SetTextComponentFormat("STRING")
AddTextComponentString("~g~" .. data.name .. ' ~o~' .. number .. '~n~~INPUT_PICKUP~~w~ Utiliser')
DisplayHelpTextFromStringLabel(0, 0, 0, -1)
if IsControlJustPressed(1, KeyTakeCall) then
startFixeCall(number)
end
break
end
end
end
Citizen.CreateThread(function ()
while true do
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local inRangeToActivePhone = false
for i, _ in pairs(PhoneInCall) do
local dist = GetDistanceBetweenCoords(
PhoneInCall[i].coords.x, PhoneInCall[i].coords.y, PhoneInCall[i].coords.z,
coords.x, coords.y, coords.z, 1)
if (dist <= 5.0) then
DrawMarker(1, PhoneInCall[i].coords.x, PhoneInCall[i].coords.y, PhoneInCall[i].coords.z,
0,0,0, 0,0,0, 0.1,0.1,0.1, 0,255,0,255, 0,0,0,0,0,0,0)
inRangeToActivePhone = true
if (dist <= 1.5) then
SetTextComponentFormat("STRING")
AddTextComponentString("~INPUT_PICKUP~ Décrocher")
DisplayHelpTextFromStringLabel(0, 0, 1, -1)
if IsControlJustPressed(1, KeyTakeCall) then
PhonePlayCall(true)
TakeAppel(PhoneInCall[i])
PhoneInCall = {}
StopSound(soundId)
end
end
break
end
end
if inRangeToActivePhone == false then
showFixePhoneHelper(coords)
end
if inRangeToActivePhone == true and currentPlaySound == false then
PlaySound(soundId, "Remote_Ring", "Phone_SoundSet_Michael", 0, 0, 1)
currentPlaySound = true
elseif inRangeToActivePhone == false and currentPlaySound == true then
currentPlaySound = false
StopSound(soundId)
end
Citizen.Wait(0)
end
end)
--====================================================================================
--
--====================================================================================
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
-- if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 0 ) then
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 2 ) -- keyboards return true, no keybord return false
TooglePhone()
end
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 0 ) then
TooglePhone()
end
if menuIsOpen == true then
for _, value in ipairs(KeyToucheCloseEvent) do
if IsControlJustPressed(1, value.code) then
SendNUIMessage({keyUp = value.event})
end
end
end
end
end)
RegisterNetEvent("gcPhone:forceOpenPhone")
AddEventHandler("gcPhone:forceOpenPhone", function(_myPhoneNumber)
if menuIsOpen == false then
TooglePhone()
end
end)
--====================================================================================
-- Events
--====================================================================================
RegisterNetEvent("gcPhone:myPhoneNumber")
AddEventHandler("gcPhone:myPhoneNumber", function(_myPhoneNumber)
myPhoneNumber = _myPhoneNumber
SendNUIMessage({event = 'updateMyPhoneNumber', myPhoneNumber = myPhoneNumber})
end)
RegisterNetEvent("gcPhone:contactList")
AddEventHandler("gcPhone:contactList", function(_contacts)
SendNUIMessage({event = 'updateContacts', contacts = _contacts})
contacts = _contacts
end)
RegisterNetEvent("gcPhone:allMessage")
AddEventHandler("gcPhone:allMessage", function(allmessages)
SendNUIMessage({event = 'updateMessages', messages = allmessages})
messages = allmessages
end)
RegisterNetEvent("gcPhone:getBourse")
AddEventHandler("gcPhone:getBourse", function(bourse)
SendNUIMessage({event = 'updateBourse', bourse = bourse})
end)
RegisterNetEvent("gcPhone:receiveMessage")
AddEventHandler("gcPhone:receiveMessage", function(message)
-- SendNUIMessage({event = 'updateMessages', messages = messages})
SendNUIMessage({event = 'newMessage', message = message})
if message.owner == 0 then
local text = '~o~Nouveau message'
if ShowNumberNotification == true then
text = '~o~Nouveau message du ~y~'.. message.transmitter
for _,contact in pairs(contacts) do
if contact.number == message.transmitter then
text = '~o~Nouveau message de ~g~'.. contact.display
break
end
end
end
SetNotificationTextEntry("STRING")
AddTextComponentString(text)
DrawNotification(false, false)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Citizen.Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
Citizen.Wait(300)
PlaySound(-1, "Menu_Accept", "Phone_SoundSet_Default", 0, 0, 1)
end
end)
--====================================================================================
-- Function client | Contacts
--====================================================================================
function addContact(display, num)
TriggerServerEvent('gcPhone:addContact', display, num)
end
function deleteContact(num)
TriggerServerEvent('gcPhone:deleteContact', num)
end
--====================================================================================
-- Function client | Messages
--====================================================================================
function sendMessage(num, message)
TriggerServerEvent('gcPhone:sendMessage', num, message)
end
function deleteMessage(msgId)
TriggerServerEvent('gcPhone:deleteMessage', msgId)
for k, v in ipairs(messages) do
if v.id == msgId then
table.remove(messages, k)
SendNUIMessage({event = 'updateMessages', messages = messages})
return
end
end
end
function deleteMessageContact(num)
TriggerServerEvent('gcPhone:deleteMessageNumber', num)
end
function deleteAllMessage()
TriggerServerEvent('gcPhone:deleteAllMessage')
end
function setReadMessageNumber(num)
TriggerServerEvent('gcPhone:setReadMessageNumber', num)
for k, v in ipairs(messages) do
if v.transmitter == num then
v.isRead = 1
end
end
end
function requestAllMessages()
TriggerServerEvent('gcPhone:requestAllMessages')
end
function requestAllContact()
TriggerServerEvent('gcPhone:requestAllContact')
end
--====================================================================================
-- Function client | Appels
--====================================================================================
local inCall = false
local aminCall = false
RegisterNetEvent("gcPhone:waitingCall")
AddEventHandler("gcPhone:waitingCall", function(infoCall, initiator)
SendNUIMessage({event = 'waitingCall', infoCall = infoCall, initiator = initiator})
print('---------------------', initiator)
if initiator == true then
PhonePlayCall()
if menuIsOpen == false then
TooglePhone()
end
end
end)
RegisterNetEvent("gcPhone:acceptCall")
AddEventHandler("gcPhone:acceptCall", function(infoCall, initiator)
if inCall == false and USE_RTC == false then
inCall = true
NetworkSetVoiceChannel(infoCall.id + 1)
NetworkSetTalkerProximity(0.0)
end
if menuIsOpen == false then
TooglePhone()
end
PhonePlayCall()
SendNUIMessage({event = 'acceptCall', infoCall = infoCall, initiator = initiator})
end)
RegisterNetEvent("gcPhone:rejectCall")
AddEventHandler("gcPhone:rejectCall", function(infoCall)
if inCall == true then
inCall = false
Citizen.InvokeNative(0xE036A705F989E049)
NetworkSetTalkerProximity(2.5)
end
PhonePlayText()
SendNUIMessage({event = 'rejectCall', infoCall = infoCall})
end)
RegisterNetEvent("gcPhone:historiqueCall")
AddEventHandler("gcPhone:historiqueCall", function(historique)
SendNUIMessage({event = 'historiqueCall', historique = historique})
end)
function rejectCall(infoCall)
TriggerServerEvent('gcPhone:rejectCall', infoCall)
end
function ignoreCall(infoCall)
TriggerServerEvent('gcPhone:ignoreCall', infoCall)
end
function requestHistoriqueCall()
TriggerServerEvent('gcPhone:getHistoriqueCall')
end
function appelsDeleteHistorique (num)
TriggerServerEvent('gcPhone:appelsDeleteHistorique', num)
end
function appelsDeleteAllHistorique ()
TriggerServerEvent('gcPhone:appelsDeleteAllHistorique')
end
--====================================================================================
-- Event NUI - Appels
--====================================================================================
function startCall (phone_number, rtcOffer, extraData)
TriggerServerEvent('gcPhone:startCall', phone_number, rtcOffer, extraData)
end
RegisterNUICallback('startCall', function (data, cb)
print(json.encode(data))
startCall(data.numero, data.rtcOffer, data.extraData)
cb()
end)
function acceptCall (infoCall, rtcAnswer)
TriggerServerEvent('gcPhone:acceptCall', infoCall, rtcAnswer)
end
RegisterNUICallback('acceptCall', function (data, cb)
acceptCall(data.infoCall, data.rtcAnswer)
cb()
end)
RegisterNUICallback('rejectCall', function (data, cb)
rejectCall(data.infoCall)
cb()
end)
RegisterNUICallback('ignoreCall', function (data, cb)
ignoreCall(data.infoCall)
cb()
end)
RegisterNUICallback('notififyUseRTC', function (use, cb)
USE_RTC = use
if USE_RTC == true and inCall == true then
print('USE RTC ON')
inCall = false
Citizen.InvokeNative(0xE036A705F989E049)
NetworkSetTalkerProximity(2.5)
end
cb()
end)
RegisterNUICallback('onCandidates', function (data, cb)
TriggerServerEvent('gcPhone:candidates', data.id, data.candidates)
cb()
end)
RegisterNetEvent("gcPhone:candidates")
AddEventHandler("gcPhone:candidates", function(candidates)
SendNUIMessage({event = 'candidatesAvailable', candidates = candidates})
end)
RegisterNetEvent('gcphone:autoCall')
AddEventHandler('gcphone:autoCall', function(number, extraData)
if number ~= nil then
print('number', number)
SendNUIMessage({ event = "autoStartCall", number = number, extraData = extraData})
end
end)
RegisterNetEvent('gcphone:autoCallNumber')
AddEventHandler('gcphone:autoCallNumber', function(data)
TriggerEvent('gcphone:autoCall', data.number)
end)
RegisterNetEvent('gcphone:autoAcceptCall')
AddEventHandler('gcphone:autoAcceptCall', function(infoCall)
SendNUIMessage({ event = "autoAcceptCall", infoCall = infoCall})
end)
--====================================================================================
-- Gestion des evenements NUI
--====================================================================================
RegisterNUICallback('log', function(data, cb)
print(data)
cb()
end)
RegisterNUICallback('focus', function(data, cb)
cb()
end)
RegisterNUICallback('blur', function(data, cb)
cb()
end)
RegisterNUICallback('reponseText', function(data, cb)
local limit = data.limit or 255
local text = data.text or ''
DisplayOnscreenKeyboard(1, "FMMC_MPM_NA", "", text, "", "", "", limit)
while (UpdateOnscreenKeyboard() == 0) do
DisableAllControlActions(0);
Wait(0);
end
if (GetOnscreenKeyboardResult()) then
text = GetOnscreenKeyboardResult()
end
cb(json.encode({text = text}))
end)
--====================================================================================
-- Event - Messages
--====================================================================================
RegisterNUICallback('getMessages', function(data, cb)
cb(json.encode(messages))
end)
RegisterNUICallback('sendMessage', function(data, cb)
if data.message == '%pos%' then
local myPos = GetEntityCoords(PlayerPedId())
data.message = 'GPS: ' .. myPos.x .. ', ' .. myPos.y
end
TriggerServerEvent('gcPhone:sendMessage', data.phoneNumber, data.message)
end)
RegisterNUICallback('deleteMessage', function(data, cb)
deleteMessage(data.id)
cb()
end)
RegisterNUICallback('deleteMessageNumber', function (data, cb)
deleteMessageContact(data.number)
cb()
end)
RegisterNUICallback('deleteAllMessage', function (data, cb)
deleteAllMessage()
cb()
end)
RegisterNUICallback('setReadMessageNumber', function (data, cb)
setReadMessageNumber(data.number)
cb()
end)
--====================================================================================
-- Event - Contacts
--====================================================================================
RegisterNUICallback('addContact', function(data, cb)
TriggerServerEvent('gcPhone:addContact', data.display, data.phoneNumber)
end)
RegisterNUICallback('updateContact', function(data, cb)
TriggerServerEvent('gcPhone:updateContact', data.id, data.display, data.phoneNumber)
end)
RegisterNUICallback('deleteContact', function(data, cb)
TriggerServerEvent('gcPhone:deleteContact', data.id)
end)
RegisterNUICallback('getContacts', function(data, cb)
cb(json.encode(contacts))
end)
RegisterNUICallback('setGPS', function(data, cb)
SetNewWaypoint(tonumber(data.x), tonumber(data.y))
cb()
end)
RegisterNUICallback('callEvent', function(data, cb)
if data.data ~= nil then
TriggerEvent(data.eventName, data.data)
else
TriggerEvent(data.eventName)
end
cb()
end)
RegisterNUICallback('deleteALL', function(data, cb)
TriggerServerEvent('gcPhone:deleteALL')
cb()
end)
function TooglePhone()
menuIsOpen = not menuIsOpen
SendNUIMessage({show = menuIsOpen})
if menuIsOpen == true then
PhonePlayIn()
else
PhonePlayOut()
end
end
RegisterNUICallback('takePhoto', function(data, cb)
menuIsOpen = false
SendNUIMessage({show = false})
cb()
TriggerEvent('camera:open')
end)
RegisterNUICallback('closePhone', function(data, cb)
menuIsOpen = false
SendNUIMessage({show = false})
PhonePlayOut()
cb()
end)
----------------------------------
---------- GESTION APPEL ---------
----------------------------------
RegisterNUICallback('appelsDeleteHistorique', function (data, cb)
appelsDeleteHistorique(data.numero)
cb()
end)
RegisterNUICallback('appelsDeleteAllHistorique', function (data, cb)
appelsDeleteAllHistorique(data.infoCall)
cb()
end)
----------------------------------
---------- GESTION VIA WEBRTC ----
----------------------------------
AddEventHandler('onClientResourceStart', function(res)
DoScreenFadeIn(300)
if res == "gcphone" then
TriggerServerEvent('gcPhone:allUpdate')
end
end)
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 2 ) -- keyboards return true, no keybord return false
TooglePhone()
end
to:
if IsControlJustPressed(1, KeyOpenClose) and GetLastInputMethod( 2 ) then -- keyboards return true, no keybord return false
TooglePhone()
end
Hi guys i have problem. When i write message to someone, phone will stuck. Im using latest version from @HalCroves . Do you know how to fix it??
What version of mysql do you use ?
where i can check it?
i found it its 3.0.8
Show me your file gcphone/server/server.lua and gcphone/server/app_tchat.lua
Use this server.lua : https://github.com/HalCroves/gcphone/blob/mysql-async-3.x/gcphone/server/server.lua
and this app_tchat.lua : https://github.com/HalCroves/gcphone/blob/mysql-async-3.x/gcphone/server/app_tchat.lua
Hal - One of the biggest issues is that the newest ASync, doesn’t allow for some of the callbacks that gcphone uses, It replaces them with new callback functions. If you need help getting these taken care of, please let me know, I’m currently about to update from 2.x.x ASync to 3.x.x (Newest Version) from my original gcphone edit.
hello, can you plz make a vision to VRP. that is the best script i have seen i long time <3
Hi,
Where u can change the language of it and where i can change the button to open it rn its f2 but i wanna change it to f1 help tnx
I get that error es_extended: TriggerServerCallback => [gcphone:getItemAmount] does not exist
When I tried to make gcphone an item which can be removed. any ideas?
Do you have the callback ?