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.4k stars 435 forks source link

getVehicleCompatibleUpgrades returns different value on serverside and clientside #2476

Open neku172 opened 2 years ago

neku172 commented 2 years ago

Describe the bug

Function getVehicleCompatibleUpgrades returns different values on server-side and client-side.

To reproduce

  1. Get in the vehicle (e.g. Bullet)
  2. Type "srun outputChatBox(inspect(getVehicleCompatibleUpgrades(me.vehicle)))"
  3. Type "crun outputChatBox(inspect(getVehicleCompatibleUpgrades(me.vehicle)))"
  4. Look at chat/console
  5. Results are different

Expected behaviour

Results should be the same on server and client

Screenshots

image

Version

Server: MTA:SA Server v1.5.9-release-21048 Client: Multi Theft Auto v1.5.9-release-21048

Additional context

Also, trying to upgrade 1164 in Elegy on server doesn't work, but on client everything works perfectly. image

Inder00 commented 2 years ago

That's encountered because server don't know which upgrades are allowed to your vehicle.

Inder00 commented 2 years ago

https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Client/mods/deathmatch/logic/CVehicleUpgrades.cpp#L449-L453 https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Server/mods/deathmatch/logic/CVehicleUpgrades.cpp#L87-L92 Invalid spoiler id on server-sided CVehicleUpgrades::IsUpgradeCompatible

Server-sided spoiler 1164 can be applied only to Uranus https://github.com/multitheftauto/mtasa-blue/blob/c58c3678f263d810f61eb5aecba48e6c4b4dce0c/Server/mods/deathmatch/logic/CVehicleUpgrades.cpp#L240-L242

Inder00 commented 2 years ago

List of supported upgrades on client-side is gathered from game itself. https://github.com/multitheftauto/mtasa-blue/blob/b2a625b100ff037908b002b586ca81692c24b2ae/Client/game_sa/CModelInfoSA.cpp#L1682-L1688

Inder00 commented 2 years ago

The only option to keep the same upgrade list both (client side & server side) is create list of available upgrades per each vehicle model (gathered from game itself).