qb-target
qb-target adds interaction options to entities, models, entity types, bones, and PolyZone zones.
Its manifest requires PolyZone; QBCore is an optional dependency according to the README.
Start with config.lua, then use upstream EXAMPLES.md and TEMPLATES.md for the current
registration shape. Target visibility can be limited by distance and canInteract checks.
Treat client visibility as presentation only: validate permissions and state again on the server
before changing money, inventory, or persistent entities.
Add a sit option to chair models
There is no safe “any prop chair” switch: each model can have a different origin, heading, and seat height. Register a tested allowlist and store per-model offsets when needed.
local chairModels = { `prop_chair_01a`, `prop_chair_04a` }
exports['qb-target']:AddTargetModel(chairModels, {
options = {
{
icon = 'fas fa-chair',
label = 'Sit',
action = function(entity)
local coords = GetEntityCoords(entity)
local heading = GetEntityHeading(entity)
TaskStartScenarioAtPosition(
PlayerPedId(), 'PROP_HUMAN_SEAT_CHAIR_MP_PLAYER',
coords.x, coords.y, coords.z, heading, 0, true, true
)
end,
canInteract = function(entity)
return DoesEntityExist(entity) and not IsPedInAnyVehicle(PlayerPedId(), false)
end
}
},
distance = 1.5
})
AddEventHandler('onResourceStop', function(resource)
if resource ~= GetCurrentResourceName() then return end
exports['qb-target']:RemoveTargetModel(chairModels, 'Sit')
ClearPedTasks(PlayerPedId())
end)Test every model and rotate it through several headings. If the scenario sits beside or inside the prop, use a model-specific position/heading offset instead of widening the target distance.
Update checklist
- Compare
config.lua,registration.lua,client.lua, anddata/with your deployed commit. - Test add/remove operations and every job, gang, item, and distance condition on staging.
- Confirm target callbacks cannot bypass the server-side authorization for their action.