Guidance on Reloading QBCore

Was part of a community a while back. Essentially they used a system or altered some code that preventing the stacking of magazines for all weapons. From using generic PISTOL_AMMO on a pistol, they could reload the weapon and if they tried using the item again, it would tell them they reached max capacity.

I have looked pretty far and wide for a solution to allowing this to happen. The closest I have found was a script called r1_reload which did not satisfy our needs. It gave the player infinite ammunition upon reloading making it unusable.

If anyone has any guidance, this would be great!

2 Likes

QBCore comes with a script like that, when you have a weapon you need to use the ammo in your inventory, Would this help fix this issue?

1 Like

Hey @Csylord Thanks for your reply. I am fairly new to the whole development side of FiveM. I have been looking into the QB Weapons resource but only to ponder upon the add ammo bit

RegisterNetEvent(‘weapon:client:AddAmmo’, function(type, amount, itemData)

I just need some guidance on how to alter the code to allow me to block more than one mag. Ive been asking on the QBCore Discord for a few days now, no luck :frowning:

1 Like

Sorry, But are you able to explain the blocking of more than one mag? Do you mean to allow for fewer mags into one gun?

No problem. So imagine you are holding your pistol and have pistol ammo in your players inventory. Simply, depleting your magazine and then reloading with the item in your inventory.

QBCore defaults this to having the ability to use the pistol ammo item multiple times to keep reloading.

My question is, limiting your ammo to limit the reserve ammo to 0 and keeping the clip to 12, instead of having ammo stacking in the reserve.

I hope this clarifies my question.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.