qbcore-framework / qb-smallresources

A compilation of small resources combined into one
GNU General Public License v3.0
50 stars 348 forks source link

Add option to config to ignore weapons from disabling crosshair #329

Closed rxcf closed 1 year ago

rxcf commented 1 year ago

Describe Pull request First, make sure you've read and are following the contribution guidelines and style guide and your code reflects that. Write up a clear and concise description of what your pull request adds or fixes and if it's an added feature explain why you think it should be included in the core.

This pr adds option to config to ignore weapons by item name from disabling crosshair

If your PR is to fix an issue mention that issue here ...

Questions (please complete the following information):

IamCodyy commented 1 year ago

One issue I found: When you aim with a sniper, then swap to a pistol the reticle is still enabled.

allChuu commented 1 year ago

It misses some stuff - cause yes when you AIM with a sniper and switch to another weapon it get's back the GTA V default crosshair. and it stay stuck in this position.

You can reaim a sniper and stop it, pull away your gun and re take it the crosshair will still be there.

So something need to check that if the sniper weapon is desarmed the script pass to he isIgnore to default.

Like i'm bad a dev, but i guess if it exist in .LUA, it need the opposite of ==

 if currentWeaponHash == GetHashKey(ignoreWeapons[i]) then 
                isIgnored = true
            end

Or something need to trigger the check at some point, does a switch weapon exist in native FiveM?


After research - the function https://docs.fivem.net/natives/?_0xA21C51255B205245 (_IS_PED_SWAPPING_WEAPON) exist, so a check is possible to enable and disable this function, but i'm too bad in LUA to do it.