[OUTDATED] esx_aiTaxi -- Call a NPC-Taxi (GCPHONE)

!!! THIS SCRIPT IS OUTDATED. YOU CAN EDIT IT IF YOU WANT.
I´M NOT IN FIVEM BUISNESS ANYMORE !!!

Hey guys,

RP-Taxijob is really hard.
If everyone has cars this job is really hard.

Thats why decided to eliminate this job on our RP-Server.

But what if you need a taxi and no one can do this job anymore?
RIGHT… lets call a NPC-Taxi.

Features:

  • With gcphone you can call a NPC-Taxi
  • Ped will spawn at DowntownCab in LS
  • Taxi will spawn at DowntownCab in LS
    (you can change the models and the speed in the config.lua)
  • You can follow the Taxi on minimap or fullscreenmap in the menu (there is a moving blip)
  • if the taxi is arrived you have to enter and set a waypoint to the destination
  • taxi will despawn after 15 seconds after reaching the destination
  • you can change the drivemode in config
    (use this site to create a drivingmode: https://vespura.com/drivingstyle/)
    (thx @Vespura for this greate site :heavy_heart_exclamation:)

UPDATE 14.05.2019

  • there are multiple spawnpoints of the vehicle
  • it will looking for the best spawn (the nearest)
  • first option in GCPHONE is to call the taxi
    (you can not call a taxi twice)
  • second option is to cancel the order

here are two vids (one with AI-Traffic and one without)

TO GET IT WORK WITH YOUR GCPHONE YOU HAVE TO EDIT:
esx_addons_gcphone
server.lua

find:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source
  if PhoneNumbers[number] ~= nil then
    getPhoneNumber(source, function (phone) 
      notifyAlertSMS(number, {
        message = message,
        coords = coords,
        numero = phone,
      }, PhoneNumbers[number].sources)
    end)
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

and replace it with:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source

  if PhoneNumbers[number] ~= nil then
	if number == 'taxi' then
		if message == 'cancel' then
			TriggerClientEvent('esx_aiTaxi:cancelTaxi', source, true)
		else
			TriggerClientEvent('esx_aiTaxi:callTaxi', source, coords)
		end
	else
		getPhoneNumber(source, function (phone) 
		  notifyAlertSMS(number, {
			message = message,
			coords = coords,
			numero = phone,
		  }, PhoneNumbers[number].sources)
		end)
	end
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

Add this to the config.json of gcphone
these are the last lines in area of “serviceCall”

    },
    {
      "display": "Taxi",
      "backgroundColor": "yellow",
      "subMenu": [
	  {
			"title": "Taxi bestellen",
			"eventName": "esx_addons_gcphone:call",
			"type": {
				"number": "taxi",
				"message": "i need a ride"
			}
		},
        {
          "title": "Taxi abbestellen",
          "eventName": "esx_addons_gcphone:call",
          "type": {
				"number": "taxi",
				"message": "cancel"
			}
        }
      ]
    }
  ],

  "defaultContacts": [{

Known Bugs:

  • sometimes if the taxidriver hits another car he will stop driving and you have to cancel the order.
  • sometime the drivingmode is a little bit weird. if someone gets a better one feel free to share

i forgot something…??? feel free to post.

ohhh yeahhh forgot the githublink :wink:

i like feedback :wink:

RP-Taxijob is really hard.
If everyone has cars this job is really hard.

Thats why decided to eliminate this job on our RP-Server.

But what if you need a taxi and no one can do this job anymore?
RIGHT… lets call a NPC-Taxi.

Features:

  • With gcphone you can call a NPC-Taxi
  • Ped will spawn at DowntownCab in LS
  • Taxi will spawn at DowntownCab in LS
    (you can change the models and the speed in the config.lua)
  • You can follow the Taxi on minimap or fullscreenmap in the menu (there is a moving blip)
  • if the taxi is arrived you have to enter and set a waypoint to the destination
  • taxi will despawn after 15 seconds after reaching the destination
  • you can change the drivemode in config
    (use this site to create a drivingmode: https://vespura.com/drivingstyle/)
    (thx @Vespura for this greate site :heavy_heart_exclamation:)

UPDATE 14.05.2019

  • there are multiple spawnpoints of the vehicle
  • it will looking for the best spawn (the nearest)
  • first option in GCPHONE is to call the taxi
    (you can not call a taxi twice)
  • second option is to cancel the order

here are two vids (one with AI-Traffic and one without)

TO GET IT WORK WITH YOUR GCPHONE YOU HAVE TO EDIT:
esx_addons_gcphone
server.lua

find:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source
  if PhoneNumbers[number] ~= nil then
    getPhoneNumber(source, function (phone) 
      notifyAlertSMS(number, {
        message = message,
        coords = coords,
        numero = phone,
      }, PhoneNumbers[number].sources)
    end)
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

and replace it with:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source

  if PhoneNumbers[number] ~= nil then
	if number == 'taxi' then
		if message == 'cancel' then
			TriggerClientEvent('esx_aiTaxi:cancelTaxi', source, true)
		else
			TriggerClientEvent('esx_aiTaxi:callTaxi', source, coords)
		end
	else
		getPhoneNumber(source, function (phone) 
		  notifyAlertSMS(number, {
			message = message,
			coords = coords,
			numero = phone,
		  }, PhoneNumbers[number].sources)
		end)
	end
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

Add this to the config.json of gcphone
these are the last lines in area of “serviceCall”

    },
    {
      "display": "Taxi",
      "backgroundColor": "yellow",
      "subMenu": [
	  {
			"title": "Taxi bestellen",
			"eventName": "esx_addons_gcphone:call",
			"type": {
				"number": "taxi",
				"message": "i need a ride"
			}
		},
        {
          "title": "Taxi abbestellen",
          "eventName": "esx_addons_gcphone:call",
          "type": {
				"number": "taxi",
				"message": "cancel"
			}
        }
      ]
    }
  ],

  "defaultContacts": [{

Known Bugs:

  • sometimes if the taxidriver hits another car he will stop driving and you have to cancel the order.
  • sometime the drivingmode is a little bit weird. if someone gets a better one feel free to share

i forgot something…??? feel free to post.

ohhh yeahhh forgot the githublink :wink:

i like feedback :wink:
[/quote]

Hey guys,

RP-Taxijob is really hard.
If everyone has cars this job is really hard.

Thats why decided to eliminate this job on our RP-Server.

But what if you need a taxi and no one can do this job anymore?
RIGHT… lets call a NPC-Taxi.

Features:

  • With gcphone you can call a NPC-Taxi
  • Ped will spawn at DowntownCab in LS
  • Taxi will spawn at DowntownCab in LS
    (you can change the models and the speed in the config.lua)
  • You can follow the Taxi on minimap or fullscreenmap in the menu (there is a moving blip)
  • if the taxi is arrived you have to enter and set a waypoint to the destination
  • taxi will despawn after 15 seconds after reaching the destination
  • you can change the drivemode in config
    (use this site to create a drivingmode: https://vespura.com/drivingstyle/)
    (thx @Vespura for this greate site :heavy_heart_exclamation:)

UPDATE 14.05.2019

  • there are multiple spawnpoints of the vehicle
  • it will looking for the best spawn (the nearest)
  • first option in GCPHONE is to call the taxi
    (you can not call a taxi twice)
  • second option is to cancel the order

here are two vids (one with AI-Traffic and one without)

TO GET IT WORK WITH YOUR GCPHONE YOU HAVE TO EDIT:
esx_addons_gcphone
server.lua

find:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source
  if PhoneNumbers[number] ~= nil then
    getPhoneNumber(source, function (phone) 
      notifyAlertSMS(number, {
        message = message,
        coords = coords,
        numero = phone,
      }, PhoneNumbers[number].sources)
    end)
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

and replace it with:

RegisterServerEvent('esx_addons_gcphone:startCall')
AddEventHandler('esx_addons_gcphone:startCall', function (number, message, coords)
  local source = source

  if PhoneNumbers[number] ~= nil then
	if number == 'taxi' then
		if message == 'cancel' then
			TriggerClientEvent('esx_aiTaxi:cancelTaxi', source, true)
		else
			TriggerClientEvent('esx_aiTaxi:callTaxi', source, coords)
		end
	else
		getPhoneNumber(source, function (phone) 
		  notifyAlertSMS(number, {
			message = message,
			coords = coords,
			numero = phone,
		  }, PhoneNumbers[number].sources)
		end)
	end
  else
    print('Appels sur un service non enregistre => numero : ' .. number)
  end
end)

Add this to the config.json of gcphone
these are the last lines in area of “serviceCall”

    },
    {
      "display": "Taxi",
      "backgroundColor": "yellow",
      "subMenu": [
	  {
			"title": "Taxi bestellen",
			"eventName": "esx_addons_gcphone:call",
			"type": {
				"number": "taxi",
				"message": "i need a ride"
			}
		},
        {
          "title": "Taxi abbestellen",
          "eventName": "esx_addons_gcphone:call",
          "type": {
				"number": "taxi",
				"message": "cancel"
			}
        }
      ]
    }
  ],

  "defaultContacts": [{

Known Bugs:

  • sometimes if the taxidriver hits another car he will stop driving and you have to cancel the order.
  • sometime the drivingmode is a little bit weird. if someone gets a better one feel free to share

i forgot something…??? feel free to post.

ohhh yeahhh forgot the githublink :wink:

i like feedback :wink:

31 Likes

yay, i was about to make one… thank you dude, i’ll test this, really usefull for my kind of server
i’ll go check if esx_taxi is old


New esx_taxi fresh install, still not there… my gcphone is completely empty…

nice man i was working on this very same script. but instead of the gcphone u call it using the payphone.

does not appear on my phone

How to add your script in the config.json from gcphone?

added it to the original post

How to add this to Esx_phone3?

I did all readme procedure when I call for a taxi I get this msm on the console and taxi does not come to my location

event esx_addons_gcphone:startCall was not safe for net

“serviceCall”: [
{
“display”: “Downtown Co. Cab”,
“icon”: “/html/static/img/icons_app/taxi.png”,
“subMenu”: [
{
“title”: “Test”,
“eventName”: “esx_addons_gcphone:startCall”,
“type”: {
“number”: “taxi”
}
}
]
}
],

Is this ok?

You will see it if you are going ingame and try it :slight_smile:

I could give you a solution tomorrow if i have looked into the source of esx_phone3

1 Like

it dosent work!
That´s the reason why i ask you…
Can you send me your config.json please?

Default there should be 3 Jobs in it. Police, Ems and mecano. Just copy one of them and paste it under the last one

While the taxi is in motion, lets say we could tell him
“Step on it” == changing the driving style to something more aggressive, burning lights, not stoping for cars in the way… i remember there is a native to switch driving style while ped is driving…

SetDriveTaskDrivingStyle(PlayerPedId(), 556)

Works great only issue im having is if more then one person calls a cab , a cab shows up but no driver and if you set a way point with no driver it doesn’t go anywhere

1 Like

The cab without driver isnt yours. It should be the cab of the other Person.

To make driver visible for all players,

in client/main.lua:46
change from

		ped =  CreatePed(4, hash, Config.PedSpawn, Config.PedSpawnHeading, false, true)

to

		ped =  CreatePed(4, hash, Config.PedSpawn, Config.PedSpawnHeading, true, true)

1 Like

i understand your point , but even when two people are in two completely different parts of the city this seems to happen , upon further investigation it seem the driver for the cab someone or for some reason gets out of the cab but yet the cab still arrives leaving the driver back up the road just standing there , not sure 100% whats causing that .

Followed all the steps and only getting this error on console when trying to call a taxi:

event esx_addons_gcphone:startCall was not safe for net

NVM fixed… the instructions have you remove
RegisterServerEvent(‘esx_addons_gcphone:startCall’)
So of course theres no server event for it to call lol

Oh Yeah sorry my mistake there is one line missing. I will fix it :slight_smile: