⚙️Configuration

Shared

🧑 Ped

  • ped: table

    • model: string

    • coords: vector4

    • scenario: string - List of scenarios: (Link)

This changes the model, coordinates and scenario (animation) of the GoPostal mission ped.

🅿 Parking

  • parking: table

    • vector4

List of coordinates where job vehicles will spawn. Each vehicle needs the coordinates (and the area around them) to be clear of peds and vehicles in order to spawn the vehicle. If no spots are found, the mission will not start. This is to prevent random peds and vehicles from being deleted unintentionally.

📦 deletePackage

  • deletePackage: number

Amount of time (in ms) after which the dropped off package prop will be deleted. All drop-off props are created client-side and are not networked to avoid pileups in servers with large playerbases.

Client

💭 Notify

Notification API that allows you to use whatever notification system your server is using. Change the body of the function to match your notification exports and you're good to go. This is set to use ox_lib notifications by default.

⛽ setVehicleFuel

Sets vehicle fuel. If you use a resource like ps-fuel or CDN-fuel, you should replace the body of this function with whatever exports those scripts use.

---@param vehicle number
---@param amount number
setVehicleFuel = function(vehicle, amount)
    SetVehicleFuelLevel(vehicle, amount)
end

🔑 setVehicleKeys

Gives the player keys to the delivery vehicle. If you are using a script that changes this functionality, you should replace the body of this function accordingly.

---@param vehicle number Entity handle
---@param plate string Vehicle plate
setVehicleKeys = function(vehicle, plate)
    TriggerEvent("vehiclekeys:client:SetOwner", plate)
end

🟡 setBlipProperties

Sets delivery point blip properties. Feel free to change it to your liking.

---@param blip number
setBlipProperties = function(blip)
    SetBlipSprite(blip, 478)
    SetBlipScale(blip, 0.7)
    SetBlipColour(blip, 5)
    SetBlipAsShortRange(blip, true)
    BeginTextCommandSetBlipName("STRING")
    AddTextComponentSubstringPlayerName("Delivery")
    EndTextCommandSetBlipName(blip)
end

🔵 setMainBlipProperties

Sets the mission ped blip. This is the main map blip that will guide the player to the job start/end area.

---@param blip number
setMainBlipProperties = function(blip)
    SetBlipSprite(blip, 738)
    SetBlipScale(blip, 0.7)
    SetBlipAsShortRange(blip, true)
    SetBlipColour(blip, 26)
    BeginTextCommandSetBlipName("STRING")
    AddTextComponentSubstringPlayerName("GoPostal")
    EndTextCommandSetBlipName(blip)
end

⭕ Marker

This is the circle that appears on the ground and allows the player to drop off a package. If you would like to disable it for whatever reason (not recommended), set the diameter to 0.0 and rgba to 0.

marker = {
    diameter = 1.5, -- 1.5 is roughly the width of a door
    r = 255,        -- 0-255 (red)
    g = 0,          -- 0-255 (green)
    b = 130,        -- 0-255 (blue)
    a = 100,        -- 0-255 (alpha) Higher value = more visible
}

💬 Prompt options

This is the lib.showTextUI prompt that shows whenever a player enters a delivery marker. Further documentation available here: https://overextended.dev/ox_lib/Modules/Interface/Client/textui

---@type TextUIOptions
promptOptions = {
    position = 'left-center',
    icon = 'box',
    style = {
        backgroundColor = '#48BB78',
        color = 'white'
    },
},

Server

💭 Notify

Notification API that allows you to use whatever notification system your server is using. Change the body of the function to math your notification exports and you're good to go. This is set to use ox_lib notifications by default.

⭐ Experience module

The experience module allows for players to gain experience for each delivery. As they progress through the levels, their experience multiplier will rise, resulting in higher rewards per delivery and bonus rewards.

This module is disabled by default. If you would like to utilize the full functionality of the script, it is recommended that you enable it. To enable the module, please follow the instructions in the "Installation" section from step 2.

The reward multiplier formula is very simple:

-- Reward per delivery:
Rewards[areaName]() * levels[i].mult

-- Bonus reward:
BonusRewards[areaName]() * levels[i].mult

If you decide to not use reward multipliers but want to keep the flair of level labels, set all multipliers to 1.0.

