qbcore-framework / qb-vehiclekeys

Vehicle Keys System For QB-Core :key:
GNU General Public License v3.0
36 stars 225 forks source link

[BUG] Losing keys to current vehicle when restarting the script #225

Closed W0lv3sxD closed 1 year ago

W0lv3sxD commented 1 year ago

Describe the bug A clear and concise description of what the bug is. A stranger to qbcore should be able to read your bug report and understand how to reproduce it themselves and understand how the feature should work normally.

To Reproduce Steps to reproduce the behavior:

  1. Have a vehicle that is owned by you (you have keys to it)
  2. Restart the script
  3. Now you dont have keys to your current car anymrore

Expected behavior I expected that i can still open and close my owned vehicle as its supposed to.

Screenshots If applicable, add screenshots to help explain your problem.

Questions (please complete the following information):

Additional context Add any other context about the problem here.

Sharkiiie commented 1 year ago

This is expected behavior. When any script is restarted all of the variables will be reset. In this case, the client side KeysList table will be set back to an empty table.

W0lv3sxD commented 1 year ago

I need to save the keys of vehicles that are not in the garage. Im using the AdvancedParking script by Kiminaze which respawns the vehicles after server restart so that they are at the position where you left your car. When joining after server restart you cant unlock your own vehicle anymore.

Sharkiiie commented 1 year ago

This is not currently something QBCore has planned as a feature, and as I said is expected behavior.

I would suggest reaching out to the creator of that script for assistance. Either they will need to modify their script to add compatibility, or you will need to modify their script (if able), and / or vehiclekeys.

I would suggest on server restart saving all spawned vehicles information (plates and owners, at least), then when the player loads have the server send the keys to the player. Or something similar to that. I'm sure that's roughly how the script works already, so it shouldn't be entirely too difficult.

github-actions[bot] commented 1 year ago

This issue has had 60 days of inactivity & will close within 7 days