AddZone
AddZone
This export does the equivalent of AddCircleZone, AddBoxZone, AddPolyZone, AddEntityZone
Arguments
Argument
Description
identifier
The unique string identifier of this target, in-case you want to remove it later
type
The type of zone you want to create ('circle', 'box', 'poly', 'combo', 'entity')
zoneOptions
The options for the PolyZone (see Zone Options Formatting)
options
The options for the target (see Options Formatting)
Usage
exports['nyx2_target']:AddZone(identifier, type, zoneOptions, options)
Example (Circle Zone)
exports['nyx2_target']:AddZone('debug_zone_circle', 'circle', {
name = 'debug_zone_circle',
center = vector3(-73.65, -816.52, 326.18 - 1.0),
radius = 1.0,
debugPoly = true,
useZ = true,
}, {
{
title = 'Debug Circle Zone',
icon = 'fas fa-cube',
action = function(zone)
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.Notify('You are inside a circle zone!', 'success')
end,
canInteract = function(zone)
return true
end,
job = nil, -- if nil, all jobs can interact
gang = nil, -- if nil, all gangs can interact
citizenid = nil, -- if nil, all players can interact
item = nil, -- if nil, don't require an item to interact
}
})
Example (Box Zone)
exports['nyx2_target']:AddZone('debug_zone_box', 'box', {
name = 'debug_zone_box',
center = vector3(-77.63, -820.31, 326.18 - 1.0),
width = 1.0,
length = 1.0,
debugPoly = true,
}, {
{
title = 'Debug Box Zone',
icon = 'fas fa-cube',
action = function(zone)
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.Notify('You are inside a box zone!', 'success')
end,
canInteract = function(zone)
return true
end,
job = nil, -- if nil, all jobs can interact
gang = nil, -- if nil, all gangs can interact
citizenid = nil, -- if nil, all players can interact
item = nil, -- if nil, don't require an item to interact
}
})
RemoveZone
This export removes a zone target that you have created.
Arguments
Argument
Description
identifier
The unique string identifier of the target you want to remove
Example
exports['nyx2_target']:RemoveZone('debug_zone_box')
Last updated