feat(esx_vehicleshop): Serverside onesync spawning :)

This commit is contained in:
Mycroft
2022-09-16 22:07:27 +01:00
parent 1d54deaef3
commit 0909b45fcb
2 changed files with 7 additions and 10 deletions
+3 -9
View File
@@ -228,18 +228,12 @@ function OpenShopMenu()
menu2.close()
menu.close()
DeleteDisplayVehicleInsideShop()
ESX.Game.SpawnVehicle(vehicleData.model, Config.Zones.ShopOutside.Pos, Config.Zones.ShopOutside.Heading, function(vehicle)
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
SetVehicleNumberPlateText(vehicle, generatedPlate)
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
end)
FreezeEntityPosition(playerPed, false)
SetEntityVisible(playerPed, true)
else
ESX.ShowNotification(_U('not_enough_money'))
end
end, vehicleData.model, generatedPlate)
end, vehicleData.model, generatedPlate, IsThisModelACar(vehicleData.model))
end
else
menu2.close()
+4 -1
View File
@@ -162,7 +162,7 @@ ESX.RegisterServerCallback('esx_vehicleshop:getVehicles', function(source, cb)
cb(vehicles)
end)
ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, model, plate)
ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, model, plate, automobile)
local xPlayer = ESX.GetPlayerFromId(source)
local modelPrice = getVehicleFromModel(model).price
@@ -172,6 +172,9 @@ ESX.RegisterServerCallback('esx_vehicleshop:buyVehicle', function(source, cb, mo
MySQL.insert('INSERT INTO owned_vehicles (owner, plate, vehicle) VALUES (?, ?, ?)', {xPlayer.identifier, plate, json.encode({model = joaat(model), plate = plate})
}, function(rowsChanged)
xPlayer.showNotification(_U('vehicle_belongs', plate))
ESX.OneSync.SpawnVehicle(joaat(model), Config.Zones.VehicleSpawnPoint.Pos, Config.Zones.VehicleSpawnPoint.Heading, automobile,{plate = plate}, function(vehicle)
TaskWarpPedIntoVehicle(GetPlayerPed(source), vehicle, -1)
end)
cb(true)
end)
else