[Free] Ox Target

The successor to qtarget, focused on improving functionality and performance at the cost of compatibility.

Dependencies

Why another third-eye resource?

The original author of qtarget left FiveM right after releasing it, with many features scrapped or untested. Since it was supposed to be mostly compatible with bt-target it kept many of its flaws, and the resource was mostly abandoned as I worked on other projects. Rather than hacking my way through the spaghetti that makes up qtarget, I started completely fresh with only a list of features.

Video

todo… I’m lazy.

Supported Frameworks

Support for ox_core, esx-legacy, qb-core.

How can I check if a player has a job/gang?

Use the groups property to compare against a group, job or gang (framework-dependant).

example
exports.ox_target:addGlobalPlayer({
    {
        name = 'cuff',
        icon = 'fas fa-handcuffs',
        label = 'Handcuff',
        groups = 'police', -- or {'police', 'sheriff'}, {police = 0}
        distance = 1.5,
        onSelect = function(data)
            cuffPlayer(data.entity)
        end
    }
})

How can I check for other variables?

Use the canInteract function with your option.

example
exports.ox_target:addGlobalPlayer({
    {
        name = 'cuff',
        icon = 'fas fa-handcuffs',
        label = 'Handcuff',
        distance = 1.5,
        canInteract = function(entity, distance, coords, name)
            return InService and not IsPedCuffed(entity)
        end,
        onSelect = function(data)
            cuffPlayer(data.entity)
        end
    }
})

Compatibility

As mentioned previously, ox_target has been rewritten entirely purposefully drops compatibility with qtarget. There is partial compatibility included but it does not and will not ever cover 100% of cases.

43 Likes

:ox: :ox: :ox: :ox:

5 Likes

Love it but sadly most scripts are made with qTarget and are not compatible maybe add that Scripts that use qTarget rewritten by ox_Target so that it can be used with ox_Target or an feature that ox_Target understands script that uses qTarget and can use it as it was written to use ox_target instead of qTarget

But thank you guys from overextended for the hard work you put in your Scripts and OX-Framework <3

1 Like

Saw this on your github a while ago and was waiting for an official release - as always, great job.
One thing I’ve wanted but have lacked the ability to do so myself (I have absolutely no idea about how raycasts work, the minimal experience I have with them comes from Unity from at least 5-6 years ago…) is to have it work in a slightly different way - rather than having the eye in the middle and moving your camera around, have the screen freeze and move the eye/a circle around. Whenever you hover over something that has an action - give it an outline and change the color of the eye as to signalize that you can take some action here. I have seen it on some servers and it worked beautifully - if you do have the time, that’s a suggestion/request I’d make.

I’d also bump the previous comment - backwards compatibility with qTarget would be good to be provided. Most actually well-written scripts (which is… not many) will give players the option to configure that to your target system, but most scripts overall - won’t.

2 Likes

ox_Target understands script that uses qTarget and can use it

backwards compatibility with qTarget would be good to be provided

I can’t make it backwards compatible. Features don’t exist or are implemented in completely different ways. Some qtarget resources will constantly re-register options on a target, which works because options are stored by name; on ox_target that results in hundreds of options.

Partial compatibility is already there if you look, but it is not and will not ever be a drop-in replacement.

Great work! Looking forward to converting from qtarget and checking out some of the new features. Keep up the great work!

how about qb-target?

Couldn’t care less about qbus and its ecosystem, if people want to PR they can; I’m not wasting my time.

qbtarget is a fork from qtarget and is already mostly compatible with it, but with extra bloat i.e. integrated ped spawning, which makes no sense and will never be accepted.

2 Likes

esx1.1 esx1.2 Can it be used??

finally. thank you

Nobody supports 1.1 anymore

Use ESX 0.1.1. It’s a lot better

Thank you for providing such an amazing tool.
Soon i will change qt_target and go for ox_target instead!

Thanks and keep going!

Probably works, there’s barely anything framework-dependant. I really don’t recommend using such outdated versions though.

hi, im kinda new to ox_target/qtarget so i wanted to ask… if i can (and how) add police menu into this
Example :
identity card
body search
handcuff
hardcuff
uncuff
drag
put in vehicle / out the vehicle

Thanks for response :slight_smile:

image
I don’t understand why, but when I use ox_target all options are duplicated, in all scripts that use target, when I use qtarget this doesn’t happen, qtarget is “true” in my ox_inventory

Because qtarget would graciously replace other options with the same name when you spammed target creation; as a result people would register them on events, or even better, inside a iterator or while loop.

you are adding the model “printercc”… where is it defined ?

i know nothing about ox_target (i need to make the switch someday) but… you need to add ATM model somewhere… like…

local atm = { 506770882, -1364697528, -870868698, -1126237515 }
exports.ox_target:addModel(atm, {

Or i am completely wrong and loosing my time trying to help…

Can anyone help me i want a camp fire as target and then i want the option Cooking an then i want that the Cooking triggers a custom event

So registering them on events is a bad idea?

AddEventHandler('nozzleOnGround', function(droppedNozzle)

    exports.ox_target:addEntity(droppedNozzle,
    {
        icon = 'fa-solid fa-shower',
        event =  'pickUpNozzle',
        label = _U('pickup_nozzle'),
        groups = Config.AllowedJobs,
    })

end)

I have an entity that should be able to be picked up when it drops on the ground. But I want to pass it’s ID (droppedNozzle) along when it triggers the pickUpNozzle event. Is this possible?