vehicle is saved each time you buy something (pressing enter)

This commit is contained in:
renaiku
2017-08-30 13:18:23 +02:00
parent a2e53dd64e
commit 04eda37597
2 changed files with 12 additions and 0 deletions
+1
View File
@@ -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')
+11
View File
@@ -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)