dotCustomization

Custom Server/Client Requirements

Server side

This section allows you to insert custom logic that runs before a player is allowed to start a job.

  • Optional: You do not need to edit this unless you have specific requirements (e.g., specific licenses, job cooldowns, or police checks).

  • The Logic: This function acts as a "Gatekeeper." If it returns true, the job starts. If it returns false, the job is blocked.

⚠️ IMPORTANT

Even if you do not want to use any checks, the function must always return true at the end. If you delete the return line or set it to false, no one will be able to start deliveries.

Example Code: License Check

The default code below checks if the player has a drive_truck license (using esx_license). If they don't, it sends a notification and blocks the job.

function additionalRequirementsServer(src)
    if src then
        local toReturn = true 
        
        -- Example: Check for Driver License
        TriggerEvent('esx_license:checkLicense', src, 'drive_truck', function(hasLicense)
            if hasLicense then
                toReturn = true
            else
                toReturn = false -- Block the job
            end
        end)

        -- Notification if blocked
        if not toReturn then
            TriggerClientEvent('g-hud:sendNotification', src, 'You do not have a Class C License!', 5000, 'error', 'fa-solid fa-id-card')
        end

        return toReturn -- MUST RETURN TRUE TO ALLOW JOB
    end
    return true -- Fallback safety
end

Client

Financial Transaction Handlers

These functions handle the actual transfer of money (Cash or Bank) to and from the player.

Cash Payouts (GiveCashPayout)

Triggered when the player finishes a job and Config.UseBank = false.

Bank Payouts (GiveBankPayout)

Triggered when the player finishes a job and Config.UseBank = true.

Bank Deductions (RemoveBankMoney)

Triggered when the player pays a deposit or a penalty.

Custom target menu

These functions allow you to hook into your server's interaction system. This is useful if you have a custom interaction script that isn't ox_target or qb-target

Add Custom Interaction (AddCustomInteraction)

Configuration Parameters

  • data.type: type of interaction either client or server

  • data.label: label of the interaction

  • data.icon: icon of the interaction

  • data.entity: entity that is being used in this interaction

  • data.netID: netID of the entity

  • data.event: event of the current interaction

  • data.id: unique name id of the current interaction

  • data.distance: distance that is recommended for interaction, value from Config.InteractionSettings.distance

Marker Interaction (AddCustomMarkerInteraction)

Used when Config.MarkerType = 'custom'.

  • Important: If using a custom marker system, you must trigger the event manually.

Configuration Parameters

  • data.name: name of the interaction

  • data.coords: coords of the interaction

  • data.label: label of the interaction

  • data.event: event of the interaction

  • data.truckBaseID: trucker base that might be used in the interaction

⚠️ IMPORTANT

When triggering your custom event to open the menu, you MUST pass the truckBaseID so the script knows which job location to show.

  • Option A (Trigger Event): If triggering an event, the first argument must be data.truckBaseID.

  • Option B (Direct Function):You can directly call the internal function showUI(data.truckBaseID).

Remove Custom Interaction (RemoveCustomInteraction)

Configuration Parameters

  • data.entity: entity that is being used in this interaction

  • data.label: label of the interaction

  • data.id: unique name id of the current interaction

Tutorial Integration (ShouldShowTutorial)

Allows you to integrate the script's tutorial with external menu settings. This is useful if you have a "Settings" menu where players can toggle help messages on/off.

  • Default: Always returns true (Tutorial is always enabled).

  • Custom: You can check a client-side KVp (Key-Value pair) or an export from your menu script.

Block/Unblock Target (BlockTargetInteraction)

Temporarily disables the targeting system.

  • Usage: Used primarily during Developer Mode (Tool placement) so that when you try to click a tool button, you don't accidentally click the entity behind it.

Last updated