Commands & Events

Let players call a taxi — or trigger the same flow from your own scripts.

Commands

Configured under Commands in config.json.

OptionDefaultDescription
Commands.EnabletrueAllow chat commands
Commands.CallTaxi"calltaxi"Command to call a taxi
Commands.CancelTaxi"canceltaxi"Command to cancel

Example:

/calltaxi
/canceltaxi

Events

Configured under Events in config.json. Useful when another resource should start or stop a ride.

OptionDefaultDescription
Events.EnabletrueAllow programmatic events
Events.CallTaxi"calltaxi"Call a taxi for a player
Events.CancelTaxi"canceltaxi"Cancel the active taxi

These are server → client network events. Trigger them from a server script for a specific player. Rename the strings in config if they collide with other resources.

Call a taxi

-- Server
TriggerClientEvent('calltaxi', source)

Cancel a taxi

-- Server
TriggerClientEvent('canceltaxi', source)

Integration hooks

Optional lifecycle hooks under Integrations in config.json. All are disabled by default — enable the ones you need, then listen for their event names.

Each hook supports:

FieldDescription
EnableTurn the hook on or off
EventNameEvent name to emit
Environment"client", "server", or "both"
HookDefault eventArgumentsWhen
OnTaxiSpawnOnTaxiSpawntaxiEntityId, taxiNetIdTaxi vehicle spawned
OnDriverSpawnOnDriverSpawndriverPedId, driverNetIdDriver ped spawned
OnCleanupOnTaxiCleanupRide cleaned up
OnFareCollectedOnFareCollectedfareAmountFare paid successfully
OnNotPayingOnNotPayingPlayer could not pay (exit collection)
OnDestinationReachedOnDestinationReachedTaxi reached the destination

With Environment set to "client" or "both", the event is emitted locally on the client. With "server" or "both", it is also sent to the server as a net event (source = the player on the ride).

Enable a hook

"OnFareCollected": {
  "Enable": true,
  "EventName": "OnFareCollected",
  "Environment": "both"
}

Listen on the client

Example for OnTaxiSpawn (client / both):

-- Client
AddEventHandler('OnTaxiSpawn', function(taxiEntityId, taxiNetId)
  print(('Taxi spawned: entity %s, netId %s'):format(taxiEntityId, taxiNetId))
end)

Listen on the server

Example for OnFareCollected (server / both):

-- Server
RegisterNetEvent('OnFareCollected', function(fareAmount)
  local src = source
  print(('Player %s paid fare: %s'):format(src, fareAmount))
end)

Destination reached

-- Client
AddEventHandler('OnDestinationReached', function()
  -- e.g. award a job bonus, play a sound, log the trip
end)

-- Server (when Environment is server or both)
RegisterNetEvent('OnDestinationReached', function()
  local src = source
  -- e.g. update a trip log for this player
end)