KuzQuality - FiveM Documentation
Webstore
  • KuzQuality - FiveM Scripts
  • Useful links
    • KuzQuality.com | Shop now
    • Our Discord
  • General
    • Common issues
    • Frequently asked questions
    • Updating server artifacts
    • Installation basics
  • RESOURCES
    • Premium Resources
      • Shell Creator
        • Config
        • Installation Guide
        • Video guide
        • API
          • Server
          • Client
      • Cocaine Production
        • Config
        • Installation Guide
      • Roof boxes & bike racks
        • Config
        • Installation Guide
        • API
      • Meth Cooking
        • Config
        • Installation Guide
      • Private islands
        • Config
        • Installation Guide
      • Real offroad physics
        • Config
        • Installation Guide
        • API
      • Placeable items
        • Config
        • Inventory integrations
        • Installation Guide
      • Car Dyno
        • Config
        • Installation Guide
      • Outfit Bag 2.0
        • Config
        • Installation Guide
      • Realistic wheel damage
        • Config
      • Smash 'n Grab 2.0
        • Config
        • Installation Guide
      • Animation Suggestions
        • Config
        • Installation Guide
      • Smugglers Heist
        • Config
        • Installation Guide
      • Car Heist
        • Config
      • Towing & Winching
        • Config
        • Installation Guide
      • Security Systems
        • Config
        • Developer Docs
      • Drift Tires
        • Config
        • Installation Guide
      • Engine Swaps [ESX]
        • Config
      • Engine Swaps [QBCore]
        • Config
      • Islands Generator
        • Config
        • Installation Guide
      • Brake Overheating
        • Config
        • Installation Guide
      • Drift Smoke
        • Config
      • Advanced Ped Looting
        • Config
        • Installation Guide
      • Bike Jump Ability
        • Config
        • Installation Guide
      • Hideouts 2.0
        • Config
      • Detective Tools
        • Config
      • Classic Outfit Bag
        • Config
      • Traction Control Toggle
        • Config
      • Car Lift
        • Config
      • Vehicle Towing
        • Config
      • RGB Controller (Full)
        • Config
      • Diving [ESX]
        • Config
      • Diving [QBCore]
        • Config
    • Free Resources
      • Prop Placer
        • Config
      • Nightclub Heist
        • Config
      • Basic Security Lasers
        • Config
        • Developer Docs
      • Advanced Airdrop
        • Config
      • Smooth Throttle Control
        • Config
      • Better rollbacks & handbrake turns
        • Config
      • Wild Cannabis (Loot Areas Example)
        • Config
      • RGB Controller (Basic)
        • Config
      • Dragy
        • Config
      • Easter Egg Hunt
        • Config
      • Loot Areas
        • Config
        • Developer docs
  • KQ Link
    • KQ Link | Installation guide
    • Using Git
    • Developer reference
      • Exports
        • Server
        • Client
Powered by GitBook
On this page
  • Interactions
  • Entity interaction
  • Zone Interaction
  • Interaction functions
  • Dispatch
  • Notifications
  1. KQ Link
  2. Developer reference
  3. Exports

Client

These exports can be only called on the client side of your scripts.

PreviousServer

Last updated 7 months ago

Interactions

Entity interaction

exports.kq_link.AddInteractionEntity(
    entity,
    offset,
    message,
    targetMessage,
    input,
    callback,
    canInteract,
    meta,
    interactDist,
    icon
): Interaction<object> 
  • entity: number the numeric entity id

  • offset: vector3 A vector of offsets for the entity interaction (only applicable when not using target)

  • message: string Message displayed for users when using non-target solution

  • targetMessage: string Message displayed for users when using a target solution

  • input: number The control index ()

  • callback: function reference The function which will get executed after user interacts

  • canInteract?: function reference The function which will get executed to check whether the user can interact with the entity

  • meta?: table A table with any data you want to store on the interaction. This will be accessible in your callback and canInteract functions

  • interactDist?: number The max distance at which players can interact (default 2.0)

  • icon?: string A font-awesome icon used for the target systems. "fas fa-hand" e.g.

Example

-- In this example we will add a mock interaction for a player to go ragdoll upon interaction

function OnInteract(interaction)
    -- You can retrieve the meta data using interaction.GetMeta()
    local meta = interaction.GetMeta()
    -- We defined the ragdoll duration in the meta table when creating the interaction entity
    -- We can now access it
    local ragdollDuration = meta.ragdollDuration 

    SetPedToRagdoll(PlayerPedId(), ragdollDuration, ragdollDuration, 0, 0, 0)
    
    -- We can also retrieve the entity from the interaction
    -- In this case we will retrieve it and delete it straight away
    DeleteEntity(interaction.GetEntity())
