multitheftauto / mtasa-blue

Multi Theft Auto is a game engine that incorporates an extendable network play element into a proprietary commercial single-player game.
https://multitheftauto.com
GNU General Public License v3.0
1.3k stars 412 forks source link

Fix #539 Changing player position when he/she has a jetpack will remove the jetpack and bug when skin is changed #3511

Open FileEX opened 3 days ago

FileEX commented 3 days ago

Fixed #539

Jetpack is removed because the GTA function that is called CPed::Teleport aborts all tasks (including jetpack).

Then when changing the skin, the jetpack is set based on the m_bHasJetPack variable, which is true because its state is not changed when the position is changed, therefore the new skin gets the jetpack that was removed by GTA, but the MTA still knows that the player has the jetpack because he doesn't know that GTA removed it.

https://github.com/multitheftauto/mtasa-blue/blob/97920d83de400e0378f73ea93e87b27cf59dd758/Client/mods/deathmatch/logic/CClientPed.cpp#L5232

Therefore, we first check whether the player has a jetpack before changing position, and then set it after changing position depending on whether he had it before.

Fernando-A-Rocha commented 3 days ago

Good stuff

botder commented 2 days ago

The code looks fine, but I don't think we want to introduce desync (new client sees jetpack, older clients do not) right now

FileEX commented 2 days ago

The code looks fine, but I don't think we want to introduce desync (new client sees jetpack, older clients do not) right now

Will simply taking a jetpack when changing positions solve the problem?

botder commented 2 days ago

I would keep the jetpack on the player.

FileEX commented 2 days ago

I would keep the jetpack on the player.

So how can I solve the desync problem?