Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getVehicleCompatibleUpgrades returns different value on serverside and clientside #2476

Open
neku172 opened this issue Dec 23, 2021 · 4 comments · May be fixed by #3318
Open

getVehicleCompatibleUpgrades returns different value on serverside and clientside #2476

neku172 opened this issue Dec 23, 2021 · 4 comments · May be fixed by #3318
Labels
bug Something isn't working

Comments

@neku172
Copy link

neku172 commented Dec 23, 2021

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

@neku172 neku172 added the bug Something isn't working label Dec 23, 2021
@Inder00
Copy link
Contributor

Inder00 commented Dec 25, 2021

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

@Inder00
Copy link
Contributor

Inder00 commented Dec 25, 2021

}
if (us == 1000 || us == 1001 || us == 1002 || us == 1003 || us == 1014 || /* spoiler */
us == 1015 || us == 1016 || us == 1023 || us == 1049 || us == 1050 || us == 1058 || us == 1060 || us == 1138 || us == 1139 || us == 1146 ||
us == 1147 || us == 1158 || us == 1162 || us == 1163 || us == 1164)
{

if (us == 1000 || us == 1001 || us == 1002 || us == 1003 || us == 1014 || /* spoiler */
us == 1015 || us == 1016 || us == 1023 || us == 1049 || us == 1050 || us == 1058 || us == 1060 || us == 1138 || us == 1139 || us == 1146 ||
us == 1147 || us == 1158 || us == 1162 || us == 1163 || us == 116)
{
return true;
}

Invalid spoiler id on server-sided CVehicleUpgrades::IsUpgradeCompatible

Server-sided spoiler 1164 can be applied only to Uranus

case 558:
return (us == 1092 || us == 1089 || us == 1166 || us == 1165 || us == 1008 || us == 1009 || us == 1010 || us == 1168 || us == 1167 || us == 1088 ||
us == 1091 || us == 1164 || us == 1163 || us == 1094 || us == 1090 || us == 1095 || us == 1093);

@Inder00
Copy link
Contributor

Inder00 commented Dec 25, 2021

List of supported upgrades on client-side is gathered from game itself.

void CModelInfoSA::InitialiseSupportedUpgrades(RpClump* pClump)
{
m_ModelSupportedUpgrades.Reset();
RwFrame* pFrame = RpGetFrame(pClump);
RwSetSupportedUpgrades(pFrame, m_dwModelID);
m_ModelSupportedUpgrades.m_bInitialised = true;
}

@Inder00
Copy link
Contributor

Inder00 commented Dec 25, 2021

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants