Common Questions

m-TruckerSimulator - FAQ & Common Questions

Frequently Asked Questions and solutions to common issues.


Installation & Setup

How do I install the script?

  1. Extract the m-TruckerSimulator folder to your server's resources folder

  2. Add ensure m-TruckerSimulator to your server.cfg

  3. Configure config.lua with your preferred settings

  4. Restart your server

  5. The SQL tables will be created automatically on first start (if Config.InstallDatabase = true)


The script won't start, what should I check?

  • Ensure you have ox_lib and oxmysql installed and started before m-TruckerSimulator

  • Check your server.cfg order:

    ensure ox_lib
    ensure oxmysql
    ensure m-TruckerSimulator
  • Verify your database connection in your main server config

  • Check server console for error messages


How do I configure for my framework?

The script auto-detects ESX and QBCore by default. To manually set:

Config.Framework = 'qbcore'  -- or 'esx'
Config.Inventory = 'ox_inventory'  -- or 'qb_inventory'
Config.Target = 'ox_target'  -- or 'qb_target'

Leave empty ('') for automatic detection.


Bridge System & Compatibility

My server uses custom vehicle keys, how do I add support?

  1. Set Config.VehicleKeys = 'custom' in config.lua

  2. Edit bridge/client/vehiclekeys/custom.lua

  3. Replace the GiveKeys function with your system's code

Example:

function VehicleKeys.GiveKeys(plate)
    exports['my-vehiclekeys']:giveKeys(plate)
end

My fuel system isn't detected

  1. Check if your fuel system is in the auto-detect list: LegacyFuel, ox_fuel, ps-fuel, cdn-fuel

  2. If not, set Config.Fuel = 'custom' and edit bridge/client/fuel/custom.lua

  3. Update the SetFuel function:

function Fuel.SetFuel(vehicle, fuel)
    exports['my-fuel']:setFuel(vehicle, fuel)
end

Can I use a custom target system?

Yes! Set Config.Target = 'custom' and edit bridge/client/target/custom.lua with your target system's exports.


Can I use a custom inventory?

Yes! Set Config.Inventory = 'custom' and edit bridge/server/inventory/custom.lua with your inventory's functions.


Gameplay Issues

Players can't see the trucker depot blip

Check that the blip is enabled in config.lua:

Config.NPCLocation.blip.enabled = true

Also verify the coordinates are correct for your map.


Jobs aren't paying correctly

  1. Check Config.Payment settings in config.lua

  2. Verify your framework's money functions are working

  3. Check if any other scripts are interfering with money transactions

  4. Enable Config.Debug = true to see payment calculations in console


Vehicle spawns underground or in wrong location

Update the spawn coordinates in config.lua:

Config.GarageSystem = {
    spawnLocation = vector4(x, y, z, h),
}

Use /coords or a similar command to get precise coordinates.


Hired drivers aren't generating income

  1. Check that drivers are status "working" in database

  2. Verify Config.Drivers.jobIntervalis set correctly

  3. Check server console for any SQL errors

  4. Ensure the driver has a valid assigned vehicle


Features & Customization

How do I change job payment amounts?

Edit config.lua:

Config.JobSettings = {
    baseReward = 1000, -- Base reward per job
    distanceMultiplier = 500, -- $ per km of distance
    depositPercentage = 0.1, -- 10% of the reward as a deposit Percentage
    xpPerKm = 10, -- XP gained per km traveled
}

How do I add new cargo types?

Edit the cargo table in config.lua:

Config.CargoTypes = {
    {
        name = 'Standard Cargo',
        trailer = 'trailers',
        icon = 'fa-box',
        skillRequired = nil,
        levelRequired = nil,
        rewardMultiplier = 1.0,
        weight = 30 -- Probability of appearance
    },
}

How do I add new achievements?

Add to Config.Achievements in config.lua:

{
        id = 'first_delivery',
        name = 'First Delivery',
        description = 'Complete your first delivery',
        icon = 'fa-truck',
        category = 'Beginner',
        requirement = 1,
        type = 'jobs_completed',
        reward = {money = 5000, xp = 100}
}

How do I change vehicle prices?

Edit Config.Vehicles in config.lua:

Config.Vehicles = {
   {
        name = 'Hauler',
        model = 'hauler',
        category = 'Semi-Truck',
        price = 25000,
        levelRequired = 0,
        description = 'Professional semi-truck for long-distance freight.',
        specs = {
            capacity = '2500kg',
            speed = 'Medium',
            handling = 'Poor'
        },
        image = 'https://docs.fivem.net/vehicles/hauler.webp'
    },
}

Party System

Party invites aren't working

  1. Check that both players are online

  2. Verify the target player isn't already in a party

  3. Ensure Config.Party.enabled = true in config.lua

  4. Check for any client-side console errors


Party members not receiving shared XP

Verify Config.Party.sharedXP = true and check the share percentage:

Config.Party = {
    sharedXP = true,
    bonusPerMember = 0.5  -- Reward bonus for each additional party member (percentage)
}

Exports & Integration

How do I give a player XP from another script?

exports['m-TruckerSimulator']:AddPlayerXP(source, nil, 500)

How do I check if a player is on a job?

local hasJob = exports['m-TruckerSimulator']:HasActiveJob(source)
if hasJob then
    print("Player is busy")
end

How do I get a player's level?

local data = exports['m-TruckerSimulator']:GetPlayerTruckerData(source)
if data then
    print("Player level: " .. data.level)
end

Localization

How do I add a new language?

  1. Create a new file in locales/ (e.g., de.lua)

  2. Copy the structure from locales/en.lua

  3. Translate all strings

  4. Set Config.Locale = 'de' in config.lua


Error Messages

[m-Trucker] No framework detected!

  • Install ESX or QBCore

  • Ensure it's started before m-TruckerSimulator

  • Check that the framework resource name matches (qb-core, qbx_core, or es_extended)


[m-Trucker] No target system detected!

  • Install ox_target or qb-target

  • Ensure it's started before m-TruckerSimulator

  • Or set Config.UseTarget = false to use DrawText instead


[m-Trucker] No inventory system detected!

  • Install ox_inventory or qb-inventory

  • Ensure it's started before m-TruckerSimulator

  • Check that the inventory resource name is correct


attempt to index a nil value (global 'VehicleKeys')

The vehicle keys bridge failed to load:

  1. Install a supported vehicle keys system

  2. Or set Config.VehicleKeys = 'none' if you don't use vehicle keys

  3. Check that the vehicle keys resource is started


SQL errors on startup

  1. Ensure oxmysql is installed and started

  2. Check your database credentials

  3. Set Config.InstallDatabase = true for first-time setup

  4. Manually import trucker.sql if auto-install fails


Last updated