CodeWorks
YoutubeDiscordTebex
  • Welcome!
  • Main
    • How can i download my script
    • How can i transfer my script
    • Whats escrow system?
  • Errors
    • You lack the required entitlement to use cdw-*
  • Scripts
    • Boss Menu
      • Installation
      • Configuration
      • Language Files
      • Events / Export List
      • Editable Files
        • sv_utils.lua
        • cl_utils.lua
        • cl_mugshot.lua
    • Hud System
      • Installation
      • Configuration
      • Language Files
      • Events / Export List
      • Editable Files
        • sv_utils.lua
        • cl_utils.lua
      • Integrations
        • QB Core
          • Notification
          • Progressbar
        • ESX
          • Notification
          • Progressbar
        • ox_lib
          • Notification
          • Progressbar
  • GPS & Bodycam
    • GPS System
      • Installation
      • Configuration
      • Language Files
      • Editable Files
        • sv_utils.lua
        • cl_utils.lua
    • Bodycam System
      • Installation
      • Configuration
      • Language Files
      • Editable Files
        • sv_utils.lua
        • cl_utils.lua
Powered by GitBook
On this page
  • /hud
  • Hide / Show the HUD UI
  • Notify
  • Example Usage
  • Progressbar
  • Usage
  • Is Progressbar Active
  • Cancel Progress
  • Seatbelt
  1. Scripts
  2. Hud System

Events / Export List

Last updated 4 months ago

All of these events and exports are client-sided

/hud

Opens the HUD customisation menu.

Hide / Show the HUD UI

Show or hide the HUD itself, based on the isOpenvariable.

TriggerEvent("cdw-hud:setHudOpen", isOpen)

Notify

exports["cdw-hud"]:notify(text, texttype, length)
Parameter
Type
Description

text

String

The notification text to display

texttype

String

"primary" | "warning" | "success" | "error"

length

Integer

Time the notificaiton will show on screen in miliseconds

Example Usage

exports["cdw-hud"]:notify("Success Notification", "success", 2500)
exports["cdw-hud"]:notify("Warning Notification", "warning", 2500)
exports["cdw-hud"]:notify("Normal Notification", "primary", 2500)
exports["cdw-hud"]:notify("Error Notification", "error", 2500)

Progressbar

Usage

You can use it with either a callback (cb) or by returning the result.

local actions = {
    name = "p_1", -- Unique name for the action
    duration = 2500, -- Duration of the action in milliseconds
    label = "Eating...", -- Text displayed on the progress bar
    icon = "burger" -- Icon that will show up on the progress bar, use Free FontAwesome Icons
    useWhileDead = useWhileDead, -- Can the action be used while dead? (Boolean or null)
    canCancel = canCancel, -- Can the action be canceled? (Boolean or null)
    controlDisables = { -- Table specifying control restrictions
        car = false, -- Block vehicle-related actions? (Boolean or null)
        move = false, -- Prevent character movement? (Boolean or null)
        combat = true, -- Prevent combat actions like punching, aiming, shooting? (Boolean or null)
        mouse = false, -- Prevent mouse movement and camera rotation? (Boolean or null)
        disableRun = true, -- Restrict the player to walking only? (Boolean or null)
    },
    animation = { -- Table for specifying the animation details
        animDict = "veh@van@ds@base", -- Animation dictionary name (String or null)
        anim = "hotwire", -- Animation name (String or null)
        flags = "16", -- Animation flag (String or null)
    },
    prop = { -- Table for attaching the first prop to an entity
        model = "tablet_01", -- Model or hash for the prop (String or number, or null)
        bone = 2108, -- Bone ID where the prop will be attached (Integer or null)
        coords = { x = 0.0, y = 0.0, z = 0.0 }, -- Axis offset for the prop's position (Table or null)
        rotation = { x = 0.0, y = 0.0, z = 0.0 }, -- Rotation of the prop (Table or null)
    },
    propTwo = { -- Table for attaching a second prop to an entity (same structure as prop)
        model = "tablet_01", -- Model or hash for the prop (String or number, or null)
        bone = 2108, -- Bone ID (Integer or null)
        coords = { x = 0.0, y = 0.0, z = 0.0 }, -- Axis offset for position (Table or null)
        rotation = { x = 0.0, y = 0.0, z = 0.0 }, -- Rotation of the prop (Table or null)
    }
}

-- Progress Bar Call: Starts the progress action and handles cancellation
exports["cdw-hud"]:Progress(actions, function(canceled)
    -- Coroutine for handling the progress bar result
end)

-- Return Progress Method: Returns a boolean indicating success or failure
local success = exports["cdw-hud"]:Progress(actions)// Some code

Is Progressbar Active

Returns whether there is an active progressbar.

exports["cdw-hud"]:isActive()

Cancel Progress

Cancels the current progressbar if active.

exports["cdw-hud"]:cancelProgress()

Seatbelt

Returns whether the player is wearing their seatbelt. This only works with the built-in belt system.

exports["cdw-hud"]:Seatbelt()
Page cover image