Exports and Events

Client

Toggle Hud

-- to hide hud
exports['envi-hud']:ToggleHUD(false)

-- to show hud
exports['envi-hud']:ToggleHUD(true)

Stress

-- to add 10 stress
exports['envi-hud']:AddStress(10)

-- to remove 10 stress
exports['envi-hud']:RemoveStress(10)

Seatbelt (for use with third party seatbelt systems)

-- toggle on
exports['envi-hud']:ToggleSeatbeltUI(true)

-- toggle off
exports['envi-hud']:ToggleSeatbeltUI(false)

Notifications

-- SUCCESS
exports['envi-hud']:Notify({
    type = 'success',
    message = 'This is a test notification for successful actions',
    title = 'Success Notify',
    duration = 5000
})
-- ERROR
exports['envi-hud']:Notify({
    type = 'error',
    message = 'This is a test notification for error actions',
    title = 'Error Notify',
    duration = 5000
})
-- WARNING
exports['envi-hud']:Notify({
    type = 'warning',
    message = 'This is a test notification for warning actions',
    title = 'Warning Notify',
    duration = 5000
})
-- INFO
exports['envi-hud']:Notify({
    type = 'info',
    message = 'This is a test notification for info actions',
    title = 'Info Notify',
    duration = 5000
})

Progress Bar

-- Some Example usages

local data = {                  -- table of data
    label = "Animated Progress...",
    duration = 5000,
    canCancel = true,
    animation = {
        animDict = "random@shop_gunstore",
        anim = "_greeting",
        flags = 49
    },
    prop = {
        model = 'prop_notepad_01',
        bone = 18905,
        coords = vec3(0.1, 0.02, 0.05),
        rotation = vec3(10.0, 0.0, 0.0)
    },
    propTwo = {
        model = 'prop_pencil_01',
        bone = 58866,
        coords = vec3(0.11, -0.02, 0.001),
        rotation = vec3(-120.0, 0.0, 0.0)
    },
    controlDisables = {
        disableMovement = true,
        disableCarMovement = true,
        disableMouse = false,
        disableCombat = true
    },
    onComplete = function()
        print('Animated progress completed')
    end,
    onCancel = function()
        print('Animated progress cancelled')
    end
}

exports['envi-hud']:ProgressBar(data)

Harness

-- to install harness level 1 on vehicle with install animations and item checking
exports['envi-hud']:InstallHarness(vehicle, 1)
-- to remove harness on vehicle with remove animations and item checking
exports['envi-hud']:RemoveHarness(vehicle)
-- to install harness level 1 on vehicle with NO animations and NO item checking (0 for no harness)
exports['envi-hud']:ApplyHarnessLevel(vehicle, 1)
-- Returns the harness level of the specified vehicle
-- - Parameter: `vehicle` - The vehicle entity to check
-- - Returns: `number` - The harness level (0 if no harness)

exports['envi-hud']:GetHarnessLevel(vehicle)
-- Returns whether the seatbelt or harness is currently enabled
-- - Returns: `boolean` - True if seatbelt/harness is enabled, false otherwise
exports['envi-hud']:GetSeatbeltStatus()
-- Sets the seatbelt state
-- - Parameter: `enabled` - Boolean indicating whether to enable (true) or disable (false) the seatbelt
exports['envi-hud']:SetSeatbelt(enabled)

Cinematic Mode

-- Turn cinematic mode on
exports['envi-hud']:ToggleCinematicMode(true)
-- Turn cinematic mode off
exports['envi-hud']:ToggleCinematicMode(false)
-- If cinematic mode is enabled, this will disable it
-- If cinematic mode is disabled, this will enable it
exports['envi-hud']:ToggleCinematicMode()
-- Returns true if cinematic mode is enabled, false otherwise
exports['envi-hud']:IsInCinematicMode()


Server

Combat Control

-- Check if server-wide melee combat is disabled
local isDisabled = exports['envi-hud']:IsServerMeleeDisabled()

-- Set server-wide melee combat state
exports['envi-hud']:SetServerMeleeDisabled(true) -- disable
exports['envi-hud']:SetServerMeleeDisabled(false) -- enable

-- Toggle server-wide melee combat state
exports['envi-hud']:ToggleServerMelee()

Notifications

-- SUCCESS
TriggerClientEvent('envi-hud:notify', source, {
    type = 'success',
    message = 'This is a test notification for successful actions',
    title = 'Success Notify',
    duration = 5000
})
-- ERROR
TriggerClientEvent('envi-hud:notify', source, {
    type = 'error',
    message = 'This is a test notification for error actions',
    title = 'Error Notify',
    duration = 5000
})
-- WARNING
TriggerClientEvent('envi-hud:notify', source, {
    type = 'warning',
    message = 'This is a test notification for warning actions',
    title = 'Warning Notify',
    duration = 5000
})
-- INFO
TriggerClientEvent('envi-hud:notify', source, {
    type = 'info',
    message = 'This is a test notification for info actions',
    title = 'Info Notify',
    duration = 5000
})

Stress

-- Add Stress (Server -> Server)
TriggerEvent('hud:server:GainStress', source, amount)

-- Add Stress (Client -> Server) -- prefer the Client Export instead of this event
TriggerServerEvent('hud:server:GainStress', amount)

-- Remove Stress (Server -> Server)
TriggerEvent('hud:server:RelieveStress', source, amount)

-- Remove Stress (Client -> Server) -- prefer the Client Export instead of this event
TriggerServerEvent('hud:server:RelieveStress', amount)

Last updated