mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
fix(esx_property): Vehicle Duplication
This commit is contained in:
@@ -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 ={
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user