L2S Documentation
DiscordTebex
  • Documentation
  • Information
    • Discord Roles
    • How to update your asset
    • FiveM Asset Escrow System
  • Coding Information
    • Webhook System
    • Register Key Mapping
    • Translation System
  • ASSETS & GUIDES
    • 🚨Dispatch
      • ⤵️Installation
      • ⚙️Configuration
        • Settings
        • API
        • Hub
        • CCTV
        • Dispatch
        • UI
      • 💻Integration
        • Exports
          • Client
          • Server
        • Police Alerts
        • Radio Channel
        • Duty System
    • 🏨Hotels V2
      • ⤵️Installation
      • ⚙️Configuration
        • Config
        • Elevators
        • Hotels
      • 💻Exports
    • 👮Police Hub
      • ⤵️Installation
      • ⚙️Configuration
      • 💻Events & Alerts
    • 💀Gangs Turf
      • ⤵️Installation
      • ⚙️Configuration
        • Settings
        • Gangs
      • 💻Exports
      • 📚Tutorial
    • 🔫Paint Ball
      • ⤵️Installation
      • ⚙️Configuration
        • Settings
        • Clothes
        • Locations
      • 💻Exports
Powered by GitBook
On this page
  1. ASSETS & GUIDES
  2. Dispatch
  3. Integration

Duty System

In QBCore, the duty system is built into the framework by default. To ensure that players with specific jobs are required to be on duty before using dispatch, you can use the following functions:

Update Duty Status to unit
TriggerServerEvent("l2s-dispatch:server:SetDutyStatus", BOOL)

QBCore Version comes fully equipped with a default duty system.

Update server/v_editable.lua Code for Custom Duty System:

function ToggleDuty(src, boolean) -- To Link your duty system with dispatch script
    -- local Player = QBCore.Functions.GetPlayer(src)  -- Get the player object by their source ID
    -- Player.Functions.SetJobDuty(boolean)  -- Set the player's job duty status based on the boolean (true/false)
    TriggerClientEvent(Shared.Settings.SetDuty, src, boolean)  -- Notify the client with the updated duty status
end

function GetDuty(src) -- To get initial value for duty status
    -- local Player = QBCore.Functions.GetPlayer(src)  -- Retrieve the player object
    --return Player.PlayerData.job.onduty or true  -- Return the duty status of the player, defaults to true if not set
    return true

end

PreviousRadio ChannelNextHotels V2

Last updated 5 months ago

🚨
💻