AddModel
AddModel
This export does the equivalent of AddTargetModel
Arguments
Argument
Description
identifier
The unique string identifier of this target, in-case you want to remove it later
models
A single, or table of, model(s) that you want to apply the target to
options
The options for the target (see Options Formatting)
Usage
exports['nyx2_target']:AddModel(identifier, models, options)
Example
local boxCoords = vector3(-74.41, -823.88, 326.18)
local boxModel = GetHashKey('prop_boxpile_07d')
RequestModel(boxModel)
while not HasModelLoaded(boxModel) do
Wait(0)
end
local box = CreateObject(boxModel, boxCoords.x, boxCoords.y, boxCoords.z - 1.0, false, false, false)
SetEntityAsMissionEntity(box, true, true)
SetEntityAlpha(box, 255, false)
SetModelAsNoLongerNeeded(boxModel)
exports['nyx2_target']:AddModel('debug_box_model', 'prop_boxpile_07d', {
{
title = 'Debug Box Model',
icon = 'fas fa-cube',
action = function(zone)
local QBCore = exports['qb-core']:GetCoreObject()
QBCore.Functions.Notify('This is a model!', '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
}
})
RemoveModel
This export removes a model target that you have created.
Arguments
Argument
Description
identifier
The unique string identifier of the target you want to remove
Example
exports['nyx2_target']:RemoveModel('debug_box_model')
Last updated