qbcore-framework / qb-weapons

Weapon Logic Script For QB-Core :gun:
GNU General Public License v3.0
28 stars 191 forks source link

Fix for Weapon Tints #158

Closed RayaanUddin closed 9 months ago

RayaanUddin commented 1 year ago

Changes made in qb-weapon allows the tint number to be saved in the database under the weapon items info in player inventory.

Changes made to client/main.lua:

Changes made to server/main.lua:

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.

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

Questions (please complete the following information):

RayaanUddin commented 1 year ago

Also Requires changes made to qb-inventory for weapon tints to work... Hi there, I have found a solution!!!


In qb-inventory > client > main.lua, Search for: RegisterNetEvent('inventory:client:UseWeapon', function(weaponData, shootbool) inside event, replace ...

else
        TriggerEvent('weapons:client:DrawWeapon', nil)
        TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
        local ammo = tonumber(weaponData.info.ammo) or 0

by ...

else
        TriggerEvent('weapons:client:DrawWeapon', nil)
        TriggerEvent('weapons:client:SetCurrentWeapon', weaponData, shootbool)
        local ammo = tonumber(weaponData.info.ammo) or 0
        local tint = tonumber(weaponData.info.tint) or 0

and replace ...

GiveWeaponToPed(ped, weaponHash, ammo, false, false)
        SetPedAmmo(ped, weaponHash, ammo)
        SetCurrentPedWeapon(ped, weaponHash, true)

by...

GiveWeaponToPed(ped, weaponHash, ammo, false, false)
        SetPedAmmo(ped, weaponHash, ammo)
        SetCurrentPedWeapon(ped, weaponHash, true)
        SetPedWeaponTintIndex(ped, weaponHash, tint)

Any help, ask me on discord RayaanUddin#6541.

github-actions[bot] commented 10 months ago

This PR has had 60 days of inactivity & will close within 7 days