Phone & Script Integrations
MTM-TAXI provides a clean, decoupled client export that allows external resources to dispatch the autonomous chauffeur. This makes it straightforward to embed taxi ride requests into smartphone applications, radial action menus, interactive dispatch booths, or custom keybinds.
The Primary Client Export
Section titled “The Primary Client Export”The core function to dispatch an automated taxi is:
exports['MTM-TAXI']:StartTaxiJob()When triggered, the export performs all standard proximity checks, verifies road node access, spawns the vehicle and driver ped, and initiates the pickup sequence.
Smartphone App Integrations
Section titled “Smartphone App Integrations”Most FiveM servers utilize smartphone frameworks for player services. Below are ready-to-use snippets for common phone resources:
To register MTM-TAXI as a service or custom app button inside LB-Phone:
-- Inside your lb-phone custom app or services handler:RegisterNUICallback("requestAITaxi", function(data, cb) exports['MTM-TAXI']:StartTaxiJob() cb({ success = true, message = "Taxi has been dispatched." })end)Add a service contact or trigger in qs-smartphone:
-- Client-side event hook or app action:RegisterNetEvent("qs-smartphone:client:CallAITaxi", function() exports['MTM-TAXI']:StartTaxiJob()end)In your qb-phone services configuration or custom phone tab:
-- Client event triggered by the Services app:RegisterNetEvent("qb-phone:client:RequestAITaxi", function() exports['MTM-TAXI']:StartTaxiJob()end)In client-side service callbacks:
RegisterNetEvent("gksphone:client:callTaxiService", function() exports['MTM-TAXI']:StartTaxiJob()end)Radial & Context Action Menus
Section titled “Radial & Context Action Menus”You can easily integrate MTM-TAXI into player action wheels or radial menus:
Add a dedicated item to your ox_lib radial menu configuration:
lib.addRadialItem({ id = 'call_ai_taxi', icon = 'taxi', label = 'Call AI Taxi', onSelect = function() exports['MTM-TAXI']:StartTaxiJob() end})Add an entry into your qb-radialmenu/config.lua:
{ id = 'calltaxi', title = 'Call AI Taxi', icon = 'taxi', type = 'client', event = 'mtm-taxi:client:callFromRadial', shouldClose = true}Then add the matching event in any client script:
RegisterNetEvent('mtm-taxi:client:callFromRadial', function() exports['MTM-TAXI']:StartTaxiJob()end)Target & Interaction Booths
Section titled “Target & Interaction Booths”If your server features physical taxi stands or call boxes outside airports and train stations:
-- Example using ox_target on a taxi stand prop or payphone:exports.ox_target:addModel(`prop_taxi_sign`, { { name = 'call_stand_taxi', icon = 'fa-solid fa-taxi', label = 'Hail Taxi', distance = 2.5, onSelect = function() exports['MTM-TAXI']:StartTaxiJob() end }})Registering a Dedicated Keybind
Section titled “Registering a Dedicated Keybind”If you want players to have the option of binding a single key on their keyboard (e.g. K or F10) to call a taxi:
-- Add this snippet to any client-side script on your server:RegisterKeyMapping('calltaxi', 'Call Automated Taxi', 'keyboard', '')Players can then assign their preferred key under FiveM Settings -> Key Bindings -> FiveM.