diff --git a/[esx_addons]/esx_boat/client/main.lua b/[esx_addons]/esx_boat/client/main.lua
index d4e6440c..1a9cd519 100644
--- a/[esx_addons]/esx_boat/client/main.lua
+++ b/[esx_addons]/esx_boat/client/main.lua
@@ -5,97 +5,96 @@ function OpenBoatShop(shop)
isInShopMenu = true
local playerPed = PlayerPedId()
- local elements = {}
+ local elements = {
+ {unselectable = true, icon = "fas fa-ship", title = TranslateCap('boat_shop')}
+ }
for k,v in ipairs(Config.Vehicles) do
- table.insert(elements, {
- label = ('%s - $%s'):format(v.label, ESX.Math.GroupDigits(v.price)),
+ elements[#elements+1] = {
+ icon = "fas fa-ship",
+ title = ('%s - $%s'):format(v.label, ESX.Math.GroupDigits(v.price)),
name = v.label,
model = v.model,
price = v.price,
props = v.props or nil
- })
+ }
end
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop', {
- title = TranslateCap('boat_shop'),
- align = 'top-left',
- elements = elements
- }, function (data, menu)
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop_confirm', {
- title = TranslateCap('boat_shop_confirm', data.current.name, ESX.Math.GroupDigits(data.current.price)),
- align = 'top-left',
- elements = {
- {label = TranslateCap('confirm_no'), value = 'no'},
- {label = TranslateCap('confirm_yes'), value = 'yes'}
- }}, function (data2, menu2)
- if data2.current.value == 'yes' then
- local plate = exports['esx_vehicleshop']:GeneratePlate()
- local vehicle = GetVehiclePedIsIn(playerPed, false)
- local props = ESX.Game.GetVehicleProperties(vehicle)
- props.plate = plate
+ ESX.OpenContext("right", elements, function(menu,element)
+ local elements2 = {
+ {unselectable = true, icon = "fas fa-ship", title = element.title},
+ {icon = "fas fa-eye", title = "View", val = "view"}
+ }
- ESX.TriggerServerCallback('esx_boat:buyBoat', function(bought)
- if bought then
- ESX.ShowNotification(TranslateCap('boat_shop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price)))
+ ESX.OpenContext("right", elements2, function(menu2,element2)
+ if element2.val == "view" then
+ DeleteSpawnedVehicles()
- DeleteSpawnedVehicles()
- isInShopMenu = false
- ESX.UI.Menu.CloseAll()
+ ESX.Game.SpawnLocalVehicle(element.model, shop.Inside, shop.Inside.w, function (vehicle)
+ table.insert(spawnedVehicles, vehicle)
+ TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
+ FreezeEntityPosition(vehicle, true)
- CurrentAction = 'boat_shop'
- CurrentActionMsg = TranslateCap('boat_shop_open')
-
- FreezeEntityPosition(playerPed, false)
- SetEntityVisible(playerPed, true)
- SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
- else
- ESX.ShowNotification(TranslateCap('boat_shop_nomoney'))
- menu2.close()
+ if element.props then
+ ESX.Game.SetVehicleProperties(vehicle, element.props)
end
- end, props)
- else
- menu2.close()
- end
- end, function (data2, menu2)
- menu2.close()
- end)
- end, function (data, menu)
- menu.close()
- isInShopMenu = false
- DeleteSpawnedVehicles()
+ local elements3 = {
+ {unselectable = true, icon = "fas fa-ship", title = element.title},
+ {icon = "fas fa-check-double", title = "Buy", value = "buy"},
+ {icon = "fas fa-eye", title = "Stop Viewing", value = "stop"}
+ }
+
+ ESX.OpenContext("right", elements3, function(menu3,element3)
+ if element3.value == "buy" then
+ local plate = exports['esx_vehicleshop']:GeneratePlate()
+ local vehicle = GetVehiclePedIsIn(playerPed, false)
+ local props = ESX.Game.GetVehicleProperties(vehicle)
+ props.plate = plate
+
+ ESX.TriggerServerCallback('esx_boat:buyBoat', function(bought)
+ if bought then
+ ESX.ShowNotification(TranslateCap('boat_shop_bought', element.name, ESX.Math.GroupDigits(element.price)))
+
+ DeleteSpawnedVehicles()
+ isInShopMenu = false
+ ESX.CloseContext()
+
+ CurrentAction = 'boat_shop'
+ CurrentActionMsg = TranslateCap('boat_shop_open')
+
+ FreezeEntityPosition(playerPed, false)
+ SetEntityVisible(playerPed, true)
+ SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
+ else
+ ESX.ShowNotification(TranslateCap('boat_shop_nomoney'))
+ ESX.CloseContext()
+ end
+ end, props)
+ elseif element3.value == "stop" then
+ isInShopMenu = false
+ DeleteSpawnedVehicles()
+
+ CurrentAction = 'boat_shop'
+ CurrentActionMsg = TranslateCap('boat_shop_open')
+
+ FreezeEntityPosition(playerPed, false)
+ SetEntityVisible(playerPed, true)
+ SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
+ ESX.CloseContext()
+ end
+ end)
+ end)
+ end
+ end, function(menu)
+ isInShopMenu = false
+ CurrentAction = 'boat_shop'
+ CurrentActionMsg = TranslateCap('boat_shop_open')
+ end)
+ end, function(menu)
+ isInShopMenu = false
CurrentAction = 'boat_shop'
CurrentActionMsg = TranslateCap('boat_shop_open')
-
- FreezeEntityPosition(playerPed, false)
- SetEntityVisible(playerPed, true)
- SetEntityCoords(playerPed, shop.Outside.x, shop.Outside.y, shop.Outside.z)
- end, function (data, menu)
- DeleteSpawnedVehicles()
-
- ESX.Game.SpawnLocalVehicle(data.current.model, shop.Inside, shop.Inside.w, function (vehicle)
- table.insert(spawnedVehicles, vehicle)
- TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
- FreezeEntityPosition(vehicle, true)
-
- if data.current.props then
- ESX.Game.SetVehicleProperties(vehicle, data.current.props)
- end
- end)
- end)
-
- -- spawn first vehicle
- DeleteSpawnedVehicles()
-
- ESX.Game.SpawnLocalVehicle(Config.Vehicles[1].model, shop.Inside, shop.Inside.w, function (vehicle)
- table.insert(spawnedVehicles, vehicle)
- TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
- FreezeEntityPosition(vehicle, true)
-
- if Config.Vehicles[1].props then
- ESX.Game.SetVehicleProperties(vehicle, Config.Vehicles[1].props)
- end
end)
end
@@ -105,24 +104,22 @@ function OpenBoatGarage(garage)
ESX.ShowNotification(TranslateCap('garage_noboats'))
else
-- get all available boats
- local elements = {}
+ local elements = {
+ {unselectable = true, icon = "fas fa-ship", title = TranslateCap('garage')}
+ }
for i=1, #ownedBoats, 1 do
ownedBoats[i] = json.decode(ownedBoats[i])
- table.insert(elements, {
- label = getVehicleLabelFromHash(ownedBoats[i].model),
+ elements[#elements+1] = {
+ icon = "fas fa-ship",
+ title = getVehicleLabelFromHash(ownedBoats[i].model),
vehicleProps = ownedBoats[i]
- })
+ }
end
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_garage', {
- title = TranslateCap('garage'),
- align = 'top-left',
- elements = elements
- }, function (data, menu)
- -- make sure the spawn point isn't blocked
+ ESX.OpenContext("right", elements, function(menu,element)
local playerPed = PlayerPedId()
- local vehicleProps = data.current.vehicleProps
+ local vehicleProps = element.vehicleProps
if ESX.Game.IsSpawnPointClear(garage.SpawnPoint, 4.0) then
TriggerServerEvent('esx_boat:takeOutVehicle', vehicleProps.plate)
@@ -133,13 +130,11 @@ function OpenBoatGarage(garage)
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
end)
- menu.close()
+ ESX.CloseContext()
else
ESX.ShowNotification(TranslateCap('garage_blocked'))
end
- end, function (data, menu)
- menu.close()
-
+ end, function(menu)
CurrentAction = 'garage_out'
CurrentActionMsg = TranslateCap('garage_open')
end)
@@ -148,33 +143,36 @@ function OpenBoatGarage(garage)
end
function OpenLicenceMenu(shop)
- ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_license', {
- title = TranslateCap('license_menu'),
- align = 'top-left',
- elements = {
- {label = TranslateCap('license_buy_no'), value = 'no'},
- {label = TranslateCap('license_buy_yes', ESX.Math.GroupDigits(Config.LicensePrice)), value = 'yes'}
- }}, function (data, menu)
- if data.current.value == 'yes' then
+ local elements = {
+ {unselectable = true, icon = "fas fa-ship", title = TranslateCap('license_menu')},
+ {icon = "fas fa-ship", title = "Purchase Boat License"}
+ }
+
+ ESX.OpenContext("right", elements, function(menu,element)
+ local elements2 = {
+ {unselectable = true, icon = "fas fa-ship", title = element.title},
+ {icon = "fas fa-check-double", title = TranslateCap('license_buy_yes'), val = "yes"},
+ {icon = "fas fa-window-close", title = TranslateCap('license_buy_no'), val = "no"}
+ }
+
+ ESX.OpenContext("right", elements2, function(menu2,element2)
ESX.TriggerServerCallback('esx_boat:buyBoatLicense', function (boughtLicense)
if boughtLicense then
ESX.ShowNotification(TranslateCap('license_bought', ESX.Math.GroupDigits(Config.LicensePrice)))
- menu.close()
+ ESX.CloseContext()
OpenBoatShop(shop) -- parse current shop
else
ESX.ShowNotification(TranslateCap('license_nomoney'))
end
end)
- else
- CurrentAction = 'boat_shop'
+ end, function(menu)
+ CurrentAction = 'boat_shop'
CurrentActionMsg = TranslateCap('boat_shop_open')
- menu.close()
- end
- end, function (data, menu)
- CurrentAction = 'boat_shop'
+ end)
+ end, function(menu)
+ CurrentAction = 'boat_shop'
CurrentActionMsg = TranslateCap('boat_shop_open')
- menu.close()
end)
end