PTPM / MTASA

PTPM for Multi Theft Auto: San Andreas
GNU General Public License v3.0
6 stars 2 forks source link

Player selected weapon not always synced correctly? #19

Closed anonymous-d0z42ujxuog5 closed 6 years ago

anonymous-d0z42ujxuog5 commented 7 years ago

Sometimes it looks like players are punching the air, while on their screen they are firing a gun. Would it be possible to make the sync better, like added an extra resource that'd be checking clientside what weapon a player is holding and syncing that to the server. It kinda happens like all the time, and it's hard to tell when it happens to yourself. Especially me because I'm swapping weapons like all the time.

Look at the stripper cop behind the counter, the one on my right: https://www.youtube.com/watch?v=QVPIVgQJDCc&feature=youtu.be&t=40s

anonymous-d0z42ujxuog5 commented 7 years ago

Under investigation.

anonymous-d0z42ujxuog5 commented 7 years ago

You know what, I think that client-server sync is fine. It occasionally logs a desync but it's mostly fixed within 10 seconds. It happens on round end a bunch, when the server is too busy probably to manage that type of sync. It would be good to analyze the server process during similar peaks and potentially lower some of the MTA server sync settings.

I now think that the desync occurs from client-to-client. Might I suggest a client-side script that detects if other nearby clients are punching the air, and log every instance of that on the server, and request peer-reviews from other nearby players to see if someone is actually punching the air or is wielding a weapon.

anonymous-d0z42ujxuog5 commented 7 years ago

Also reported on MTA https://bugs.mtasa.com/view.php?id=9482 Page contains a script to re-sync the weapon state. Could just run that and see if and how the problem persists.

Another guy writes:

I had this bug everytime I spawned a player immediately after he got killed with weapons in hand. Fixed it by triggering the weapon to server on first shot after weapon switch (clientsided onClientPlayerWeaponFire) and on weapon switch (clientsided) and giving it to him with 0 ammo.

anonymous-d0z42ujxuog5 commented 7 years ago

Implemented, need to see if it works in production. During test did not cause anything unexpected.