A completely rewritten and optimised targeting solution based on bt-target
Key | Data Type | Example |
---|---|---|
label | string | ‘Revive target’ |
event | string | ‘qtarget:reviveTarget’ |
action | function | function(entity) ReviveTarget(entity) end |
Key | Data Type | Example |
---|---|---|
icon | string | ‘fas fa-leaf’ |
job | string | ‘police’ |
job | table | {[‘police’] = 0, [‘ambulance’] = 0} |
distance | float | 4.0 |
item | string | ‘water’ |
canInteract | function | function(entity) return DoesEntityExist(entity) end |
function(entity)
if IsPedFatallyInjured(entity) and IsPedArmed(ESX.PlayerData.ped, 2 | 4) then
return true
end
return false
end
exports.qtarget:AddTargetModel({690372739}, {
options = {
{
event = "coffee:buy",
icon = "fas fa-coffee",
label = "Coffee",
item = "coffee", -- custom parameter
price = 5 -- custom parameter
},
},
distance = 2.5
})
RegisterNetEvent('coffee:buy')
AddEventHandler('coffee:buy',function(data)
ESX.ShowNotification("You purchased a " .. data.item .. " for $" .. data.price .. ". Enjoy!")
-- server event to buy the item here
end)