end

function CanInteract(interaction)
    -- In this case we will only allow the player to interact if they're not already ragdolling
    return not IsPedRagdoll(PlayerPedId())
end

exports.kq_link:AddInteractionEntity(
            entity,
            vector3(0, 0, 0.5),
            '[E] Touch the exposed wire',
            'Touch the exposed wire',
            38, -- 38 is the index for E
            OnInteract,
            CanInteract,
            {
                ragdollDuration = 10000
            },
            1.5,
            'fas fa-hand'
        )

Zone Interaction

exports.kq_link.AddInteractionZone(
    coords,
    rotation,
    scale,
    message,
    targetMessage,
    input,
    callback,
    canInteract,
    meta,
    interactDist,
    icon
): Interaction<object>
  • coords: vector3 The coordinates of the center of the zone

  • rotation: vector3 The rotation of the zone (used for target)

  • scale: vector3 The scale of the zone (used for target)

  • message: string Message displayed for users when using non-target solution

  • targetMessage: string Message displayed for users when using a target solution

  • callback: function reference The function which will get executed after user interacts

  • canInteract?: function reference The function which will get executed to check whether the user can interact with the entity

  • meta?: table A table with any data you want to store on the interaction. This will be accessible in your callback and canInteract functions

  • interactDist?: number The max distance at which players can interact (default 2.0)

  • icon?: string A font-awesome icon used for the target systems. "fas fa-hand" e.g.

Example

-- In this example we will add a mock interaction for a player to go ragdoll upon interaction

function OnInteract(interaction)
    -- You can retrieve the meta data using interaction.GetMeta()
    local meta = interaction.GetMeta()
    -- We defined the ragdoll duration in the meta table when creating the interaction zone
    -- We can now access it
    local ragdollDuration = meta.ragdollDuration 

    SetPedToRagdoll(PlayerPedId(), ragdollDuration, ragdollDuration, 0, 0, 0)
end

function CanInteract(interaction)
    -- In this case we will only allow the player to interact if they're not already ragdolling
    return not IsPedRagdoll(PlayerPedId())
end

exports.kq_link:AddInteractionZone(
            vector3(254.3, 124.0, 42.0),
            vector3(0, 0, 0),
            vector3(1, 1, 1),
            '[E] Touch the exposed wire',
            'Touch the exposed wire',
            38, -- 38 is the index for E
            OnInteract,
            CanInteract,
            {
                ragdollDuration = 10000
            },
            1.5,
            'fas fa-hand'
        )

Interaction functions

The interaction contains many useful functions which can be used to retrieve or set variables

interaction.GetMeta()
-- Returns the metadata table of the interaction
interaction.GetCoords()
-- Returns the coordinates of the interaction (will return the entity coords if its an entity interaction)
interaction.GetEntity()
-- Returns the interaction entity (only available on Entity interactions)
interaction.Delete()
-- Deletes the interaction
interaction.GetInvoker()
-- Returns the resource which invoked (created) the interactable

Dispatch

Sending a simple dispatch message

exports.kq_link.SendDispatchMessage({
    coords,
    jobs,
    message,
    description,
    code,
    blip = {
        sprite,
        color,
        scale,
        text,
        flash,
    }
}): Void

The data needs to be sent as a table containing the following values:

  • coords: vector3 The coordinates of the dispatch alert

  • jobs: table A table containing string names of the jobs which are going to receive the alert

  • message: string The message/title of the alert

  • description: string The long description of the alert

  • code: string a 10-code of the alert. (Default 10-35)

  • blip: table A table containing the following keys:

    • color: integer The id of a blip color

    • scale: float The scale of the blip

    • text: string The name of the blip visible in the legend

    • flash: boolean whether the blip should be flashing on the map

Example

exports.kq_link:SendDispatchMessage({
    coords = GetEntityCoords(PlayerPedId()),
    jobs = {'bcso', 'lspd'},
    message = 'Suspicious van with blue smoke',
    description = 'There\'s a van with blue smoke coming out of it. It looks really shady!',
    code = '10-35',
    blip = {
      sprite = 636,
      color = 1,
      scale = 1.5,
      text = 'Suspicious van',
      flash = true,
    },
 })

Notifications

Sending a notification

exports.kq_link:Notify(message, type)
  • message: string The notification message

  • type?: string enum ['success', 'warning', 'error'] - This defines the color of the notification

input: number The control index ()

sprite: integer The id of a blip sprite (See more )

learn more
learn more
https://docs.fivem.net/docs/game-references/blips/