-
Notifications
You must be signed in to change notification settings - Fork 990
Improve VehicleInfo Event Handling #1192
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
base: main
Are you sure you want to change the base?
Conversation
Improve VehicleInfo Event Handling with Fallbacks and Optional Key Check Description: This PR enhances the QBCore:Client:VehicleInfo event logic for improved compatibility and error safety: Added fallback method to retrieve the vehicle plate using QBCore.Functions.GetPlate() if not directly passed; Added support for checking if the player has vehicle keys only when qb-vehiclekeys is active; Defaulted hasKeys to true to avoid issues when the key system is not used; Cleaned up the logic for packaging and passing vehicle information. These changes make the system more robust and prevent crashes on servers not using qb-vehiclekeys.
Hello, thank you for your PR submission. Currently in the codebase, plate is never passed through the The code does require a plate for the key check, but for that we could avoid the check if a plate isn't present, similar to how the check is avoided if |
Vehiclekeys starting after qb-core, added GetResourceState == starting
added GetResourceState == starting, because qb-vehiclekeys starting after qb-core
added GetResourceState == starting
Optimized the `playerDropped` function in `qb-core/server/events.lua`: - Removed excessive debug `print` statements (e.g., nil ped, heading, generic warnings) - Retained only essential log messages: • Position save confirmation when player leaves • Final cleanup confirmation with player ID and name - Prevented unnecessary checks (e.g., checking Player after verifying QBCore.Players[src]) - Ensured only x, y, z are saved in the database (no invalid `w`/heading field) In-game testing: - Player coordinates are successfully saved to the database on disconnect (`position` field) - On reconnect, the player spawns at their last location (x, y, z) - Console logs now show only clear, concise messages without noise
clean up position saving and logging logic Optimized the `playerDropped` function in `qb-core/server/events.lua`: - Removed excessive debug `print` statements (e.g., nil ped, heading, generic warnings) - Retained only essential log messages: • Position save confirmation when player leaves • Final cleanup confirmation with player ID and name - Prevented unnecessary checks (e.g., checking Player after verifying QBCore.Players[src]) - Ensured only x, y, z are saved in the database (no invalid `w`/heading field) In-game testing: - Player coordinates are successfully saved to the database on disconnect (`position` field) - On reconnect, the player spawns at their last location (x, y, z) - Console logs now show only clear, concise messages without noise
Added the same leave logs for qb-logs:server:joinleave like in qb-multicharacter
added more joinleave logs info
Improve VehicleInfo Event Handling with Fallbacks and Optional Key Check
Description:
This PR enhances the QBCore:Client:VehicleInfo event logic for improved compatibility and error safety: Added fallback method to retrieve the vehicle plate using QBCore.Functions.GetPlate() if not directly passed; Added support for checking if the player has vehicle keys only when qb-vehiclekeys is active; Defaulted hasKeys to true to avoid issues when the key system is not used; Cleaned up the logic for packaging and passing vehicle information.
These changes make the system more robust and prevent crashes on servers not using qb-vehiclekeys.