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

fix(SaveVehicle): updating top level fields when props are set #18

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,26 @@ local function buildSaveVehicleQuery(vehicleId, options)
if options.props then
crumbs[#crumbs+1] = 'mods = ?'
placeholders[#placeholders+1] = json.encode(options.props)

if options.props.plate then
crumbs[#crumbs+1] = 'plate = ?'
placeholders[#placeholders+1] = options.props.plate
end

if options.props.fuelLevel then
crumbs[#crumbs+1] = 'fuel = ?'
placeholders[#placeholders+1] = options.props.fuelLevel
end

if options.props.engineHealth then
crumbs[#crumbs+1] = 'engine = ?'
placeholders[#placeholders+1] = options.props.engineHealth
end

if options.props.bodyHealth then
crumbs[#crumbs+1] = 'body = ?'
placeholders[#placeholders+1] = options.props.bodyHealth
end
end

placeholders[#placeholders+1] = vehicleId
Expand Down