mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 02:08:55 +00:00
vehicle is saved each time you buy something (pressing enter)
This commit is contained in:
@@ -15,6 +15,7 @@ RegisterNetEvent('esx_lscustom:installMod')
|
||||
AddEventHandler('esx_lscustom:installMod', function()
|
||||
local vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false)
|
||||
myCar = ESX.Game.GetVehicleProperties(vehicle)
|
||||
TriggerServerEvent('esx_lscustom:refreshOwnedVehicle', myCar)
|
||||
end)
|
||||
|
||||
RegisterNetEvent('esx_lscustom:cancelInstallMod')
|
||||
|
||||
@@ -15,3 +15,14 @@ AddEventHandler('esx_lscustom:buyMod', function(price)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('purchased'))
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_lscustom:refreshOwnedVehicle')
|
||||
AddEventHandler('esx_lscustom:refreshOwnedVehicle', function(myCar)
|
||||
|
||||
MySQL.Async.execute(
|
||||
'UPDATE `owned_vehicles` SET `vehicle` = @vehicle WHERE `vehicle` LIKE "%' .. myCar['plate'] .. '%"',
|
||||
{
|
||||
['@vehicle'] = json.encode(myCar)
|
||||
}
|
||||
)
|
||||
end)
|
||||
Reference in New Issue
Block a user