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

Issue with GetVehicleModelNumberOfSeats #986

Open
darektion opened this issue Feb 10, 2024 · 3 comments
Open

Issue with GetVehicleModelNumberOfSeats #986

darektion opened this issue Feb 10, 2024 · 3 comments

Comments

@darektion
Copy link

darektion commented Feb 10, 2024

Details on replicating the bug:

  1. Spawn in kamacho.

  2. Call the GetVehicleModelNumberOfSeats(vehicleModel) function, where vehicleModel = GetHashKey('kamacho'), the value returned is 4 - correct.

  3. Despawn the vehicle.

  4. Redo step 2, the value returned is 2 - incorrect.

@4mmonium 4mmonium added needs validation This looks good, but needs additional confirmation of suggested change. and removed needs validation This looks good, but needs additional confirmation of suggested change. labels Feb 14, 2024
@MonsieurBibo
Copy link
Contributor

Just tested it, and I have the same result. However, testing with the neon gives me the correct result both times.

@AvarianKnight
Copy link
Collaborator

This seems like it would be somewhat expected behavior, if the model is in memory then it can get reliable information based on the actual model info, but if its not then it has to use the meta files which might be incorrect in some cases.

const model = GetHashKey('kamacho');

setImmediate(async () => {
  // will output 2, the model hasn't been loaded into memory
  console.log(GetVehicleModelNumberOfSeats(model)); 

  RequestModel(model)
  while (!HasModelLoaded(model)) {
    await Delay(0);
  }

  // will output 4, the model has been loaded into memory
  console.log(GetVehicleModelNumberOfSeats(model));
  SetModelAsNoLongerNeeded(model);

  while (HasModelLoaded(model)) {
    await Delay(0);
  }

  // will output 2, model is no longer in memory.
  console.log(GetVehicleModelNumberOfSeats(model));
})

@coalaura
Copy link
Contributor

coalaura commented Aug 28, 2024

If the model seat data is in memory, it returns the valid number of seats; otherwise it will fall back to the number of seats in the vehicle model's layout. Similar behavior to natives like GetModelDimensions which will also only work properly if the model is loaded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants