Exports

In this section, you'll find easy-to-use exports for notifications, announcements, progress bars, and more, ensuring seamless integration with your existing scripts.


ToggleHud

Description:

Toggle the HUD visibility based on the provided boolean, turning it on or off.

Usage:

exports["cloud-hud"]:ToggleHud(toggle)

TriggerEvent("cloud-hud:ToggleHud", source, toggle)

Parameters:

  • toggle (boolean)


ShowNotify

Description:

Displays a notification with customizable content, type, and duration.

Usage:

exports["cloud-hud"]:ShowNotify(data)

TriggerEvent("cloud-hud:ShowNotify", source, data)

Parameters:

  • data (table): Data table containing the following keys:

    • icon? (string): The icon of the notification. (use Iconify for icons)

      • If not specified, the default icon defined in sh_config_alerts.lua will be used.

    • title (string): The title of the notification.

    • description (string): The detailed message or description displayed in the notification.

    • type (string): Specifies the style of the notification.

      • Available Types:

        • "info": Informational messages

          • "success": Success messages

          • "warning": Warning messages

          • "error": Error messages

    • duration (number): The duration (in milliseconds) for which the notification will be displayed.

Example:

-- Client Side
exports["cloud-hud"]:ShowNotify({
    icon = "mdi:info-circle",
    title = "Info",
    description = "This is an informational message.",
    type = "info",
    duration = 5000,
})

-- Server Side
TriggerClientEvent("cloud-hud:ShowNotify", source, {
    icon = "mdi:info-circle",
    title = "Info",
    description = "This is an informational message.",
    type = "info",
    duration = 5000,
})

ShowAnnounce

Description:

Displays an announcement with customizable content, type, and duration.

Usage:

exports["cloud-hud"]:ShowAnnounce(data)

TriggerEvent("cloud-hud:ShowNotify", source, data)

Parameters:

  • data (table): Data table containing the following keys:

    • icon? (string): The icon of the announcement. (use Iconify for icons)

      • If not specified, the default icon defined in sh_config_alerts.lua will be used.

    • title (string): The title of the announcement.

    • description (string): The detailed message or description displayed in the announcement.

    • type (string): Specifies the style of the announcement.

      • Available Types:

        • "announce": Announcement messages

          • "info": Informational messages

          • "success": Success messages

          • "warning": Warning messages

          • "error": Error messages

    • duration (number): The duration (in milliseconds) for which the announcement will be displayed.

Example:

-- Client Side
exports["cloud-hud"]:ShowAnnounce({
    icon = "mdi:announcement",
    title = "Announcement",
    description = "This is an important announcement!",
    type = "announce",
    duration = 5000,
})

-- Server Side
TriggerClientEvent("cloud-hud:ShowAnnounce", source, {
    icon = "mdi:announcement",
    title = "Announcement",
    description = "This is an important announcement!",
    type = "announce",
    duration = 5000,
})

StartProgress

Description:

Starts a progress bar with detailed customization options, including animations, restrictions, and props.

Usage:

local progress = exports["cloud-hud"]:StartProgress(data)

TriggerEvent("cloud-hud:StartProgress", source, data)

Parameters:

  • data (table): Data table containing the following keys:

    • title (string): The text displayed as the progress bar's title.

    • duration (number): The duration of the progress bar in milliseconds.

    • allow? (table): Conditions under which the progress bar is allowed to continue:

      • whileDead (boolean): Allow while the player is dead.

      • whileRagdoll (boolean): Allow while ragdolling.

      • whileFalling (boolean): Allow while falling.

      • whileSwimming (boolean): Allow while swimming.

      • whileCuffed (boolean): Allow while cuffed.

      • cancel (boolean): Allow the player to cancel the progress manually.

    • disable? (table): Actions disabled during the progress:

      • move (boolean): Disable movement.

      • sprint (boolean): Disable sprinting.

      • combat (boolean): Disable combat actions.

      • mouse (boolean): Disable mouse look controls.

      • car (boolean): Disable vehicle controls.

    • anim? (table): Animation played during the progress bar:

      • scenario? (string): Scenario name.

        • Either scenario or dict must be specified.

      • playEnter? (boolean): Plays the enter animation.

        • Default: true

      • dict? (string): Animation dictionary.

        • Either scenario or dict must be specified.

      • name (string): Animation name.

      • blendIn? (float): Animation blend in speed.

        • Default: 3.0

      • blendOut? (float): Animation blend out speed.

        • Default: 1.0

      • duration? (number): Animation duration.

        • Default: -1

      • flag? (number): Animation flag.

        • Default: 49

      • playbackRate? (number): Animation playback rate.

        • Default: 0

      • lockX? (boolean): Locks the animation on the X-axis.

      • lockY? (boolean): Locks the animation on the Y-axis.

      • lockZ? (boolean): Locks the animation on the Z-axis.

    • prop? (table): Prop attached to the player during the progress bar:

Returns:

  • progress (boolean): true if the progress completed, false if it was canceled.

Example:

local progress = exports["cloud-hud"]:StartProgress({
    title = "Eating Burger...",
    duration = 3000,
    allow = {
        whileDead = false,
        whileRagdoll = false,
        whileFalling = false,
        whileSwimming = false,
        whileCuffed = false,
        cancel = true,
    },
    disable = {
        move = false,
        sprint = false,
        combat = false,
        mouse = false,
        car = false,
    },
    anim = {
        dict = "mp_player_inteat@burger",
        name = "mp_player_int_eat_burger_fp",
    },
    prop = {
        model = `prop_cs_burger_01`,
        pos = vec3(0.02, 0.02, -0.02),
        rot = vec3(40.0, 0.0, -10.0),
    },
})

if progress then
    exports["cloud-hud"]:ShowNotify({
        title = "Success",
        description = "Progress completed.",
        type = "success",
        duration = 3000,
    })
else
    exports["cloud-hud"]:ShowNotify({
        title = "Warning",
        description = "Progress canceled.",
        type = "warning",
        duration = 3000,
    })
end

ShowProgressUI

Description:

Displays the progress bar UI without any additional functionality or restrictions.

Usage:

exports["cloud-hud"]:ShowProgressUI(title, duration)

TriggerEvent("cloud-hud:ShowProgressUI", source, title, duration)

Parameters:

  • title (string): The text displayed as the progress bar's title.

  • duration (number): The duration of the progress bar in milliseconds.


CancelProgress

Description:

Cancels the currently active progress bar.

Usage:

exports["cloud-hud"]:CancelProgress()

TriggerEvent("cloud-hud:CancelProgress", source)

IsProgressActive

Description:

Checks if a progress bar is currently active.

Usage:

local isActive = exports["cloud-hud"]:IsProgressActive()

Returns:

  • isActive (boolean): true if a progress bar is active, false otherwise.


Last updated