[Q&A] GCPhone Questions? Ask them here, Will update main post frequently with updates

PLEASE BE DETAILED ABOUT YOUR QUESTIONS AND DESCRIPTIVE ABOUT YOUR ISSUES, ANY IMAGES, ERROR CODES IN F8 or Console, ETC HELPS US RESOLVE YOUR ISSUE FASTER!!!

We also need to know which version of the phone you’re using, Did you update it from Halcroves Github, or Mine, and are you on the mysql-async 2.x version or 3.x

So I have seen A LOT of people asking various questions about the GCPhone system in various posts all over the forums, and I would like to help clean this up a bit.

ANY questions you have, please ask them here. I will contact Halcroves also to see if he wants to help with some of the questions, and I will update the first post here as time allows with the most frequent questions and the answers on how to resolve those questions.

Feel free to ask anything GCPhone related specifically, and one of the members around here can/will answer if/when we have time.

Question: Numbers aren’t generating for my players, How can I fix this?

Answer: Check this post by @yknuff [Q&A] GCPhone Questions? Ask them here, Will update main post frequently with updates

Question: How do I make Distress Signals work when you’re injured?

Answer: Search your esx_ambulancejob for:

function SendDistressSignal()
	local playerPed = PlayerPedId()
	local coords	= GetEntityCoords(playerPed)

	ESX.ShowNotification(_U('distress_sent'))
	TriggerServerEvent('esx_phone:send', 'ambulance', _U('distress_message'), false, {
		x = coords.x,
		y = coords.y,
		z = coords.z
	})
end

And replace with

function SendDistressSignal()
	local playerPed = PlayerPedId()
	PedPosition		= GetEntityCoords(playerPed)
	
	local PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z }

	ESX.ShowNotification(_U('distress_sent'))

    TriggerServerEvent('esx_addons_gcphone:startCall', 'ambulance', _U('distress_message'), PlayerCoords, {

		PlayerCoords = { x = PedPosition.x, y = PedPosition.y, z = PedPosition.z },
	})
end

---------------------------------------------------------

Question: Calls aren’t working for police and ambulance/ems. How do I fix this?

Answer: The typical reason for this not working is because you Didn’t set your config up properly. You need to start esx_addons_gcphone and gcphone resources. Set your config up in this order:

####################### ES Base
start mysql-async
start essentialmode
start esplugin_mysql
start es_admin2 

####################### BASIC
start instance
start es_extended
start esx_voice
start esx_addons_gcphone
start gcphone

###### Jobs ######
start esx_service
start esx_mecanojob
start esx_lscustom
start esx_truckerjob

---------------------------------------------------------------------

Question: How do I make the phone an Item? And purchasable.

Answer:
Add this to client.lua: (This opens the phone linked to an item)

ESX = nil
Citizen.CreateThread (function ()
while ESX == nil do
TriggerEvent (‘esx: getSharedObject’, function (obj) ESX = obj end)
Citizen.Wait (0)
end
end)
function hasPhone (cb)
if (ESX == nil) then return cb (0) end
ESX.TriggerServerCallback (‘gcphone: getItemAmount’, function (qtty)
cb (qtty> 0)
end, ‘phone’)
end
function ShowNoPhoneWarning ()
if (ESX == nil) then return end
ESX.ShowNotification (“You do not have a ~ r ~ phone ~ s ~”)
end


In the server side put:

