Switching from…
Switching from ox_target
Keep every ox_target and qtarget registration and let players choose how they interact.
Universal Targeting's registration API uses ox_target's names and option fields, so existing scripts work without changes.
With the bridge
This is the easy path, and the one to use if you also run Universal UI.
- Install Universal Targeting.
- Keep
ox_targetinstalled and ensureuniversal_bridgeafter it, thenuniversal_targeting. See Load order. - Restart. Every
exports.ox_target:*call and every legacy qtarget registration now goes to Universal Targeting, and ox_target's own eye is switched off.
Nothing in ox_target is modified. Stop the bridge and it behaves as before.
Without the bridge
Change exports.ox_target to exports.universal_targeting in your scripts. The function names and option tables stay the same.
exports.universal_targeting:addGlobalVehicle({
{
name = 'my_trunk',
label = 'Open trunk',
icon = 'fa-solid fa-car-rear',
bones = { 'boot' },
distance = 2.0,
onSelect = function(data)
-- data.entity is the vehicle
end,
},
})What carries over
- Registration:
addGlobalOption,addGlobalPed,addGlobalVehicle,addGlobalObject,addGlobalPlayer,addModel,addEntity,addLocalEntity, the matchingremove*calls, and sphere, box and poly zones. - Option fields:
label,name,icon,distance,bones,canInteract,onSelect,event,serverEvent,export,command,groups,items,menuNameandopenMenu. - Cleanup: everything a resource registers is removed when that resource stops.
- Zones: remove them by numeric id (ox style) or by name (qtarget style).
The full list is on Universal Targeting's exports page.