WARNING: At least one level which has a base requirement of 0 xp must exist. If this requirement is not met, the experience menu will most likely fail to function correctly.

You may modify, add or remove levels as long as you follow the data structure correctly.

levels = {
    { label = 'Default level', mult = 1.0, reqXp = 0 },
    { label = 'Example', mult = 2.75, reqXp = 1500 }
}

There is also the xpGain() function. You can write whatever you want in the body of the function, as long as it returns an integer. Decimal values are not allowed. Example:

xpGain = function()
    -- You can write whatever silly logic you want here, this is just an example
    -- A really silly equivalent of math.random(6,10):
    local silly = math.log(math.ceil(math.random(1, 10000) * math.pi))

    -- As long as this returns an integer, everything will be fine
    return math.floor(silly)
end

The default database integer limit (for the myGoPostal_progression table) is int(11) unsigned, which means that the maximum amount of xp a single person can have is .

I highly doubt that anyone will ever surpass this number, as long as you use reasonable values in the config. But who am I to tell you what to do, right? Feel free to use bigint unsigned if you feel like it.

🔽🔼 Minimum & maximum deliveries

These two set the range for a random number generator that decides how many deliveries a player will have to complete to finish a mission. Shrimple as. 🦐

💰 Rewards & bonus rewards

The Rewards and BonusRewards tables not only look identical, they also work in the same exact way (wow! 🤯).

  • Rewards / BonusRewards: table

    • enabled: boolean - If set to false, that type of reward will no longer work.

    • accountType: string - Account type that money will be added to. Usually 'cash' or 'bank'.

    • [string]: function - The string must be unique and match Area.name (explained further in the Areas section). Must return an integer.

server/rewards.lua is a module that you can modify to fit your server's banking and payment logic. Both payment() and bonusPayment() pass source and amount arguments, which should be enough to generate sufficient data for most banking / payment resources.

function payment(source --[[number]], amount --[[number]])
    local Player = QBCore.Functions.GetPlayer(source)
    Player.Functions.AddMoney(SV_Config.Rewards.accountType, amount)
end
function bonusPayment(source --[[number]], amount --[[number]])
    local Player = QBCore.Functions.GetPlayer(source)
    Player.Functions.AddMoney(SV_Config.BonusRewards.accountType, amount)
end

💼 Job checks

You may use the job check feature to only allow certain jobs to start deliveries. To do so, set CheckJob to true in server/config.lua, and list allowed jobs in the AllowedJobs table:

AllowedJobs = {
    delivery = true,
    trucker = true,
    gopostal = true
}

Each key should be a valid QBCore job name. "Under the hood" the script checks the players PlayerData.job.name and tries to match it to a valid key-value pair in AllowedJobs, as long as CheckJob is set to true. Using a format like ['trucker'] also works for defining keys.

This is a whitelist, therefore you only need to define which jobs are allowed to start deliveries. Any job that is not on this list will not be allowed to start deliveries, as long as CheckJob is set to true.

🚚 Vehicles

All entries in the vehicles table must be a table of their own, and must contain a model property. extras, colorPrimary, colorSecondary and livery are all optional. Here's the GPVehicle class structure:

🌍 Areas

You are able to designate your own delivery areas by following the Areas table data structure. Each entry is a table (order of appearance will match in-game menu order of appearance). The coords property must be a table containing vector4 entries. If the total number of entries is smaller than SV_Config.MinDeliveries, the script may not work properly (a fail-safe should stop this from breaking the script, but it's not guaranteed).

  • Area: table

    • name: string

      • Must be a unique string. Must have a matching Rewards or BonusRewards key to receive rewards for delivery or on mission end.

    • menu: table - Matches ox_lib's lib.registerContext properties (title, description, icon)

      • title: string

      • description?: string

      • icon?: string

    • coords: table - Each entry in the table should be a vector4

⛔ The "don't touch" zone

  • Debug - self explanatory. This should be set to false unless you want your console to be a mess.

  • GenerateDeliveriesLoopLimit - a fail-safe mechanism so that your server doesn't hang up on an infinite loop in case the location randomizer fails to complete its tasks for whatever reason. The default of 1000 tries should be sufficient, unless your area coords table is extraordinarily big, or you are extremely unlucky.

Last updated