[Tutorial] - GCPhone - Adding calls and job messages

Phone is not showing when i open it

Hello,
Probably a syntax problem if you have modified files. If you have any other ressources for phone, they must be deleted …

Hi,
In your jobs addons (esx_ambulancejob, esx_policejob…)

Like what kind resources like esx_phone3 or something like that

Whats wrong? When i send a message it not shows up on the phone and when il go back once it turns white and when i hit back second time ill come back on main screen and when ill go back in messages it is still white.

Hi,

  • Server ESX or VRP ?

    • Because gcphone is only for ESX.
  • Did you correctly import the SQL database ?

    • If so, are the messages that are sent visible in your database ?
  • Do you have errors via the server console or via the F8 console ?

  • Do you use another phone ?

    • If so, have you tried to disable it?
  • Where did you put the start gcphone ?

  • Did you start the gcphone before the jobs?

  • Have you made any changes ?

  • Have you clear the server cache ?

  • Did you follow the tutorial correctly?

Please bring as much information as you can :slight_smile:

Hi,

Have you tried to disable it?

And look this post : [Tutorial] - GCPhone - Adding calls and job messages

Hi maybe someone can help me. I have the phone as item but i still get notifications. The message notifications were easy to turn of but where does it trigger the ringtone?

Hi,

I do not really understand your request. My english is approximate :joy:

  • You have the phone in item (so far no problem).
  • You receive notifications? Yes … what do you want to do exactly? Do not receive any more notifications and calls? But for what purpose

The sound is in client.lua :

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)

Yeah well if i don’t have the phone i don’t want any notifications either. Same way as if i turn off the phone i don’t want notifications. Yeah i disabled that part of the code last night, still the ringtone came up. Maybe i have to take another look. Thanks anyway :slight_smile:

Oh ok,
Maybe check in the server.lua if player have item :

local phone_item = xPlayer.getInventoryItem('nameofphoneindb')
local xPlayer = ESX.GetPlayerFromId(destPlayer)

And check this party of code (not sure because I’m at work and I do not have access to everything :thinking:)

    if is_valid == true then
        getSourceFromIdentifier(destPlayer, function (srcTo)
            if srcTo ~= nill then
                AppelsEnCours[indexCall].receiver_src = srcTo
                TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
                TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
                TriggerClientEvent('gcPhone:waitingCall', srcTo, AppelsEnCours[indexCall], false)
            else
                TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
                TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
            end
        end)
    else
        TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
        TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    end

look this ?

	local xPlayer = ESX.GetPlayerFromId(destPlayer)
	local phone_item = xPlayer.getInventoryItem('nameofphoneindb')

    if is_valid == true then
        getSourceFromIdentifier(destPlayer, function (srcTo)
		
			if phone_item.count ~= 0 then -- add this
				if srcTo ~= nill then
					AppelsEnCours[indexCall].receiver_src = srcTo
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
					TriggerClientEvent('gcPhone:waitingCall', srcTo, AppelsEnCours[indexCall], false)
				else
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
				end
			end 
			-- fin
        end)
   -- else
        --TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
        --TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    end

Hi, is there some way to set zoom at 80% by default?

1 Like

attempt to index a nil value (local ‘xPlayer’) on “local phone_item = xPlayer.getInventoryItem(‘phone’)” It Doesnt want to grab destPlayer for some reason

Hi,

Maybe add in your config.json this :

"zoom" : "80%",

Or in your html/static/js/app.js, search

 zoom: window.localStorage.gc_zoom || "100%",

and replace by :

 zoom: window.localStorage.gc_zoom || "80%",
1 Like

Hummm…

    if is_valid == true then
        getSourceFromIdentifier(destPlayer, function (srcTo)
			local xPlayer = ESX.GetPlayerFromId(destPlayer)
			local phone_item = xPlayer.getInventoryItem('phone')
			
			if phone_item.count ~= 0 then -- add this
				if srcTo ~= nill then
					AppelsEnCours[indexCall].receiver_src = srcTo
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
					TriggerClientEvent('gcPhone:waitingCall', srcTo, AppelsEnCours[indexCall], false)
				else
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
				end
			end 
			-- fin
        end)
   -- else
        --TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
        --TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    -- endriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    end

Same result. Don’t know what i’m doing wrong.

If you add a simple print for get the value of “destPlayer” what does it return? (look in F8 console)

    if is_valid == true then
        getSourceFromIdentifier(destPlayer, function (srcTo)
			local xPlayer = ESX.GetPlayerFromId(destPlayer)
			local phone_item = xPlayer.getInventoryItem('phone')
---- THIS
			print(xPlayer .. "=>" .. srcTo)
---- THIS
			if phone_item.count ~= 0 then -- add this
				if srcTo ~= nill then
					AppelsEnCours[indexCall].receiver_src = srcTo
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
					TriggerClientEvent('gcPhone:waitingCall', srcTo, AppelsEnCours[indexCall], false)
				else
					TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
					TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
				end
			end 
			-- fin
        end)
   -- else
        --TriggerEvent('gcPhone:addCall', AppelsEnCours[indexCall])
        --TriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    -- endriggerClientEvent('gcPhone:waitingCall', sourcePlayer, AppelsEnCours[indexCall], true)
    end

It returns the number i was calling. {“numero”: “924-4835”}

Oh yep… it’s just the number of the player calling …
I’m sorry i do not see how, I’m not competent enough to help you more :disappointed_relieved:

Get this error over and over. No idea why.

Edit: fixed this but the whole mod is broken and this tutorial confused the hell outta me haha. Might give this mod a miss. Sucks though because I’ve used this on another server and it was fantastic.