# qb-target

![image](https://user-images.githubusercontent.com/89563654/189980007-53a48b46-e5e1-43ed-b087-c70ead954fa7.png)

qb-target is a targeting solution that allows interaction with any predefined entity, model, entity type or polyzone. While activated you can easily and safely replace markers and distance checking, instead relying on intuitive design to improve player experiences and optimize interaction.

## Credits

- FJamZoo for the css, js and html (i just copied his edit of those to the updated target) his original: https://github.com/Renewed-Scripts/qb-target

* Lots of credits goes to [qtarget](https://github.com/overextended/qtarget) for rewriting all of bt-target to make it more optimized and this resource is pretty much a fork of it.

* Huge credit to [bt-target](https://github.com/brentN5/bt-target) from brentN5 for making the target a thing!

* Credit to [ms-peds](https://github.com/MiddleSkillz/ms-peds) for allowing me to use their awesome ped spawner inside the target!

## Dependency

* [PolyZone](https://github.com/mkafrin/PolyZone)

## Optional Dependency

* [QBCore](https://github.com/qbcore-framework/qb-core)

## Information

This repository was originally a direct fork and now it's own repository as it's basically qtarget but with lots of changes to it to make it better, most of the code comes from qtarget as I find their work awesome on this and what they've achieved with it.

You are free to help through Pull Requests and leave as much suggestions or issues, I love some help!

The TEMPLATES.md and EXAMPLES.md are always being improved and new examples can be made on request, just let me know!

## Features 
- Maintains compatibility with bt-target while providing improved utility and performance
- Optimised and improved raycasting function allows interaction with a wider range of entities
- Add generic options to apply for all players, peds, vehicles, or objects
- Trigger an event, function or command after clicking an option, with the ability to pass any data through
- Define distance on a per-option or overall basis when triggering a target option
- Ability to redefine or remove options and add new options without replacing old ones
- Update the option list when moving towards or away from a target with variable distances on their options
- Support for entity bones, with built-in tables for opening vehicle doors
- Support checking for job, gang, citizenid, items, or specific entities
- Utilise the `canInteract` function for advanced checks to show or hide an option based on any trigger
- Ped spawner to spawn peds and assign target options to them all in one place
