Target
RegisterNetEvent('peace-target:addPedTarget')
AddEventHandler('peace-target:addPedTarget', function(ped, job, data)
if Config.target == 'ox-target' then
exports.ox_target:addLocalEntity(ped, {
{
name = 'ped_target_' .. job,
serverEvent = data.Interact.OnDuty.Event,
icon = 'fa-solid fa-user-clock',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
})
elseif Config.target == 'qtarget' then
exports.qtarget:AddEntityZone("ped_target_" .. job, ped, {
name = "ped_target_" .. job,
debugPoly = false,
}, {
options = {
{
name = 'ped_target_' .. job,
event = data.Interact.OnDuty.Event,
icon = 'fa-solid fa-user-clock',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
elseif Config.target == 'qb-target' then
exports['qb-target']:AddEntityZone("ped_target_" .. job, ped, {
name = "ped_target_" .. job,
debugPoly = false,
}, {
options = {
{
type = data.Interact.OnDuty.ClientOrServer,
event = data.Interact.OnDuty.Event,
icon = 'fas fa-user-clock',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:AddEntityZone("ped_target_" .. job, ped, {
name = "ped_target_" .. job,
debugPoly = false,
}, {
options = {
{
type = data.Interact.OnDuty.ClientOrServer,
event = data.Interact.OnDuty.Event,
icon = 'fas fa-user-clock',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
end
end)
RegisterNetEvent('peace-target:addPropTarget')
AddEventHandler('peace-target:addPropTarget', function(prop, job, data)
if Config.target == 'ox-target' then
exports.ox_target:addLocalEntity(prop, {
{
name = 'prop_target_' .. job,
serverEvent = data.Interact.OnDuty.Event,
icon = 'fa-solid fa-box',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
})
elseif Config.target == 'qtarget' then
exports.qtarget:AddEntityZone("prop_target_" .. job, prop, {
name = "prop_target_" .. job,
debugPoly = false,
}, {
options = {
{
name = 'prop_target_' .. job,
event = data.Interact.OnDuty.Event,
icon = 'fa-solid fa-box',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
elseif Config.target == 'qb-target' then
exports['qb-target']:AddEntityZone("prop_target_" .. job, prop, {
name = "prop_target_" .. job,
debugPoly = false,
}, {
options = {
{
type = data.Interact.OnDuty.ClientOrServer,
event = data.Interact.OnDuty.Event,
icon = 'fas fa-box',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:AddEntityZone("prop_target_" .. job, prop, {
name = "prop_target_" .. job,
debugPoly = false,
}, {
options = {
{
type = data.Interact.OnDuty.ClientOrServer,
event = data.Interact.OnDuty.Event,
icon = 'fas fa-box',
label = Locales[Config.lang]["Interact"]["TakesDuty"],
}
},
distance = 2.5
})
end
end)
RegisterNetEvent('peace-target:addPanelCompanyTarget')
AddEventHandler('peace-target:addPanelCompanyTarget', function(entity, job, isProp)
local targetName = isProp and "prop_panel_target_" .. job or "ped_panel_target_" .. job
if Config.target == 'qb-target' then
exports['qb-target']:AddEntityZone(targetName, entity, {
name = targetName,
debugPoly = false,
}, {
options = {
{
type = "client",
event = "peace-dutylog:client:openDutyLog",
icon = "fas fa-list-alt",
label = Locales[Config.lang]["PanelCompany"]["OpenDutyLog"],
},
},
distance = 2.5
})
elseif Config.target == 'ox-target' then
exports.ox_target:addLocalEntity(entity, {
{
name = targetName,
event = "peace-dutylog:client:openDutyLog",
icon = "fa-solid fa-list-alt",
label = Locales[Config.lang]["PanelCompany"]["OpenDutyLog"],
},
})
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:AddEntityZone(targetName, entity, {
name = targetName,
debugPoly = false,
}, {
options = {
{
type = "client",
event = "peace-dutylog:client:openDutyLog",
icon = "fas fa-list-alt",
label = Locales[Config.lang]["PanelCompany"]["OpenDutyLog"],
},
},
distance = 2.5
})
elseif Config.target == 'qtarget' then
exports.qtarget:AddEntityZone(targetName, entity, {
name = targetName,
debugPoly = false,
}, {
options = {
{
name = targetName,
event = "peace-dutylog:client:openDutyLog",
icon = "fa-solid fa-list-alt",
label = Locales[Config.lang]["PanelCompany"]["OpenDutyLog"],
},
},
distance = 2.5
})
end
end)
RegisterNetEvent('peace-target:removePedTarget')
AddEventHandler('peace-target:removePedTarget', function(ped, job)
if Config.target == 'qb-target' then
exports['qb-target']:RemoveZone("ped_target_" .. job)
elseif Config.target == 'ox-target' then
exports.ox_target:removeLocalEntity(ped)
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:RemoveZone("ped_target_" .. job)
elseif Config.target == 'qtarget' then
exports.qtarget:RemoveZone("ped_target_" .. job)
end
end)
RegisterNetEvent('peace-target:removePropTarget')
AddEventHandler('peace-target:removePropTarget', function(prop, job)
if Config.target == 'qb-target' then
exports['qb-target']:RemoveZone("prop_target_" .. job)
elseif Config.target == 'ox-target' then
exports.ox_target:removeLocalEntity(prop)
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:RemoveZone("prop_target_" .. job)
elseif Config.target == 'qtarget' then
exports.qtarget:RemoveZone("prop_target_" .. job)
end
end)
RegisterNetEvent('peace-target:removePanelCompanyTarget')
AddEventHandler('peace-target:removePanelCompanyTarget', function(entity, job, isProp)
local targetName = isProp and "prop_panel_target_" .. job or "ped_panel_target_" .. job
if Config.target == 'qb-target' then
exports['qb-target']:RemoveZone(targetName)
elseif Config.target == 'ox-target' then
exports.ox_target:removeLocalEntity(entity)
elseif Config.target == 'luck-contextmenu' then
exports['luck-contextmenu']:RemoveZone(targetName)
elseif Config.target == 'qtarget' then
exports.qtarget:RemoveZone(targetName)
end
end)
Last updated