Customs functions

CheckOnlineCops (shared/utils.lua)

This function returns the number of police officers (depending on the list of police jobs) on duty. Customize it if your server in another way.

function CheckOnlineCops()
    local copsOnline = 0
    for key, job in pairs(Config.utility.policeJobs) do
        if GlobalState[job] then
            copsOnline += GlobalState[job]
        end
    end
    return copsOnline
end

Dispatch (client/dispatch.lua)

Replaced the export with either the event or the export of your dispatch script

function CustomDispatch(coords)
    exports["ps-dispatch-esx"]:DrugSale(coords)
end

Inventory (server/framework/framework.lua)

triangle-exclamation

By default the script uses ox_inventory, it's up to you to adapt the script according to yours but while keeping the parameters intact.

PlayerHasDrugs

Here we check in the player's inventory if he has any drugs (depends on the list in "Config.Drugs.list") and return the total number of items and the items with their metadata

RemoveDrugsItem

Simply remove the drug that has just been sold from the player's inventory.

AddRewardPlayer

Give the reward to the player

SendNotification

By default we use ox_lib to make notifications, it's up to you to change for your own notifications

Last updated