-
Notifications
You must be signed in to change notification settings - Fork 384
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
Update vehicles.lua #592
base: main
Are you sure you want to change the base?
Update vehicles.lua #592
Conversation
Fix spaces in GetVehicleNumberPlateText
Can you give me reproducible steps to reproduce the issue you're referencing? I do see that whitespace padding is added, but it doesn't hinder basic functionality. I'd like to take a look at where the issue is occurring. I also see this being an issue elsewhere like garages, which would mean modifying it to handle trimming in those cases, similar to this PR. |
You can reproduce it by following steps:
Thats because it's trying to match stash- HD3333 with stash-HD3333 and thats never gonna be true so it won't show you the items. |
Yeah I think this is mainly an issue in cases where you're trying to add an item or get the stash. I checked the database, and it's not just the whitespace at the beginning it's also at the end which can cause more problems than expected in this case. If there's concerns about backwards compatibility with pre-existing custom plate stashes we can just sanitise on the way back from the database. |
@@ -36,7 +36,7 @@ QBCore.Functions.CreateClientCallback('qb-inventory:client:vehicleCheck', functi | |||
if inVehicle ~= 0 then | |||
local plate = GetVehicleNumberPlateText(inVehicle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try replacing this native with QBCore.Functions.GetPlate
@@ -53,7 +53,7 @@ QBCore.Functions.CreateClientCallback('qb-inventory:client:vehicleCheck', functi | |||
OpenTrunk(vehicle) | |||
local class = GetVehicleClass(vehicle) | |||
local plate = GetVehicleNumberPlateText(vehicle) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try replacing this native with QBCore.Functions.GetPlate
Fix spaces in GetVehicleNumberPlateText
Description
This fixes an issue with trunks.
When fetching with GetVehicleNumberPlateText it adds a space when the plate is shorter then 8 characters:
Added gsub to trim whitespaces out and the outcome is without spaces:
This will fix issues when adding items to trunk where it can't match the plate numbers because the actual plate is without spaces.
Checklist