Codineer Docs
Search…
Ai Taxi Pro
Imagine, you are playing on your favorite server, and you are somewhere in the nowhere, and you have only 2 options: 1. steal a car and 2. spawn a car. Now there is a third option: Call a Taxi!

Phone Implementation

The guide below shows how to connect AiTaxiPro with GCPhone, other phone scripts are supported but the implementation may be different.
Please note that we are using gcphone version 1.5.2 and the implementation could be different in older versions.
Open the config.json file of your gcphone installation and search for the following line:
config.json
1
"serviceCall": [{
Copied!
If you already have a taxi service change its event to "Taxi:CallTaxi" it should look like this:
config.json
1
"eventName": "Taxi:CallTaxi",
Copied!
If you do not have a taxi service yet create one by adding the following lines of code to your serviceCall list:
config.json
1
{
2
"display": "Taxi",
3
"icon": "/html/static/img/icons_app/taxi.png",
4
"subMenu": [{
5
"title": "Call a taxi",
6
"eventName": "Taxi:CallTaxi",
7
"type": {
8
"number": "taxi"
9
}
10
},
11
{
12
"title": "Cancel your taxi",
13
"eventName": "Taxi:CancelTaxi",
14
"type": {
15
"number": "taxi"
16
}
17
}
18
]
19
}
Copied!
Please note that you have to add the image to your icons_app folder yourself.
Your finished services list should look something like this:
config.json
1
"serviceCall": [{
2
"display": "Police",
3
"icon": "/html/static/img/icons_app/policia.png",
4
"subMenu": [{
5
"title": "Send a message",
6
"eventName": "esx_addons_gcphone:call",
7
"type": {
8
"number": "police"
9
}
10
},
11
{
12
"title": "Call emergency number",
13
"eventName": "gcphone:autoCallNumber",
14
"type": {
15
"number": "911"
16
}
17
}
18
]
19
},
20
{
21
"display": "Ambulance",
22
"backgroundColor": "red",
23
"icon": "/html/static/img/icons_app/lsfd.png",
24
"subMenu": [{
25
"title": "Send a message",
26
"eventName": "esx_addons_gcphone:call",
27
"type": {
28
"number": "ambulance"
29
}
30
}]
31
},
32
{
33
"display": "Taxi",
34
"icon": "/html/static/img/icons_app/taxi.png",
35
"subMenu": [{
36
"title": "Call a taxi",
37
"eventName": "Taxi:CallTaxi",
38
"type": {
39
"number": "taxi"
40
}
41
},
42
{
43
"title": "Cancel your taxi",
44
"eventName": "Taxi:CancelTaxi",
45
"type": {
46
"number": "taxi"
47
}
48
}
49
]
50
}
51
],
Copied!
Now we have to edit another file inside our gcphone installation. Please open the following file: "client/client.lua" and search for the following line:
client.lua
1
RegisterNUICallback('callEvent', function(data, cb)
Copied!
The function below this line should look like this:
client.lua
1
RegisterNUICallback('callEvent', function(data, cb)
2
local eventName = data.eventName or ''
3
if string.match(eventName, 'gcphone') then
4
if data.data ~= nil then
5
TriggerEvent(data.eventName, data.data)
6
else
7
TriggerEvent(data.eventName)
8
end
9
else
10
print('Event not allowed')
11
end
12
cb()
13
end)
14
RegisterNUICallback('useMouse', function(um, cb)
15
useMouse = um
16
end)
17
RegisterNUICallback('deleteALL', function(data, cb)
18
TriggerServerEvent('gcPhone:deleteALL')
19
cb()
20
end)
Copied!
Now replace this function with this one:
client.lua
1
RegisterNUICallback('callEvent', function(data, cb)
2
local eventName = data.eventName or ''
3
if string.match(eventName, 'gcphone') or string.match(eventName, 'Taxi') then
4
if data.data ~= nil then
5
TriggerEvent(data.eventName, data.data)
6
else
7
TriggerEvent(data.eventName)
8
end
9
else
10
print('Event not allowed')
11
end
12
cb()
13
end)
14
RegisterNUICallback('useMouse', function(um, cb)
15
useMouse = um
16
end)
17
RegisterNUICallback('deleteALL', function(data, cb)
18
TriggerServerEvent('gcPhone:deleteALL')
19
cb()
20
end)
Copied!
It looks very similar and the only thing that changed is that not only gcphones own events, but now also the Taxi events are allowed.
Last modified 4mo ago
Copy link