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

Vehicle owner loses access to keys after sever restart(vehicles generated by other script) #154

Closed
Jerrys-C opened this issue Nov 10, 2024 · 3 comments
Labels
bug Something isn't working need repro This bug report needs confirmation

Comments

@Jerrys-C
Copy link

Summary

After the server restarts, vehicle owners no longer have keys to their vehicles

Reproduction

  1. Purchase a vehicle - the vehicle owner is set.
  2. The owner can successfully unlock the vehicle.
  3. After a server restart, the vehicle is regenerated by another plugin (persistent vehicles).
  4. The player cannot unlock the vehicle, even though they are the owner.

Expected behavior

After a server restart, the vehicle owner should retain access to the vehicle keys, allowing them to unlock and use their vehicle as expected.

Actual behavior

Following a server restart, the player who originally purchased the vehicle is unable to unlock it, despite being the owner. This issue arises because the vehicle regeneration by another script does not retain the owner status correctly.

Additional context

It would be beneficial to improve the logic for detecting the vehicle owner within this plugin, rather than relying solely on qbx_vehicles to set the owner state. This enhancement would help ensure consistent access for the vehicle owner, even if the owner state is not correctly set by external plugins during vehicle regeneration.

Current Version

v1.0.1

Custom Resources

AdvancedParking

@Jerrys-C Jerrys-C added bug Something isn't working need repro This bug report needs confirmation labels Nov 10, 2024
@qbox-duck qbox-duck bot added this to Issues Nov 10, 2024
@github-project-automation github-project-automation bot moved this to Todo in Issues Nov 10, 2024
@Manason
Copy link
Member

Manason commented Nov 10, 2024

Shouldn't the persistent vehicles carry over entity state?

Right now qbx_vehiclekeys makes the assumption of owner state bag being set. This does require other scripts to set vehicleid state bag if spawning a vehicle as vehicleid change handler will set the owner. If we don't make this assumption, it requires always calling back to the server and doing a database lookup to determine if the vehicle is owned.

While we have added support in other resources for vehicleid being optional, we do want to move towards a world where it is required. I'm not sure we want to make things worse for servers that handle this to help servers that do not.

@Jerrys-C
Copy link
Author

Shouldn't the persistent vehicles carry over entity state?

Right now qbx_vehiclekeys makes the assumption of owner state bag being set. This does require other scripts to set vehicleid state bag if spawning a vehicle as vehicleid change handler will set the owner. If we don't make this assumption, it requires always calling back to the server and doing a database lookup to determine if the vehicle is owned.

While we have added support in other resources for vehicleid being optional, we do want to move towards a world where it is required. I'm not sure we want to make things worse for servers that handle this to help servers that do not.

I completely agree that the best approach would be for the vehicle spawning script to set the state bag. However, considering that this will become a mandatory requirement, all vehicles that don’t set the state bag would fail to work. So, we can call this a secondary check. If no owner is found on the first query, a backup initialization query can be made. When creating this issue, I had also thought about this consideration—it seems it’s just a matter of whether compatibility is needed, and the decision is up to you.

@Manason
Copy link
Member

Manason commented Nov 10, 2024

I don't think we need to maintain backwards compatibility in this regard. In general for non qbx_core resources we don't maintain backwards compatibility as we want to move towards better approaches and not have to be stuck in the past.

@github-project-automation github-project-automation bot moved this from Todo to Done in Issues Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working need repro This bug report needs confirmation
Projects
Status: Done
Development

No branches or pull requests

2 participants