mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
@@ -184,6 +184,39 @@ function OpenBoatGarage(garage)
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenLicenceMenu(shop)
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_license',
|
||||
{
|
||||
title = _U('license_menu'),
|
||||
align = 'top-left',
|
||||
elements = {
|
||||
{ label = _U('license_buy_no'), value = 'no' },
|
||||
{ label = _U('license_buy_yes', Config.LicensePrice), value = 'yes' }
|
||||
}
|
||||
}, function (data, menu)
|
||||
if data.current.value == 'yes' then
|
||||
ESX.TriggerServerCallback('esx_boat:buyBoatLicense', function (boughtLicense)
|
||||
if boughtLicense then
|
||||
ESX.ShowNotification(_U('license_bought', Config.LicensePrice))
|
||||
menu.close()
|
||||
|
||||
OpenBoatShop(shop) -- parse current shop
|
||||
else
|
||||
ESX.ShowNotification(_U('license_nomoney'))
|
||||
end
|
||||
end)
|
||||
else
|
||||
CurrentAction = 'boat_shop'
|
||||
CurrentActionMsg = _U('boat_shop_open')
|
||||
menu.close()
|
||||
end
|
||||
end, function (data, menu)
|
||||
CurrentAction = 'boat_shop'
|
||||
CurrentActionMsg = _U('boat_shop_open')
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
function StoreBoatInGarage(vehicle)
|
||||
|
||||
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
|
||||
|
||||
+16
-2
@@ -17,7 +17,21 @@ Citizen.CreateThread(function()
|
||||
if IsControlJustReleased(0, Keys['E']) then
|
||||
|
||||
if CurrentAction == 'boat_shop' then
|
||||
OpenBoatShop(Config.Zones.BoatShops[CurrentActionData.zoneNum])
|
||||
|
||||
if not Config.EnableLicense then
|
||||
OpenBoatShop(Config.Zones.BoatShops[CurrentActionData.zoneNum])
|
||||
else -- check for license
|
||||
|
||||
ESX.TriggerServerCallback('esx_license:checkLicense', function (hasBoatLicense)
|
||||
if hasBoatLicense then
|
||||
OpenBoatShop(Config.Zones.BoatShops[CurrentActionData.zoneNum])
|
||||
else
|
||||
OpenLicenceMenu(Config.Zones.BoatShops[CurrentActionData.zoneNum])
|
||||
end
|
||||
end, GetPlayerServerId(PlayerId()), 'boat')
|
||||
|
||||
end
|
||||
|
||||
elseif CurrentAction == 'garage_out' then
|
||||
OpenBoatGarage(Config.Zones.Garages[CurrentActionData.zoneNum])
|
||||
elseif CurrentAction == 'garage_in' then
|
||||
@@ -28,7 +42,7 @@ Citizen.CreateThread(function()
|
||||
|
||||
end
|
||||
else
|
||||
Citizen.Wait(200)
|
||||
Citizen.Wait(500)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user