Skip to content

Conversation

@shadylua
Copy link
Contributor

@shadylua shadylua commented Sep 7, 2025

In the original code,
if (pPlayer->GetWeaponAmmoInClip(static_cast<unsigned char>(m_weapon)) == 0)

was checking the weapon’s clip ammo, but it always returned 0. Because of that, the function would return false and the event couldn’t communicate properly with the function it was supposed to trigger.

After changing it to check the total ammo instead, the issue was resolved.

and below you can see the results in the video clip :

axmal4.mp4

@shadylua shadylua changed the title Update CBulletsyncPacket.cpp Fix bullet synchronization by using total ammo instead of ammo in clip Sep 7, 2025
@PerikiyoXD
Copy link
Contributor

What happens if you empty the clip? Will it trigger damage?

@ArranTuna
Copy link
Collaborator

As this fixes a commit by Dutchman I've requested his review.

Dutchman101
Dutchman101 previously approved these changes Sep 8, 2025
@Dutchman101 Dutchman101 merged commit ca06762 into multitheftauto:master Sep 8, 2025
MTABot pushed a commit that referenced this pull request Sep 8, 2025
ca06762 Fix bullet synchronization by using total ammo instead of ammo in clip (#4430)
@ArranTuna ArranTuna mentioned this pull request Sep 8, 2025
1 task
@shadylua
Copy link
Contributor Author

shadylua commented Sep 8, 2025

im31age

It has been merged, but I think we need to refresh the code again. I just tested it and the serverside doesn't trigger onPlayerWeaponFire.

ima32ge

need :

#include "CWeaponNames.h"

// Check if weapon has ammo
const auto type = static_caststd::uint8_t(m_weapon);
const auto slot = CWeaponNames::GetSlotFromWeapon(type);
if (pPlayer->GetWeaponTotalAmmo(slot) <= 0)
return false;

@Dutchman101
Copy link
Member

@shadylua Please open a new PR for that

shadylua added a commit to shadylua/mtasa-blue that referenced this pull request Sep 8, 2025
@botder botder added this to the 1.7.1 milestone Sep 8, 2025
@botder botder added the bugfix Solution to a bug of any kind label Sep 8, 2025
MTABot pushed a commit that referenced this pull request Sep 10, 2025
ef96364 Fix bullet synchronization by using total ammo instead of ammo in clip (#4430)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants