Client
These exports can be only called on the client side of your scripts.
Interactions
Entity interaction
exports.kq_link.AddInteractionEntity(
entity,
offset,
message,
targetMessage,
input,
callback,
canInteract,
meta,
interactDist,
icon
): Interaction<object>
entity:
number
the numeric entity idoffset:
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 solutiontargetMessage:
string
Message displayed for users when using a target solutioninput:
number
The control index (learn more)callback:
function reference
The function which will get executed after user interactscanInteract?:
function reference
The function which will get executed to check whether the user can interact with the entitymeta?:
table
A table with any data you want to store on the interaction. This will be accessible in your callback and canInteract functionsinteractDist?:
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 zonerotation:
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 solutiontargetMessage:
string
Message displayed for users when using a target solutioninput:
number
The control index (learn more)callback:
function reference
The function which will get executed after user interactscanInteract?:
function reference
The function which will get executed to check whether the user can interact with the entitymeta?:
table
A table with any data you want to store on the interaction. This will be accessible in your callback and canInteract functionsinteractDist?:
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 alertjobs:
table
A table containing string names of the jobs which are going to receive the alertmessage:
string
The message/title of the alertdescription:
string
The long description of the alertcode:
string
a 10-code of the alert. (Default 10-35)blip:
table
A table containing the following keys:sprite:
integer
The id of a blip sprite (See more https://docs.fivem.net/docs/game-references/blips/)color:
integer
The id of a blip colorscale:
float
The scale of the bliptext:
string
The name of the blip visible in the legendflash:
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 messagetype?:
string
enum ['success', 'warning', 'error'] - This defines the color of the notification
Last updated