Functions

Here you will find functions and example code on how to use our Interactions.

Local Entity

The Interactions can only be invoked on the Client-Side!

Adding Local Entity

exports["is_interaction"]:addInteractionLocalEntity(name, entity, data)
  • name: string

  • entity: object

  • data: table

    • hideSquare: boolean or nil

    • checkVisibility: boolean or nil

    • showInVehicle: boolean or nil

    • distance: number or nil

    • distanceText: number or nil

    • offset: table or nil

      • text: table

        • x: number

        • y: number

        • z: number

      • target: table

        • x: number

        • y: number

        • z: number

    • bone: number or string or nil

    • options: table

      • option: indexed table

        • name: string or nil

        • label: string or nil

        • icon: string or nil

        • key: string or nil

        • duration: number or nil

        • onSelect: function or nil

Example Usage

-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionLocalEntity("testInteraction", entity, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function()
                print("option1 working")
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextLocalEntity("testText", entity, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})

Removing Local Entity

exports["is_interaction"]:removeLocalEntity(entity, name, option)
  • entity: object

  • name: string or nil

  • option: name or nil

Example Usage

-- Example 1: Removing All Interactions

exports["is_interaction"]:removeLocalEntity(entity)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeLocalEntity(entity, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeLocalEntity(entity, "testText", "option1")

Hiding/Showing Local Entity

exports["is_interaction"]:hideLocalEntity(entity, name)
  • entity: object

  • name: string or nil

Example Usage

-- Example 1: Hiding All Interactions for specified Local Entity

exports["is_interaction"]:hideLocalEntity(entity)

-- Example 2: Hiding Interaction for specified Local Entity

exports["is_interaction"]:hideLocalEntity(entity, "testText")

-- Example 3: Showing All Interactions for specified Local Entity

exports["is_interaction"]:showLocalEntity(entity)

-- Example 4: Showing Interaction for specified Local Entity

exports["is_interaction"]:showLocalEntity(entity, "testText")

Model

The Interactions can only be invoked on the Client-Side!

Adding Model

exports["is_interaction"]:addInteractionModel(name, model, data)
  • name: string

  • model: hash

  • data: table

    • hideSquare: boolean or nil

    • checkVisibility: boolean or nil

    • showInVehicle: boolean or nil

    • distance: number or nil

    • distanceText: number or nil

    • offset: table or nil

      • text: table

        • x: number

        • y: number

        • z: number

      • target: table

        • x: number

        • y: number

        • z: number

    • bone: number or string or nil

    • options: table

      • option: indexed table

        • name: string or nil

        • label: string or nil

        • icon: string or nil

        • key: string or nil

        • duration: number or nil

        • onSelect: function or nil

Example Usage

-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionModel("testInteraction", model, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function(entity)
                print("found "..entity)
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextModel("testText", model, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})

Removing Model

exports["is_interaction"]:removeModel(model, name, option)
  • model: hash

  • name: string or nil

  • option: name or nil

Example Usage

-- Example 1: Removing All Interactions

exports["is_interaction"]:removeModel(model)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeModel(model, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeModel(model, "testText", "option1")

Hiding/Showing Model

exports["is_interaction"]:hideModel(model, name)
  • model: hash

  • name: string or nil

Example Usage

-- Example 1: Hiding All Interactions for specified Model

exports["is_interaction"]:hideModel(model)

-- Example 2: Hiding Interaction for specified Model

exports["is_interaction"]:hideModel(model, "testText")

-- Example 3: Showing All Interactions for specified Model

exports["is_interaction"]:showModel(model)

-- Example 4: Showing Interaction for specified Model

exports["is_interaction"]:showModel(model, "testText")

Global Entities

The Interactions can only be invoked on the Client-Side!

Adding Global Entities

exports["is_interaction"]:addInteractionGlobal(name, select, data)
  • name: string

  • select: "vehicle" or "ped" or "player"

  • data: table

    • hideSquare: boolean or nil

    • checkVisibility: boolean or nil

    • showInVehicle: boolean or nil

    • distance: number or nil

    • distanceText: number or nil

    • offset: table or nil

      • text: table

        • x: number

        • y: number

        • z: number

      • target: table

        • x: number

        • y: number

        • z: number

    • bone: number or string or nil

    • ignoreModel: indexed table

      • model: hash

    • options: table

      • option: indexed table

        • name: string or nil

        • label: string or nil

        • icon: string or nil

        • key: string or nil

        • duration: number or nil

        • onSelect: function or nil

Example Usage

-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionGlobal("testInteraction", "vehicle", {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    ignoreModel = {-295689028},
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function(entity)
                print("found "..entity)
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextGlobal("testText", "vehicle", {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    bone = nil,
    ignoreModel = {-295689028},
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})

Removing Global Entities

exports["is_interaction"]:removeGlobal(select, name, option)
  • select: "vehicle" or "ped" or "player"

  • name: string or nil

  • option: name or nil

Example Usage

-- Example 1: Removing All Interactions

exports["is_interaction"]:removeGlobal(select)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeGlobal(select, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeGlobal(select, "testText", "option1")

Hiding/Showing Global Entities

exports["is_interaction"]:hideGlobal(select, name)
  • select: "vehicle" or "ped" or "player"

  • name: string or nil

Example Usage

-- Example 1: Hiding All Interactions for specified Global Entities

exports["is_interaction"]:hideGlobal(select)

-- Example 2: Hiding Interaction for specified Global Entities

exports["is_interaction"]:hideGlobal(select, "testText")

-- Example 3: Showing All Interactions for specified Global Entities

exports["is_interaction"]:showGlobal(select)

-- Example 4: Showing Interaction for specified Global Entities

exports["is_interaction"]:showGlobal(select, "testText")

Coordinates

The Interactions can only be invoked on the Client-Side!

Adding Coordinates

exports["is_interaction"]:addInteractionCoords(name, coords, data)
  • name: string

  • coords: vector3

  • data: table

    • hideSquare: boolean or nil

    • checkVisibility: boolean or nil

    • showInVehicle: boolean or nil

    • distance: number or nil

    • distanceText: number or nil

    • offset: table or nil

      • text: table

        • x: number

        • y: number

        • z: number

      • target: table

        • x: number

        • y: number

        • z: number

    • options: table

      • option: indexed table

        • name: string or nil

        • label: string or nil

        • icon: string or nil

        • key: string or nil

        • duration: number or nil

        • onSelect: function or nil

Example Usage

-- Example 1: Using Interaction

exports["is_interaction"]:addInteractionCoords("testInteraction", coords, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
            key = "E",
            duration = 500,
            onSelect = function()
                print("option1 working")
            end
        },
    }
})

-- Example 2: Using Text

exports["is_interaction"]:addTextCoords("testText", coords, {
    hideSquare = false,
    checkVisibility = true,
    showInVehicle = false,
    distance = 5.0,
    distanceText = 1.0,
    offset = {
        text = {x = 0.0, y = 0.0, z = 1.0},
        target = {x = 0.0, y = 0.0, z = 0.0}
    },
    options = {
        {
            name = "option1",
            label = "Example Text",
            icon = nil,
        },
    }
})

Removing Coordinates

exports["is_interaction"]:removeCoords(coords, name, option)
  • coords: vector3

  • name: string or nil

  • option: name or nil

Example Usage

-- Example 1: Removing All Interactions

exports["is_interaction"]:removeCoords(coords)

-- Example 2: Removing provided Interaction

exports["is_interaction"]:removeCoords(coords, "testText")

-- Example 3: Removing provided Interaction Option

exports["is_interaction"]:removeCoords(coords, "testText", "option1")

Hiding/Showing Coordinates

exports["is_interaction"]:hideCoords(coords, name)
  • coords: vector3

  • name: string or nil

Example Usage

-- Example 1: Hiding All Interactions at specified Coordinates

exports["is_interaction"]:hideCoords(coords)

-- Example 2: Hiding Interaction at specified Coordinates

exports["is_interaction"]:hideCoords(coords, "testText")

-- Example 3: Showing All Interactions at specified Coordinates

exports["is_interaction"]:showCoords(coords)

-- Example 4: Showing Interaction at specified Coordinates

exports["is_interaction"]:showCoords(coords, "testText")

Misc

The Interactions can only be invoked on the Client-Side!

Removing Interactions Created By Resource

exports["is_interaction"]:removeResource(resource)
  • resource: string or nil

Example Usage

-- Example 1: Removing Interactions in specified resource

exports["is_interaction"]:removeResource("qb-shops")

-- Example 2: Removing Interactions in current resource

exports["is_interaction"]:removeResource()

Last updated