# TAXI JOB

##

{% embed url="<https://youtu.be/AdBhmb5wKWM?si=bWNv_uOBwabh1ocF>" %}

## INSTALLATION GUIDE

Download from KEYMASTER and unzip the `forge-taxi.pack.zip`. Place the entire `forge-taxi` folder inside your server's resources directory.

**Do not rename this folder, otherwise the script may not work correctly.**

Add the resource to your server start config (`server.cfg`), making sure the dependencies are started in the correct order:

```
ensure ox_lib
ensure forge-taxi
```

⚠️ **Make sure all the dependencies (framework, inventory, target system, etc.) are started before this script in your `server.cfg`.**

***

### 1. Install the SQL

Import the SQL file provided in the `INSTALL/` folder into your database. This file includes essential tables for tracking player metrics, trip statistics, and other features.

The SQL file is located at: `INSTALL/taxi_metrics.sql`

If you're using `oxmysql`, ensure the wrapper is correctly installed and configured.

***

### 2. Framework Configuration

The script supports multiple frameworks. Configure your framework in `config/config.lua`:

**Supported Frameworks:**

* ESX
* QB-Core
* QBOX

Set the framework in the config:

```lua
Config.Framework = "ESX"  -- Options: "ESX", "QB", or "QBOX"
```

***

### 3. Inventory System Configuration

The script is compatible with multiple inventory systems. Configure your inventory in `config/config.lua`:

**Supported Inventories:**

* `ox_inventory`
* `qb-inventory`
* `qs-inventory`
* `tgiann-inventory`
* `core_inventory`
* `ps-inventory`
* `chezza-inventory`
* ESX native inventory
* QB native inventory

Set your inventory system:

```lua
Config.Inventory = "ox_inventory"  -- Change to match your inventory system
```

***

### 4. Target System Configuration

The script supports multiple target systems. Configure in `config/config.lua`:

**Supported Target Systems:**

* `ox_target`
* `qb-target`
* None (uses floating 3D text instead)

Set your target system:

```lua
Config.Target = "ox_target"  -- Options: "ox_target", "qb-target", or "" (empty for floating text)
```

***

### 5. Society Banking Integration

The script supports multiple society banking systems for company payments:

**Supported Banking Systems:**

* `neon-boss` (CodeForge) - Set `societyMethod = "FORGE"`
* `qb-banking` - Set `societyMethod = "QB"`
* `esx_addonaccount` - Set `societyMethod = "ESX"`

Configure in `config/config.lua` under `JobSettings.rewards`:

```lua
societyMethod = "ESX"  -- Options: "ESX", "QB", "FORGE"
```

If using `neon-boss`, ensure it's started before `forge-taxi` in your `server.cfg`.

***

### 6. Clear Cache

Always clear your server cache and your FiveM client cache after installation to avoid any loading issues.

***

### 7. Reboot

Reboot your server completely after ensuring the script is correctly started and all configurations are in place.

***

### CONFIG

The configuration is located in `config/config.lua`, and you should take some time to understand and adjust it properly to deliver the best experience to your players.

Here's what you can configure:

#### Core Settings

* **Config.Framework**: `"ESX"`, `"QB"`, or `"QBOX"`
* **Config.Inventory**: Your inventory system (`"ox_inventory"`, `"qb-inventory"`, etc.)
* **Config.Target**: Your target system (`"ox_target"`, `"qb-target"`, or `""`)
* **Config.Locale**: `"en"` or `"es"` (two-letter language code)
* **Config.Debug**: Set to `false` for production, `true` for development

#### Job Settings

* **Payment System**: Configure payment types (`"money"`, `"item"`, or `"mix"`)
* **Payment Distribution**: Set to `"player"`, `"split"` (50/50), or `"society"` (100% company)
* **Payment Rates**: Minimum, maximum, and per-kilometer payment rates
* **Item Rewards**: Configure item names, amounts, and probabilities for legal missions
* **Destination Locations**: Customize pickup and dropoff locations throughout the map

#### NPC Settings

* **NPC Behavior**: Configure conversation systems, speed warnings, damage reactions
* **Client Escape System**: Enable/disable client escape feature and configure bonuses
* **Tip System**: Configure tip multipliers based on conversation performance
* **Speed Monitoring**: Set speed thresholds and warning intervals

#### Illegal Missions

* **Mission Types**: Beat missions and drug deal missions
* **Probability Settings**: Configure chance of illegal mission offers and chases
* **Payment System**: Separate payment configuration for illegal missions
* **Chase System**: Configure chaser AI, weapons, escape distances, and duration

#### UI System

* **Taximeter**: Configure fare rates (day/night), update intervals, audio feedback
* **Trip Summary**: Display time and auto-close settings
* **Menu Access**: Configure vehicle entry system and menu keys

#### Company & Garage

* **Multiple Companies**: Configure multiple taxi companies with different vehicles
* **Garage System**: Set spawn points, vehicle models, and company blips
* **Society Integration**: Configure society accounts for each company

#### Performance Settings

* **Update Intervals**: Configure marker checks, damage checks, conversation checks
* **Batch Processing**: Enable/disable NPC update batching for better performance
* **Cleanup Intervals**: Configure cleanup routines for NPCs and vehicles

#### Localization

Add translations inside the `Config.Locales` table in `config/locales.lua`. The script includes English and Spanish translations by default. Set your default with `Config.Locale` in `config/config.lua`.

***

### FINAL NOTES

🔁 **Always ensure item names in your config match exactly the items defined in your inventory system. Typos will cause issues.**

