qbcore-framework / qb-weapons

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

Remove weapons:server:UpdateWeaponAmmo to 0 #28

Closed Kollektiv00 closed 2 years ago

Kollektiv00 commented 3 years ago

TriggerServerEvent("weapons:server:UpdateWeaponAmmo", CurrentWeaponData, 0) This event inside the else statement sets weapon ammunition to 0 if the player is spamming between unarmed and a weapon. This is because the script will check for ammunition amount on unarmed as well as the weapon and has a tendency to get confused and then set your weapon ammo to 0 because your unarmed ammo returns 0.

Commenting this out will still check your weapon when it is out of ammo and prevent you from shooting; however, if won't cause your ammo to delete if you have ammo and then spam between armed and unarmed.

GhzGarage commented 3 years ago

Idk about this one. I have never been able to get this to happen even by constantly spamming the key to take out and put away a weapon

Kollektiv00 commented 3 years ago

https://streamable.com/wloesc - video without commented out line of code.

https://streamable.com/i2y81t - video with commented out line of code.

GhzGarage commented 3 years ago

Just had a dev team meme we attempt this without the commented code and could not replicate either. I’ll keep looking for others to test that I know are 100% up to date

Kollektiv00 commented 3 years ago

The version we're using is what was released with the additional attachments and skin painting.

The only additional info I can provide to try and repro is that you spam the item so it is pulling out and putting away and at the same time you left click which is thus triggering that event because it's trying to update the ammo count. The confusion comes because it picks up that you're unarmed with an ammo count of 0 and thus sets your weapon ammo to 0.

We use a holster animation script that creates a delay, but I did notice on the qb discord that some other people have had issues with disappearing ammo and from the testing that we did we found that this was the contributor.

Hope the above helps; otherwise, the PR is here for whoever has any similar issue.

ihyajb commented 3 years ago

I was able to replicate the issue after around 5ish mins of constant testing to I do find it rare that it happens. After commenting out the code and again constant testing I couldnt get the issue to happen. However I will keep testing