local ESX = nil
TriggerEvent(‘esx:getSharedObject’, function(obj)
ESX = obj
ESX.RegisterServerCallback(‘gcphone:getItemAmount’, function(source, cb, item)
print('gcphone:getItemAmount call item : ’ … item)
local xPlayer = ESX.GetPlayerFromId(source)
local items = xPlayer.getInventoryItem(item)
if items == nil then
cb(0)
else
cb(items.count)
end
end)
end)

After that, in your Database, go to the items table, Right click inside and click “INSERT ROW” and set:
name: phone
label: Phone (Or whatever you want it to display as in your inventory)
limit: 1 (Unless you want them to be able to hold more than 1 item, but it’s useless to have more than 1 unless selling phones to people or buying one for a friend.)
And leave other options like “id” and “rare” and “can_remove” as default.

Make sure you put the item into your stores so they are purchasable.

4 Likes

Hey @BTNGaming, thnks for all :slight_smile:
I have a question, actually i do all what you tell to do…

I install Mysql-Async 3.xx, esx_voice, vdk_call …etc. My server is powered by Zap Hosting.

The console tell me this … :confused:
image

This is my server.cfg,

But, when i m in game, i can do all with the phone but… when i try to send a message to police or ambulance… Nothing.

Thank you for your help, and lot of thnks :stuck_out_tongue:

Bonjour de la France :wink:

Can you put ES_Extended above the phones?

You want this order (You can have scripts in between but Essentialmode and es_extended need to be BEFORE the phone and addons. And ADDONS_GCPhone needs to be before gcphone.

essentialmode
es_extended
esx_addons_gcphone
gcphone

2 Likes

Hello,
I’m trying to find a release for twitter on the gcphone.
Is there anything out there?

Thnks for all :slight_smile: @BTNGaming

It’s workkkkk Youpiiii

Bonsoir de la France :wink:

1 Like

Hey There BTN,

I see the main post in French details this but it may help others for an explanation from you here.

Adding jobs into the phone like Taxi and Fire

Put them into \gcphone\html\static\config\config.json

{
      "display": "Taxi",
      "backgroundColor": "orange",
      "subMenu": [
        {
          "title": "Send a Message",
          "eventName": "esx_addons_gcphone:call",
          "type": {
            "number": "taxi"
          }
        }
      ]
    },

My question would be about how to add a dialog box that comes up when you receive a service call like “Press Y to accept” and then it routes your GPS without needing to open the phone.

The more recent like… 4 releases have Twitter in the phone, you’ll have to convert some of the language stuff into English in the config.json but other than that you should be PRETTY MUCH set to go.

I will have to get back to you on that, I did it once, but I forgot how I did that off hand. It requires you to have pNotify installed in your server as that is the notification popup you are speaking of though.

Hello,
Let’s start off by saying that I have only just started to learn LUA, CSS and JS in the past couple of weeks.
I am using the GCPhone by N3MTV.
I’m trying to attempt to change the twitter notifications to use the chat that I am using.
The chat I’m using is reknits_chat, a remake of esx_rpchat.
Anyways, I have successfully ‘removed’ the default twitter notification by going into:
gcphone/html/static/css/app.css and adding opacity to the notification:

.notification[data-v-64f456c2]{
    width:450px;
    background-color:rgba(29,161,242,.6);
    color:#fff;
    padding:8px 16px;
    margin-bottom:8px;
    border-radius:6px;
    opacity: 0
}

In addition to this, I have gone into gcphone/server/twitter.lua and have edited the gcPhone:twitter_postTweets event as such.

RegisterServerEvent('gcPhone:twitter_postTweets')
AddEventHandler('gcPhone:twitter_postTweets', function(username, password, message)
  local sourcePlayer = tonumber(source)
  local srcIdentifier = getPlayerID(source)
  TwitterPostTweet(username, password, message, sourcePlayer, srcIdentifier)
  TriggerClientEvent('chat:addMessage', -1, {
      template = '<div style="padding: 0.8vw; margin: 1.0vw; background-color: rgba(62, 174, 244, 0.7);border-radius:12px;">^0<i class="fab fa-twitter" size: 7x></i> @{0}^0: {1}</div>',
      args = { username, message }
  })
end)

Ultimately, it does hide the original notification but I am having issues figuring out how to utilise the notification settings that are set through the phone.
I found some code relating to ‘gcphone_twitter_notif’ in gcphone/html/static/js/app.js but I am unsure how to implement it.

Any help or guidance would be appreciated, let me know if you need any additional information.

Thanks.

Hey, thanks for the info, I got twitter working now but I encounter another problem:
When I try to change the default key from 289 F2 to 288 F1 (using F2 for inventory), I get a 'Error parsing script @gcphone/client/client.lua
Where is my mistake? Do I Need to change something else too?

phone number not added for new user
can u help me with this ?

What is the full error @YoloAutumn? Because I use 288 aka F1 and no issues.

What do you mean? Did you install the database for the phone and adjust the phone number size you are using to match the size you want? My new phone numbers are 5 digits.

I am going to do this on my server also, please give me a day or 2 to reply to you on this, if you don’t get a response, post in here again, I check these at least once a day depending on how busy I am. I will give you a full rundown on ALL files and edits needed. Are you still wanting them to REGISTER and use the full twitter or just the /twt feature in the phone ?

I’m trying to set it up to use Twitter completely from the phone but the notifications come through the same chat as OOC.
Took this screenshot last night, the only thing that I need to get working is the phone notification settings. The message still comes through the chat regardless of the setting in the phone (metion only, all, none). Not sure how I’d go about implementing it.

My friend who is good at JS / CSS should be able to help me today too. Pretty sure that the code to do with the notifications is in gcphone/html/static/js/app.js.

yeah dude i install all the database file
no%20number

[ 439500] nui://esx_identity/html/script.js:15, Uncaught InvalidStateError: Failed to execute ‘setSelectionRange’ on ‘HTMLInputElement’: The input element’s type (‘number’) does not support selection.
[ 439516]
i have no idea what happen

That what I get when changing 289 to 288

Show us your gcphone/client/client.lua.

Where is your client.lua?

how can i make it so i have to buy a cellphone from a shop and if they dont have it they cant use this?