#Job option for ox_target
1 messages · Page 1 of 1 (latest)
I assume you are referring to ox_target.
If so, you can utilise the groups option to achieve what you are after.
https://overextended.dev/ox_target/Options
Documentation for Overextended's resources for FiveM/RedM
yes but when I add groups everyone can still interact with the ped
Share your code
CreateThread(function()
for k,v in pairs(JobCore.Ped) do
if v.hash ~= nil then
setPedPos(v.hash, v.pos, v.heading, v.scenario)
end
exports.ox_target:addBoxZone({
coords = v.pos,
size = vector3(1, 1, 2),
rotation = v.heading,
debug = v.debug,
groups = v.group,
options = {
{
icon = v.icon,
job = v.job,
label = v.label,
event = v.event,
parameters = v.parameters
}
}
})
end
end)
JobCore.Ped = {
['EMS - Pharmacie'] = {
hash = 's_f_y_scrubs_01',
pos = vector3(-665.78, 322.14, 83.08),
heading = 269.29,
enableTarget = true,
debug = false,
icon = 'fas fa-ambulance',
label = 'Pharmacie',
group = {'ambulance'},
event = 'iAmbulance:OpenPharmacie'
}
}
Yeah so groups needs to go inside the options = {} table
Then it should work I believe
No it doesn't work, everyone still has access
What did you change
I tried to pass the job directly into the function instead of in the config file
No, just move the code inside the options table
CreateThread(function()
for k,v in pairs(JobCore.Ped) do
if v.hash ~= nil then
setPedPos(v.hash, v.pos, v.heading, v.scenario)
end
exports.ox_target:addBoxZone({
coords = v.pos,
size = vector3(1, 1, 2),
rotation = v.heading,
debug = v.debug,
--groups = v.group, <<< ------- DELETE THIS ....
options = {
{
icon = v.icon,
job = v.job,
label = v.label,
event = v.event,
parameters = v.parameters,
groups = v.group, -- <<< ------- MOVE TO HERE ....
}
}
})
end
end)
JobCore.Ped = {
['EMS - Pharmacie'] = {
hash = 's_f_y_scrubs_01',
pos = vector3(-665.78, 322.14, 83.08),
heading = 269.29,
enableTarget = true,
debug = false,
icon = 'fas fa-ambulance',
label = 'Pharmacie',
group = {'ambulance'},
event = 'iAmbulance:OpenPharmacie'
}
}