Hello Guys,
I can GCPhone with Tokovoip? by Call? or not?
Sorry for Bad english…
Hello Guys,
I can GCPhone with Tokovoip? by Call? or not?
Sorry for Bad english…
Not sure, why don’t you try it and find out Whats the worst that could happen?
Yes you can use gcphone with tokovoip
How To add TokoVOIP to GCPhone
Before I start I wan’t to say that I do not provide support for this code because I don’t have enough time to help you all with this thing. It works good for people who know how to add this, but for the other people who only are able to do copy paste it might not work.
Make shure you do not have RTC enabled or any own data in the config!
First add this: [gcphone/client/client.lua] to the other locals: Make shure it is the last local.
local TokoVoipID = nil
Replace this [gcphone/client/client.lua]
NetworkSetVoiceChannel(infoCall.id + 1)
NetworkSetTalkerProximity(0.0)
to
exports.tokovoip_script:addPlayerToRadio(infoCall.id + 120)
TokoVoipID = infoCall.id + 120
Now find
NetworkSetTalkerProximity(2.5)
Because people have to reject the call
And replace it it with:
exports.tokovoip_script:removePlayerFromRadio(TokoVoipID)
TokoVoipID = nil
Now find:
RegisterNUICallback(‘notififyUseRTC’, function (use, cb)
and add
exports.tokovoip_script:removePlayerFromRadio(TokoVoipID)
TokoVoipID = nil
under
Citizen.InvokeNative(0xE036A705F989E049)
and remove
NetworkSetTalkerProximity(2.5)
And you’re done.
Nice Dude!
Thank You
Is not working
this is working
--====================================================================================
-- #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 -- F2
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
local TokoVoipID = nil
--====================================================================================
-- 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~ Use')
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~ Answer")
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
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~New Message'
if ShowNumberNotification == true then
text = '~o~New message from ~y~'.. message.transmitter
for _,contact in pairs(contacts) do
if contact.number == message.transmitter then
text = '~o~New message from ~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
exports.tokovoip_script:addPlayerToRadio(infoCall.id + 120)
TokoVoipID = infoCall.id + 120
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)
exports.tokovoip_script:removePlayerFromRadio(TokoVoipID)
TokoVoipID = nil
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)
exports.tokovoip_script:removePlayerFromRadio(TokoVoipID)
TokoVoipID = nil
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)
function openPhone()
if menuIsOpen == false then
TooglePhone()
end
end
Hmmmm Where is the mistake
im having the same issue not sure why they arnt working together ive seen people using it must be something we are doing wrong.
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.