boxTarget

Description

Creates a 3D box-shaped interaction zone at a specified location.

Parameters

  • name (string): Unique identifier for the zone.

  • location (vector3): Coordinates for the center of the zone.

  • size (table): Size of the box with:

    • length (number,optional, default: 1.0)

    • width (number,optional, default: 1.0)

    • height (number,optional, default: 1.0)

    • rotation (number, optional, default: 180.0)

  • options (table): List of interactable options with:

    • icon (string, optional): FontAwesome icon class.

    • label (string): Display text for the option.

    • event (string, optional): Server event to trigger.

    • action (function, optional): Lua function to run on select.

    • data (any, optional): Data to pass to the action or event.

    • canInteract (function, optional): Condition function to allow/deny interaction.

Return Value

  • None

Example Use Case

ps.boxTarget("gas_pump", vector3(123.45, 678.90, 23.32), {
    length = 1.0,
    width = 1.0,
    height = 2.0,
    rotation = 213.54,
}, {
    {
        label = "Refill Vehicle",
        icon = "fa-solid fa-gas-pump",
        action = function()
            print("Filling gas...")
        end
    },
    {
        label = "Syphon Vehicle",
        icon = "fa-solid fa-gas-pump",
        action = function()
            print("syphoning gas...")
        end
    },
})

Last updated