🧠 **If you're using `ox_target` or `qb-target`, make sure their zones are correctly defined. You can also disable the target system and use floating 3D texts instead.**

🌍 **The script is fully localizable. Make your server more immersive by translating the experience into your community's language.**

🚗 **The script includes a sophisticated garage system with collision detection. Make sure spawn points are clear and accessible.**

💰 **Configure payment distribution carefully. The default is set to `"split"` (50% driver, 50% company) for balanced economy.**

⚡ **Performance settings are optimized by default. Only adjust if you experience performance issues with many active NPCs.**

If you need support or have any questions, join our Discord:

**<https://discord.gg/UTVssdrXRV>**

***

### CONFIGURATION DETAILS

The following will explain all the settings, one of the most important things that I recommend you spend a few minutes to understand in order to offer your users the best possible experience.

Fill all the CONFIG very carefully.

```lua
--[[
    Please do not modify the values unless you know what you are doing.
]]

-- General Settings
Config = {}

-- Core Settings
Config.Debug = false             -- Set to true only for testing. Keep false for better performance
Config.Language = "en"           -- Two-letter language code: "en" or "es"
Config.Command = "taxijob"       -- Command to start taxi job (optional, menu is available)

-- Framework Configuration
Config.Framework = "ESX"         -- Options: "ESX", "QB", or "QBOX"
Config.Inventory = "ox_inventory" -- Your inventory system
Config.Target = "ox_target"      -- Options: "ox_target", "qb-target", or "" (empty for floating text)

-- Payment System
Config.JobSettings = {
    rewards = {
        type = "money",           -- Options: "money", "item", "mix"
        currency = "money",       -- Options: "money", "cash", "bank"
        minimum = 25,             -- Minimum payment per job (base fare)
        maximum = 85,             -- Maximum payment per job (before distance calculation)
        perKilometer = 3.5,       -- Payment per kilometer traveled
        distribution = "split",   -- Options: "player", "split", "society"
        societyMethod = "ESX"     -- Options: "ESX", "QB", "FORGE"
    },
    
    -- Destination locations (pickup and dropoff points)
    destinations = {
        -- Add vector4 coordinates here
    },
    
    -- NPC settings
    npcSettings = {
        -- Conversation system, speed warnings, damage reactions, etc.
    }
}

-- Illegal Missions
Config.IllegalMissions = {
    enabled = true,
    probability = {
        illegalOfferChance = 20,  -- Percentage chance NPC offers illegal mission
        chaseChance = 30,         -- Percentage chance of getting chased
    },
    payment = {
        type = "mix",             -- Options: "money", "item", or "mix"
        money = {
            minimum = 200,
            maximum = 450,
            chaseBonus = 150
        }
    }
}

-- UI System
Config.TaxiUI = {
    enabled = true,
    taximeter = {
        rates = {
            baseRate = 3.50,      -- $/km daytime
            nightRate = 4.50,     -- $/km nighttime
            nightStartHour = 22,  -- Start of night tariff
            nightEndHour = 6      -- End of night tariff
        }
    }
}

-- Performance Settings
Config.Performance = {
    markerCheckInterval = 250,
    damageCheckInterval = 1000,
    conversationCheckInterval = 2000,
    speedCheckInterval = 2000,
    cleanupInterval = 300000,
    enableUpdateBatching = true,
    enableStaleNPCDetection = true
}
```

***

### USEFUL FUNCTIONS

The script exposes several utility functions in `client/utils.lua` and `server/utils.lua` that are un-obfuscated for customization:

#### Client Utilities (`client/utils.lua`)

* **TaxiUtils.Log**: Logging system with different log levels
* **TaxiUtils.SafeExecute**: Safe function execution with error handling
* **TaxiUtils.ShowMessage**: Display messages to players
* **TaxiUtils.ShowNotificationWithDuration**: Notifications with custom duration
* **TaxiUtils.GetText**: Retrieve translated text
* **TaxiUtils.CreateMapBlip**: Create map blips
* **TaxiUtils.SetGPSTarget**: Set GPS navigation targets
* **TaxiUtils.SetupTargetZone**: Create target zones
* **TaxiUtils.SpawnNPC**: Spawn NPCs with proper configuration
* **TaxiUtils.SpawnSyncedNPC**: Spawn synced NPCs for multiplayer
* **TaxiUtils.Pay**: Framework-agnostic payment function

#### Server Utilities (`server/utils.lua`)

* **Slug**: Convert strings to URL-friendly slugs
* **AddSocietyMoney**: Add money to society accounts (multi-framework)
* **DistributeMissionPayment**: Distribute payments between player and company

All utility functions include detailed comments explaining their purpose, parameters, return values, and usage examples.

***

### TROUBLESHOOTING

#### NPCs not spawning

* Check that your framework is correctly configured
* Ensure `ox_lib` is started before `forge-taxi`
* Verify destination coordinates are valid and accessible

#### Payments not working

* Verify inventory system configuration matches your actual inventory
* Check that item names in config match your inventory items exactly
* Ensure society banking method matches your installed system

#### Target system not working

* Verify target system is correctly configured (`ox_target` or `qb-target`)
* Ensure target system is started before `forge-taxi`
* Check console for any error messages

#### Vehicles spawning incorrectly

* Check spawn point coordinates in garage configuration
* Ensure spawn points are clear and accessible
* Verify vehicle model hashes are correct

#### Performance issues

* Adjust performance settings in `Config.Performance`
* Reduce NPC pooling if experiencing lag
* Check server resources and FiveM server performance

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codeforge.gitbook.io/codeforge/jobs/taxi-job.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
