fix(esx_property): Vehicle Duplication

This commit is contained in:
Mycroft
2022-08-26 16:10:37 +01:00
parent 1b3cfc19ed
commit fec16e1b17
2 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -28,10 +28,10 @@ Config.Raiding = {
},
}
Config.Garage = {
Enabled = true, -- Enable/Disable Garage Default: true
OwnedVehiclesOnly = true, -- Only allow owned vehicles to be stored Default: true
MySQLquery = "UPDATE `owned_vehicles` SET `stored` = ? WHERE `plate` = ?" -- MySQL Query to store vehicles `?` = True/false, Vehicle Plate
}
Config.Logs ={
+5 -3
View File
@@ -851,6 +851,7 @@ ESX.RegisterServerCallback('esx_property:StoreVehicle', function(source, cb, Pro
vehicle = VehicleProperties}
cb(true)
end
MySQL.query(Config.Garage.MySQLquery, {1, VehicleProperties.plate}) -- Set vehicle as stored in MySQL
else
xPlayer.showNotification('Garage Not Enabled On This Property.', 'error')
cb(false)
@@ -1012,12 +1013,13 @@ RegisterNetEvent('esx_property:leave', function(PropertyId)
end)
RegisterNetEvent('esx_property:SetVehicleOut', function(PropertyId, VehIndex)
local source = source
local Property = Properties[PropertyId]
local xPlayer = ESX.GetPlayerFromId(source)
local VehicleData = Properties[PropertyId].garage.StoredVehicles[VehIndex]
local plate = VehicleData.vehicle.plate
table.remove(Properties[PropertyId].garage.StoredVehicles, VehIndex)
MySQL.query(Config.Garage.MySQLquery, {0, plate}) -- Set vehicle as no longer stored
end)
AddEventHandler('playerDropped', function()
local source = source
for PropertyId = 1, #Properties do