Commands & Events
Let players call a taxi — or trigger the same flow from your own scripts.
Commands
Configured under Commands in config.json.
| Option | Default | Description |
|---|---|---|
Commands.Enable | true | Allow chat commands |
Commands.CallTaxi | "calltaxi" | Command to call a taxi |
Commands.CancelTaxi | "canceltaxi" | Command to cancel |
Example:
/calltaxi
/canceltaxiEvents
Configured under Events in config.json. Useful when another resource should start or stop a ride.
| Option | Default | Description |
|---|---|---|
Events.Enable | true | Allow 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:
| Field | Description |
|---|---|
Enable | Turn the hook on or off |
EventName | Event name to emit |
Environment | "client", "server", or "both" |
| Hook | Default event | Arguments | When |
|---|---|---|---|
OnTaxiSpawn | OnTaxiSpawn | taxiEntityId, taxiNetId | Taxi vehicle spawned |
OnDriverSpawn | OnDriverSpawn | driverPedId, driverNetId | Driver ped spawned |
OnCleanup | OnTaxiCleanup | — | Ride cleaned up |
OnFareCollected | OnFareCollected | fareAmount | Fare paid successfully |
OnNotPaying | OnNotPaying | — | Player could not pay (exit collection) |
OnDestinationReached | OnDestinationReached | — | Taxi 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)