mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
@@ -11,63 +11,59 @@ end)
|
|||||||
|
|
||||||
|
|
||||||
function OpenAmbulanceActionsMenu()
|
function OpenAmbulanceActionsMenu()
|
||||||
local elements = {{label = TranslateCap('cloakroom'), value = 'cloakroom'}}
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-shirt", title = "Ambulance Actions"},
|
||||||
|
{icon = "fas fa-shirt", title = TranslateCap('cloakroom'), value = 'cloakroom'}
|
||||||
|
}
|
||||||
|
|
||||||
if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then
|
if Config.EnablePlayerManagement and ESX.PlayerData.job.grade_name == 'boss' then
|
||||||
table.insert(elements, {label = TranslateCap('boss_actions'), value = 'boss_actions'})
|
elements[#elements+1] = {
|
||||||
|
icon = "fas fa-ambulance",
|
||||||
|
title = TranslateCap('boss_actions'),
|
||||||
|
value = 'boss_actions'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
if element.value == 'cloakroom' then
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'ambulance_actions', {
|
|
||||||
title = TranslateCap('ambulance'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
if data.current.value == 'cloakroom' then
|
|
||||||
OpenCloakroomMenu()
|
OpenCloakroomMenu()
|
||||||
elseif data.current.value == 'boss_actions' then
|
elseif element.value == 'boss_actions' then
|
||||||
TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu)
|
TriggerEvent('esx_society:openBossMenu', 'ambulance', function(data, menu)
|
||||||
menu.close()
|
menu.close()
|
||||||
end, {wash = false})
|
end, {wash = false})
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpenMobileAmbulanceActionsMenu()
|
function OpenMobileAmbulanceActionsMenu()
|
||||||
ESX.UI.Menu.CloseAll()
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-ambulance", title = TranslateCap('ambulance')},
|
||||||
|
{icon = "fas fa-ambulance", title = TranslateCap('ems_menu'), value = "citizen_interaction"}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_ambulance_actions', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('ambulance'),
|
if element.value == "citizen_interaction" then
|
||||||
align = 'top-left',
|
local elements2 = {
|
||||||
elements = {
|
{unselectable = true, icon = "fas fa-ambulance", title = element.title},
|
||||||
{label = TranslateCap('ems_menu'), value = 'citizen_interaction'}
|
{icon = "fas fa-syringe", title = TranslateCap('ems_menu_revive'), value = "revive"},
|
||||||
}}, function(data, menu)
|
{icon = "fas fa-bandage", title = TranslateCap('ems_menu_small'), value = "small"},
|
||||||
if data.current.value == 'citizen_interaction' then
|
{icon = "fas fa-bandage", title = TranslateCap('ems_menu_big'), value = "big"},
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'citizen_interaction', {
|
{icon = "fas fa-car", title = TranslateCap('ems_menu_putincar'), value = "put_in_vehicle"},
|
||||||
title = TranslateCap('ems_menu_title'),
|
{icon = "fas fa-syringe", title = TranslateCap('ems_menu_search'), value = "search"},
|
||||||
align = 'top-left',
|
}
|
||||||
elements = {
|
|
||||||
{label = TranslateCap('ems_menu_revive'), value = 'revive'},
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
{label = TranslateCap('ems_menu_small'), value = 'small'},
|
|
||||||
{label = TranslateCap('ems_menu_big'), value = 'big'},
|
|
||||||
{label = TranslateCap('ems_menu_putincar'), value = 'put_in_vehicle'},
|
|
||||||
{label = TranslateCap('ems_menu_search'), value = 'search'}
|
|
||||||
}}, function(data, menu)
|
|
||||||
if isBusy then return end
|
if isBusy then return end
|
||||||
|
|
||||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||||
|
|
||||||
if data.current.value == 'search' then
|
if element2.value == 'search' then
|
||||||
TriggerServerEvent('esx_ambulancejob:svsearch')
|
TriggerServerEvent('esx_ambulancejob:svsearch')
|
||||||
elseif closestPlayer == -1 or closestDistance > 1.0 then
|
elseif closestPlayer == -1 or closestDistance > 1.0 then
|
||||||
ESX.ShowNotification(TranslateCap('no_players'))
|
ESX.ShowNotification(TranslateCap('no_players'))
|
||||||
else
|
else
|
||||||
if data.current.value == 'revive' then
|
if element2.value == 'revive' then
|
||||||
revivePlayer(closestPlayer)
|
revivePlayer(closestPlayer)
|
||||||
elseif data.current.value == 'small' then
|
elseif element2.value == 'small' then
|
||||||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
||||||
if quantity > 0 then
|
if quantity > 0 then
|
||||||
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
||||||
@@ -94,8 +90,7 @@ function OpenMobileAmbulanceActionsMenu()
|
|||||||
end
|
end
|
||||||
end, 'bandage')
|
end, 'bandage')
|
||||||
|
|
||||||
elseif data.current.value == 'big' then
|
elseif element2.value == 'big' then
|
||||||
|
|
||||||
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
ESX.TriggerServerCallback('esx_ambulancejob:getItemAmount', function(quantity)
|
||||||
if quantity > 0 then
|
if quantity > 0 then
|
||||||
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
local closestPlayerPed = GetPlayerPed(closestPlayer)
|
||||||
@@ -121,18 +116,12 @@ function OpenMobileAmbulanceActionsMenu()
|
|||||||
ESX.ShowNotification(TranslateCap('not_enough_medikit'))
|
ESX.ShowNotification(TranslateCap('not_enough_medikit'))
|
||||||
end
|
end
|
||||||
end, 'medikit')
|
end, 'medikit')
|
||||||
|
elseif element2.value == 'put_in_vehicle' then
|
||||||
elseif data.current.value == 'put_in_vehicle' then
|
|
||||||
TriggerServerEvent('esx_ambulancejob:putInVehicle', GetPlayerServerId(closestPlayer))
|
TriggerServerEvent('esx_ambulancejob:putInVehicle', GetPlayerServerId(closestPlayer))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -328,7 +317,7 @@ end)
|
|||||||
|
|
||||||
AddEventHandler('esx_ambulancejob:hasExitedMarker', function(hospital, part, partNum)
|
AddEventHandler('esx_ambulancejob:hasExitedMarker', function(hospital, part, partNum)
|
||||||
if not isInShopMenu then
|
if not isInShopMenu then
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
end
|
end
|
||||||
ESX.HideUI()
|
ESX.HideUI()
|
||||||
CurrentAction = nil
|
CurrentAction = nil
|
||||||
@@ -411,14 +400,14 @@ AddEventHandler('esx_ambulancejob:putInVehicle', function()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function OpenCloakroomMenu()
|
function OpenCloakroomMenu()
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom', {
|
local elements = {
|
||||||
title = TranslateCap('cloakroom'),
|
{unselectable = true, icon = "fas fa-shirt", title = TranslateCap('cloakroom')},
|
||||||
align = 'top-left',
|
{icon = "fas fa-shirt", title = TranslateCap('ems_clothes_civil'), value = "citizen_wear"},
|
||||||
elements = {
|
{icon = "fas fa-shirt", title = TranslateCap('ems_clothes_ems'), value = "ambulance_wear"},
|
||||||
{label = TranslateCap('ems_clothes_civil'), value = 'citizen_wear'},
|
}
|
||||||
{label = TranslateCap('ems_clothes_ems'), value = 'ambulance_wear'},
|
|
||||||
}}, function(data, menu)
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
if data.current.value == 'citizen_wear' then
|
if element.value == "citizen_wear" then
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
TriggerEvent('skinchanger:loadSkin', skin)
|
TriggerEvent('skinchanger:loadSkin', skin)
|
||||||
isOnDuty = false
|
isOnDuty = false
|
||||||
@@ -432,7 +421,7 @@ function OpenCloakroomMenu()
|
|||||||
print("[^2INFO^7] Off Duty")
|
print("[^2INFO^7] Off Duty")
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
elseif data.current.value == 'ambulance_wear' then
|
elseif element.value == "ambulance_wear" then
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
if skin.sex == 0 then
|
if skin.sex == 0 then
|
||||||
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
|
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
|
||||||
@@ -450,29 +439,38 @@ function OpenCloakroomMenu()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.close()
|
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpenPharmacyMenu()
|
function OpenPharmacyMenu()
|
||||||
ESX.UI.Menu.CloseAll()
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-pills", title = TranslateCap('pharmacy_menu_title')}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'pharmacy', {
|
for k,v in pairs(Config.PharmacyItems) do
|
||||||
title = TranslateCap('pharmacy_menu_title'),
|
elements[#elements+1] = {
|
||||||
align = 'top-left',
|
icon = "fas fa-pills",
|
||||||
elements = {
|
title = v.title,
|
||||||
{label = TranslateCap('pharmacy_take', TranslateCap('medikit')), item = 'medikit', type = 'slider', value = 1, min = 1, max = 100},
|
item = v.item
|
||||||
{label = TranslateCap('pharmacy_take', TranslateCap('bandage')), item = 'bandage', type = 'slider', value = 1, min = 1, max = 100}
|
}
|
||||||
}}, function(data, menu)
|
end
|
||||||
if Config.Debug then
|
|
||||||
print("[^2INFO^7] Attempting to Give Item - ^5" .. tostring(data.current.item) .. "^7")
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
end
|
local elements2 = {
|
||||||
TriggerServerEvent('esx_ambulancejob:giveItem', data.current.item, data.current.value)
|
{unselectable = true, icon = "fas fa-pills", title = element.title},
|
||||||
end, function(data, menu)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 100, inputPlaceholder = "Amount to buy.."},
|
||||||
menu.close()
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local amount = menu2.eles[2].inputValue
|
||||||
|
if Config.Debug then
|
||||||
|
print("[^2INFO^7] Attempting to Give Item - ^5" .. tostring(element.item) .. "^7")
|
||||||
|
end
|
||||||
|
TriggerServerEvent('esx_ambulancejob:giveItem', element.item, amount)
|
||||||
|
end, function(menu)
|
||||||
|
OpenPharmacyMenu()
|
||||||
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ end)
|
|||||||
|
|
||||||
function OnPlayerDeath()
|
function OnPlayerDeath()
|
||||||
isDead = true
|
isDead = true
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
ClearTimecycleModifier()
|
ClearTimecycleModifier()
|
||||||
SetTimecycleModifier("REDMIST_blend")
|
SetTimecycleModifier("REDMIST_blend")
|
||||||
SetTimecycleModifierStrength(0.7)
|
SetTimecycleModifierStrength(0.7)
|
||||||
@@ -115,7 +115,7 @@ end
|
|||||||
|
|
||||||
RegisterNetEvent('esx_ambulancejob:useItem')
|
RegisterNetEvent('esx_ambulancejob:useItem')
|
||||||
AddEventHandler('esx_ambulancejob:useItem', function(itemName)
|
AddEventHandler('esx_ambulancejob:useItem', function(itemName)
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
|
|
||||||
if itemName == 'medikit' then
|
if itemName == 'medikit' then
|
||||||
local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations
|
local lib, anim = 'anim@heists@narcotics@funding@gang_idle', 'gang_chatting_idle01' -- TODO better animations
|
||||||
|
|||||||
@@ -2,16 +2,15 @@ local spawnedVehicles = {}
|
|||||||
|
|
||||||
function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
||||||
local playerCoords = GetEntityCoords(PlayerPedId())
|
local playerCoords = GetEntityCoords(PlayerPedId())
|
||||||
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-car", title = TranslateCap('garage_title')},
|
||||||
|
{icon = "fas fa-car", title = TranslateCap('garage_storeditem'), action = 'garage'},
|
||||||
|
{icon = "fas fa-car", title = TranslateCap('garage_storeitem'), action = 'store_garage'},
|
||||||
|
{icon = "fas fa-car", title = TranslateCap('garage_buyitem'), action = 'buy_vehicle'}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('garage_title'),
|
if element.action == "buy_vehicle" then
|
||||||
align = 'top-left',
|
|
||||||
elements = {
|
|
||||||
{label = TranslateCap('garage_storeditem'), action = 'garage'},
|
|
||||||
{label = TranslateCap('garage_storeitem'), action = 'store_garage'},
|
|
||||||
{label = TranslateCap('garage_buyitem'), action = 'buy_vehicle'}
|
|
||||||
}}, function(data, menu)
|
|
||||||
if data.current.action == 'buy_vehicle' then
|
|
||||||
local shopElements = {}
|
local shopElements = {}
|
||||||
local authorizedVehicles = Config.AuthorizedVehicles[type][ESX.PlayerData.job.grade_name]
|
local authorizedVehicles = Config.AuthorizedVehicles[type][ESX.PlayerData.job.grade_name]
|
||||||
local shopCoords = Config.Hospitals[hospital][part][partNum].InsideShop
|
local shopCoords = Config.Hospitals[hospital][part][partNum].InsideShop
|
||||||
@@ -21,23 +20,30 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
if IsModelInCdimage(vehicle.model) then
|
if IsModelInCdimage(vehicle.model) then
|
||||||
local vehicleLabel = GetLabelText(GetDisplayNameFromVehicleModel(vehicle.model))
|
local vehicleLabel = GetLabelText(GetDisplayNameFromVehicleModel(vehicle.model))
|
||||||
|
|
||||||
table.insert(shopElements, {
|
shopElements[#shopElements+1] = {
|
||||||
label = ('%s - <span style="color:green;">%s</span>'):format(vehicleLabel, TranslateCap('shop_item', ESX.Math.GroupDigits(vehicle.price))),
|
icon = 'fas fa-car',
|
||||||
|
title = ('%s - <span style="color:green;">%s</span>'):format(vehicleLabel, TranslateCap('shop_item', ESX.Math.GroupDigits(vehicle.price))),
|
||||||
name = vehicleLabel,
|
name = vehicleLabel,
|
||||||
model = vehicle.model,
|
model = vehicle.model,
|
||||||
price = vehicle.price,
|
price = vehicle.price,
|
||||||
props = vehicle.props,
|
props = vehicle.props,
|
||||||
type = type
|
type = type
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #shopElements > 0 then
|
if #shopElements > 0 then
|
||||||
OpenShopMenu(shopElements, playerCoords, shopCoords)
|
OpenShopMenu(shopElements, playerCoords, shopCoords)
|
||||||
|
else
|
||||||
|
ESX.ShowNotification(TranslateCap('garage_notauthorized'))
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
ESX.ShowNotification(TranslateCap('garage_notauthorized'))
|
||||||
end
|
end
|
||||||
elseif data.current.action == 'garage' then
|
elseif element.action == "garage" then
|
||||||
local garage = {}
|
local garage = {
|
||||||
|
{unselectable = true, icon = "fas fa-car", title = "Garage"}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles)
|
ESX.TriggerServerCallback('esx_vehicleshop:retrieveJobVehicles', function(jobVehicles)
|
||||||
if #jobVehicles > 0 then
|
if #jobVehicles > 0 then
|
||||||
@@ -56,42 +62,37 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
label = label .. ('<span style="color:darkred;">%s</span>'):format(TranslateCap('garage_notstored'))
|
label = label .. ('<span style="color:darkred;">%s</span>'):format(TranslateCap('garage_notstored'))
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(garage, {
|
garage[#garage+1] = {
|
||||||
label = label,
|
icon = 'fas fa-car',
|
||||||
|
title = label,
|
||||||
stored = v.stored,
|
stored = v.stored,
|
||||||
model = props.model,
|
model = props.model,
|
||||||
plate = props.plate
|
plate = props.plate
|
||||||
})
|
}
|
||||||
|
|
||||||
allVehicleProps[props.plate] = props
|
allVehicleProps[props.plate] = props
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if #garage > 0 then
|
if #garage > 0 then
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_garage', {
|
ESX.OpenContext("right", garage, function(menuG,elementG)
|
||||||
title = TranslateCap('garage_title'),
|
if elementG.stored == 1 then
|
||||||
align = 'top-left',
|
|
||||||
elements = garage
|
|
||||||
}, function(data2, menu2)
|
|
||||||
if data2.current.stored == 1 then
|
|
||||||
local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, part, partNum)
|
local foundSpawn, spawnPoint = GetAvailableVehicleSpawnPoint(hospital, part, partNum)
|
||||||
|
|
||||||
if foundSpawn then
|
if foundSpawn then
|
||||||
menu2.close()
|
ESX.CloseContext()
|
||||||
|
|
||||||
ESX.Game.SpawnVehicle(data2.current.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
|
ESX.Game.SpawnVehicle(elementG.model, spawnPoint.coords, spawnPoint.heading, function(vehicle)
|
||||||
local vehicleProps = allVehicleProps[data2.current.plate]
|
local vehicleProps = allVehicleProps[elementG.plate]
|
||||||
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
||||||
|
|
||||||
TriggerServerEvent('esx_vehicleshop:setJobVehicleState', data2.current.plate, false)
|
TriggerServerEvent('esx_vehicleshop:setJobVehicleState', elementG.plate, false)
|
||||||
ESX.ShowNotification(TranslateCap('garage_released'))
|
ESX.ShowNotification(TranslateCap('garage_released'))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('garage_notavailable'))
|
ESX.ShowNotification(TranslateCap('garage_notavailable'))
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('garage_empty'))
|
ESX.ShowNotification(TranslateCap('garage_empty'))
|
||||||
@@ -100,11 +101,9 @@ function OpenVehicleSpawnerMenu(type, hospital, part, partNum)
|
|||||||
ESX.ShowNotification(TranslateCap('garage_empty'))
|
ESX.ShowNotification(TranslateCap('garage_empty'))
|
||||||
end
|
end
|
||||||
end, type)
|
end, type)
|
||||||
elseif data.current.action == 'store_garage' then
|
elseif element.action == "store_garage" then
|
||||||
StoreNearbyVehicle(playerCoords)
|
StoreNearbyVehicle(playerCoords)
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -198,84 +197,71 @@ end
|
|||||||
function OpenShopMenu(elements, restoreCoords, shopCoords)
|
function OpenShopMenu(elements, restoreCoords, shopCoords)
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
isInShopMenu = true
|
isInShopMenu = true
|
||||||
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
local elements2 = {
|
||||||
|
{unselectable = true, icon = "fas fa-car", title = element.title},
|
||||||
|
{icon = "fas fa-eye", title = "View", value = "view"}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop', {
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
title = TranslateCap('vehicleshop_title'),
|
if element2.value == "view" then
|
||||||
align = 'top-left',
|
DeleteSpawnedVehicles()
|
||||||
elements = elements
|
WaitForVehicleToLoad(element.model)
|
||||||
}, function(data, menu)
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_shop_confirm', {
|
|
||||||
title = TranslateCap('vehicleshop_confirm', data.current.name, 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 newPlate = exports['esx_vehicleshop']:GeneratePlate()
|
|
||||||
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
|
||||||
local props = ESX.Game.GetVehicleProperties(vehicle)
|
|
||||||
props.plate = newPlate
|
|
||||||
|
|
||||||
ESX.TriggerServerCallback('esx_ambulancejob:buyJobVehicle', function(bought)
|
ESX.Game.SpawnLocalVehicle(element.model, shopCoords, 0.0, function(vehicle)
|
||||||
if bought then
|
table.insert(spawnedVehicles, vehicle)
|
||||||
ESX.ShowNotification(TranslateCap('vehicleshop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price)))
|
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||||
|
FreezeEntityPosition(vehicle, true)
|
||||||
|
SetModelAsNoLongerNeeded(element.model)
|
||||||
|
|
||||||
|
if element.props then
|
||||||
|
ESX.Game.SetVehicleProperties(vehicle, element.props)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
local elements3 = {
|
||||||
|
{unselectable = true, icon = "fas fa-car", 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 == 'stop' then
|
||||||
isInShopMenu = false
|
isInShopMenu = false
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
|
|
||||||
DeleteSpawnedVehicles()
|
DeleteSpawnedVehicles()
|
||||||
FreezeEntityPosition(playerPed, false)
|
FreezeEntityPosition(playerPed, false)
|
||||||
SetEntityVisible(playerPed, true)
|
SetEntityVisible(playerPed, true)
|
||||||
|
|
||||||
ESX.Game.Teleport(playerPed, restoreCoords)
|
ESX.Game.Teleport(playerPed, restoreCoords)
|
||||||
else
|
elseif element3.value == "buy" then
|
||||||
ESX.ShowNotification(TranslateCap('vehicleshop_money'))
|
local newPlate = exports['esx_vehicleshop']:GeneratePlate()
|
||||||
menu2.close()
|
local vehicle = GetVehiclePedIsIn(playerPed, false)
|
||||||
|
local props = ESX.Game.GetVehicleProperties(vehicle)
|
||||||
|
props.plate = newPlate
|
||||||
|
|
||||||
|
ESX.TriggerServerCallback('esx_ambulancejob:buyJobVehicle', function (bought)
|
||||||
|
if bought then
|
||||||
|
ESX.ShowNotification(TranslateCap('vehicleshop_bought', element.name, ESX.Math.GroupDigits(element.price)))
|
||||||
|
|
||||||
|
isInShopMenu = false
|
||||||
|
ESX.CloseContext()
|
||||||
|
DeleteSpawnedVehicles()
|
||||||
|
FreezeEntityPosition(playerPed, false)
|
||||||
|
SetEntityVisible(playerPed, true)
|
||||||
|
|
||||||
|
ESX.Game.Teleport(playerPed, restoreCoords)
|
||||||
|
else
|
||||||
|
ESX.ShowNotification(TranslateCap('vehicleshop_money'))
|
||||||
|
ESX.CloseContext()
|
||||||
|
end
|
||||||
|
end, props, element.type)
|
||||||
end
|
end
|
||||||
end, props, data.current.type)
|
end)
|
||||||
else
|
|
||||||
menu2.close()
|
|
||||||
end
|
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
|
||||||
end, function(data, menu)
|
|
||||||
isInShopMenu = false
|
|
||||||
ESX.UI.Menu.CloseAll()
|
|
||||||
|
|
||||||
DeleteSpawnedVehicles()
|
|
||||||
FreezeEntityPosition(playerPed, false)
|
|
||||||
SetEntityVisible(playerPed, true)
|
|
||||||
|
|
||||||
ESX.Game.Teleport(playerPed, restoreCoords)
|
|
||||||
end, function(data, menu)
|
|
||||||
DeleteSpawnedVehicles()
|
|
||||||
WaitForVehicleToLoad(data.current.model)
|
|
||||||
|
|
||||||
ESX.Game.SpawnLocalVehicle(data.current.model, shopCoords, 0.0, function(vehicle)
|
|
||||||
table.insert(spawnedVehicles, vehicle)
|
|
||||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
|
||||||
FreezeEntityPosition(vehicle, true)
|
|
||||||
SetModelAsNoLongerNeeded(data.current.model)
|
|
||||||
|
|
||||||
if data.current.props then
|
|
||||||
ESX.Game.SetVehicleProperties(vehicle, data.current.props)
|
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
WaitForVehicleToLoad(elements[1].model)
|
|
||||||
ESX.Game.SpawnLocalVehicle(elements[1].model, shopCoords, 0.0, function(vehicle)
|
|
||||||
table.insert(spawnedVehicles, vehicle)
|
|
||||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
|
||||||
FreezeEntityPosition(vehicle, true)
|
|
||||||
SetModelAsNoLongerNeeded(elements[1].model)
|
|
||||||
|
|
||||||
if elements[1].props then
|
|
||||||
ESX.Game.SetVehicleProperties(vehicle, elements[1].props)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
CreateThread(function()
|
CreateThread(function()
|
||||||
|
|||||||
@@ -35,6 +35,17 @@ Config.RespawnPoints = {
|
|||||||
{coords = vector3(1836.03, 3670.99, 34.28), heading = 296.06} -- Sandy Shores
|
{coords = vector3(1836.03, 3670.99, 34.28), heading = 296.06} -- Sandy Shores
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Config.PharmacyItems = {
|
||||||
|
{
|
||||||
|
title = "Medikit",
|
||||||
|
item = "medikit"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
title = "Bandage",
|
||||||
|
item = "bandage"
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
Config.Hospitals = {
|
Config.Hospitals = {
|
||||||
|
|
||||||
CentralLosSantos = {
|
CentralLosSantos = {
|
||||||
|
|||||||
@@ -72,40 +72,54 @@ function OpenCustomersMenu()
|
|||||||
ESX.OpenContext("right", elements2, function(menu2,element2)
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
local customer = element.data
|
local customer = element.data
|
||||||
if element2.value == "deposit" then
|
if element2.value == "deposit" then
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'customer_deposit_amount', {
|
local elements = {
|
||||||
title = TranslateCap('amount')
|
{unselectable = true, icon = "fas fa-scroll", title = TranslateCap('amount')},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
|
||||||
local amount = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
if amount == nil then
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
if element.val == "confirm" then
|
||||||
else
|
local amount = tonumber(menu.eles[2].inputValue)
|
||||||
menu2.close()
|
|
||||||
TriggerServerEvent('esx_bankerjob:customerDeposit', customer.source, amount)
|
if amount == nil then
|
||||||
ESX.ShowNotification("You have deposited $"..amount.." into "..element.title.."s account.")
|
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
||||||
OpenCustomersMenu()
|
else
|
||||||
|
ESX.CloseContext()
|
||||||
|
TriggerServerEvent('esx_bankerjob:customerDeposit', customer.source, amount)
|
||||||
|
ESX.ShowNotification("You have deposited $"..amount.." into "..element.title.."s account.")
|
||||||
|
OpenCustomersMenu()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
end, function(menu)
|
||||||
menu2.close()
|
CurrentAction = 'bank_actions_menu'
|
||||||
OpenCustomersMenu()
|
CurrentActionMsg = TranslateCap('press_input_context_to_open_menu')
|
||||||
|
CurrentActionData = {}
|
||||||
end)
|
end)
|
||||||
elseif element2.value == "withdraw" then
|
elseif element2.value == "withdraw" then
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'customer_withdraw_amount', {
|
local elements = {
|
||||||
title = TranslateCap('amount')
|
{unselectable = true, icon = "fas fa-scroll", title = TranslateCap('amount')},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
|
||||||
local amount = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
if amount == nil then
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
if element.val == "confirm" then
|
||||||
else
|
local amount = tonumber(menu.eles[2].inputValue)
|
||||||
menu2.close()
|
|
||||||
TriggerServerEvent('esx_bankerjob:customerWithdraw', customer.source, amount)
|
if amount == nil then
|
||||||
ESX.ShowNotification("You have withdrawn $"..amount.." from "..element.title.."s account.")
|
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
||||||
OpenCustomersMenu()
|
else
|
||||||
|
ESX.CloseContext()
|
||||||
|
TriggerServerEvent('esx_bankerjob:customerWithdraw', customer.source, amount)
|
||||||
|
ESX.ShowNotification("You have withdrawn $"..amount.." from "..element.title.."s account.")
|
||||||
|
OpenCustomersMenu()
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
end, function(menu)
|
||||||
menu2.close()
|
CurrentAction = 'bank_actions_menu'
|
||||||
OpenCustomersMenu()
|
CurrentActionMsg = TranslateCap('press_input_context_to_open_menu')
|
||||||
|
CurrentActionData = {}
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end, function(menu)
|
end, function(menu)
|
||||||
@@ -122,26 +136,34 @@ function OpenCustomersMenu()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function CreateBillingDialog()
|
function CreateBillingDialog()
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', {
|
local elements = {
|
||||||
title = TranslateCap('bill_amount')
|
{unselectable = true, icon = "fas fa-scroll", title = TranslateCap('bill_amount')},
|
||||||
}, function(data, menu)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
|
||||||
local amount = tonumber(data.value)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
if amount == nil then
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
if element.val == "confirm" then
|
||||||
else
|
local amount = tonumber(menu.eles[2].inputValue)
|
||||||
menu.close()
|
|
||||||
|
|
||||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
if amount == nil then
|
||||||
|
ESX.ShowNotification(TranslateCap('invalid_amount'))
|
||||||
if closestPlayer == -1 or closestDistance > 5.0 then
|
|
||||||
ESX.ShowNotification(TranslateCap('no_player_nearby'))
|
|
||||||
else
|
else
|
||||||
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_banker', 'Bank', amount)
|
ESX.CloseContext()
|
||||||
|
|
||||||
|
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||||
|
|
||||||
|
if closestPlayer == -1 or closestDistance > 5.0 then
|
||||||
|
ESX.ShowNotification(TranslateCap('no_player_nearby'))
|
||||||
|
else
|
||||||
|
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_banker', 'Bank', amount)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
CurrentAction = 'bank_actions_menu'
|
||||||
|
CurrentActionMsg = TranslateCap('press_input_context_to_open_menu')
|
||||||
|
CurrentActionData = {}
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ function ShowBillsMenu()
|
|||||||
end
|
end
|
||||||
|
|
||||||
RegisterCommand('showbills', function()
|
RegisterCommand('showbills', function()
|
||||||
if not isDead and not ESX.UI.Menu.IsOpen('default', GetCurrentResourceName(), 'billing') then
|
if not isDead then
|
||||||
ShowBillsMenu()
|
ShowBillsMenu()
|
||||||
end
|
end
|
||||||
end, false)
|
end, false)
|
||||||
|
|||||||
@@ -5,97 +5,96 @@ function OpenBoatShop(shop)
|
|||||||
isInShopMenu = true
|
isInShopMenu = true
|
||||||
|
|
||||||
local playerPed = PlayerPedId()
|
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
|
for k,v in ipairs(Config.Vehicles) do
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = ('%s - <span style="color:green;">$%s</span>'):format(v.label, ESX.Math.GroupDigits(v.price)),
|
icon = "fas fa-ship",
|
||||||
|
title = ('%s - <span style="color:green;">$%s</span>'):format(v.label, ESX.Math.GroupDigits(v.price)),
|
||||||
name = v.label,
|
name = v.label,
|
||||||
model = v.model,
|
model = v.model,
|
||||||
price = v.price,
|
price = v.price,
|
||||||
props = v.props or nil
|
props = v.props or nil
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_shop', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('boat_shop'),
|
local elements2 = {
|
||||||
align = 'top-left',
|
{unselectable = true, icon = "fas fa-ship", title = element.title},
|
||||||
elements = elements
|
{icon = "fas fa-eye", title = "View", val = "view"}
|
||||||
}, 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.TriggerServerCallback('esx_boat:buyBoat', function(bought)
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
if bought then
|
if element2.val == "view" then
|
||||||
ESX.ShowNotification(TranslateCap('boat_shop_bought', data.current.name, ESX.Math.GroupDigits(data.current.price)))
|
DeleteSpawnedVehicles()
|
||||||
|
|
||||||
DeleteSpawnedVehicles()
|
ESX.Game.SpawnLocalVehicle(element.model, shop.Inside, shop.Inside.w, function (vehicle)
|
||||||
isInShopMenu = false
|
table.insert(spawnedVehicles, vehicle)
|
||||||
ESX.UI.Menu.CloseAll()
|
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||||
|
FreezeEntityPosition(vehicle, true)
|
||||||
|
|
||||||
CurrentAction = 'boat_shop'
|
if element.props then
|
||||||
CurrentActionMsg = TranslateCap('boat_shop_open')
|
ESX.Game.SetVehicleProperties(vehicle, element.props)
|
||||||
|
|
||||||
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()
|
|
||||||
end
|
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'
|
CurrentAction = 'boat_shop'
|
||||||
CurrentActionMsg = TranslateCap('boat_shop_open')
|
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)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -105,24 +104,22 @@ function OpenBoatGarage(garage)
|
|||||||
ESX.ShowNotification(TranslateCap('garage_noboats'))
|
ESX.ShowNotification(TranslateCap('garage_noboats'))
|
||||||
else
|
else
|
||||||
-- get all available boats
|
-- get all available boats
|
||||||
local elements = {}
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-ship", title = TranslateCap('garage')}
|
||||||
|
}
|
||||||
for i=1, #ownedBoats, 1 do
|
for i=1, #ownedBoats, 1 do
|
||||||
ownedBoats[i] = json.decode(ownedBoats[i])
|
ownedBoats[i] = json.decode(ownedBoats[i])
|
||||||
|
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = getVehicleLabelFromHash(ownedBoats[i].model),
|
icon = "fas fa-ship",
|
||||||
|
title = getVehicleLabelFromHash(ownedBoats[i].model),
|
||||||
vehicleProps = ownedBoats[i]
|
vehicleProps = ownedBoats[i]
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_garage', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('garage'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function (data, menu)
|
|
||||||
-- make sure the spawn point isn't blocked
|
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local vehicleProps = data.current.vehicleProps
|
local vehicleProps = element.vehicleProps
|
||||||
|
|
||||||
if ESX.Game.IsSpawnPointClear(garage.SpawnPoint, 4.0) then
|
if ESX.Game.IsSpawnPointClear(garage.SpawnPoint, 4.0) then
|
||||||
TriggerServerEvent('esx_boat:takeOutVehicle', vehicleProps.plate)
|
TriggerServerEvent('esx_boat:takeOutVehicle', vehicleProps.plate)
|
||||||
@@ -133,13 +130,11 @@ function OpenBoatGarage(garage)
|
|||||||
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
menu.close()
|
ESX.CloseContext()
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('garage_blocked'))
|
ESX.ShowNotification(TranslateCap('garage_blocked'))
|
||||||
end
|
end
|
||||||
end, function (data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
|
||||||
|
|
||||||
CurrentAction = 'garage_out'
|
CurrentAction = 'garage_out'
|
||||||
CurrentActionMsg = TranslateCap('garage_open')
|
CurrentActionMsg = TranslateCap('garage_open')
|
||||||
end)
|
end)
|
||||||
@@ -148,33 +143,36 @@ function OpenBoatGarage(garage)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function OpenLicenceMenu(shop)
|
function OpenLicenceMenu(shop)
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'boat_license', {
|
local elements = {
|
||||||
title = TranslateCap('license_menu'),
|
{unselectable = true, icon = "fas fa-ship", title = TranslateCap('license_menu')},
|
||||||
align = 'top-left',
|
{icon = "fas fa-ship", title = "Purchase Boat License"}
|
||||||
elements = {
|
}
|
||||||
{label = TranslateCap('license_buy_no'), value = 'no'},
|
|
||||||
{label = TranslateCap('license_buy_yes', ESX.Math.GroupDigits(Config.LicensePrice)), value = 'yes'}
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
}}, function (data, menu)
|
local elements2 = {
|
||||||
if data.current.value == 'yes' then
|
{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)
|
ESX.TriggerServerCallback('esx_boat:buyBoatLicense', function (boughtLicense)
|
||||||
if boughtLicense then
|
if boughtLicense then
|
||||||
ESX.ShowNotification(TranslateCap('license_bought', ESX.Math.GroupDigits(Config.LicensePrice)))
|
ESX.ShowNotification(TranslateCap('license_bought', ESX.Math.GroupDigits(Config.LicensePrice)))
|
||||||
menu.close()
|
ESX.CloseContext()
|
||||||
|
|
||||||
OpenBoatShop(shop) -- parse current shop
|
OpenBoatShop(shop) -- parse current shop
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('license_nomoney'))
|
ESX.ShowNotification(TranslateCap('license_nomoney'))
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
else
|
end, function(menu)
|
||||||
CurrentAction = 'boat_shop'
|
CurrentAction = 'boat_shop'
|
||||||
CurrentActionMsg = TranslateCap('boat_shop_open')
|
CurrentActionMsg = TranslateCap('boat_shop_open')
|
||||||
menu.close()
|
end)
|
||||||
end
|
end, function(menu)
|
||||||
end, function (data, menu)
|
CurrentAction = 'boat_shop'
|
||||||
CurrentAction = 'boat_shop'
|
|
||||||
CurrentActionMsg = TranslateCap('boat_shop_open')
|
CurrentActionMsg = TranslateCap('boat_shop_open')
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ end)
|
|||||||
|
|
||||||
AddEventHandler('esx_boat:hasExitedMarker', function()
|
AddEventHandler('esx_boat:hasExitedMarker', function()
|
||||||
if not isInShopMenu then
|
if not isInShopMenu then
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
end
|
end
|
||||||
|
|
||||||
CurrentAction = nil
|
CurrentAction = nil
|
||||||
|
|||||||
@@ -33,18 +33,18 @@ function OpenShopMenu()
|
|||||||
|
|
||||||
ESX.OpenContext("right", elements2, function(menu2,element2)
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
if element2.value == "yes" then
|
if element2.value == "yes" then
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'outfit_name', {
|
local elements3 = {
|
||||||
title = TranslateCap('name_outfit')
|
{unselectable = true, icon = "fas fa-shirt", title = TranslateCap('name_outfit')},
|
||||||
}, function(data3, menu3)
|
{title = "Outfit Name", input = true, inputType = "text", inputPlaceholder = "Outfit name in wardrobe.."},
|
||||||
menu3.close()
|
{icon = "fas fa-check-circle", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements3, function(menu3,element3)
|
||||||
TriggerEvent('skinchanger:getSkin', function(skin)
|
TriggerEvent('skinchanger:getSkin', function(skin)
|
||||||
ESX.CloseContext()
|
ESX.CloseContext()
|
||||||
TriggerServerEvent('esx_clotheshop:saveOutfit', data3.value, skin)
|
TriggerServerEvent('esx_clotheshop:saveOutfit', menu3.eles[2].inputValue, skin)
|
||||||
ESX.ShowNotification(TranslateCap('saved_outfit'))
|
ESX.ShowNotification(TranslateCap('saved_outfit'))
|
||||||
end)
|
end)
|
||||||
end, function(data3, menu3)
|
|
||||||
menu3.close()
|
|
||||||
end)
|
end)
|
||||||
elseif element2.value == "no" then
|
elseif element2.value == "no" then
|
||||||
ESX.CloseContext()
|
ESX.CloseContext()
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ CreateThread(function()
|
|||||||
inZoneDrugShop = false
|
inZoneDrugShop = false
|
||||||
if menuOpen then
|
if menuOpen then
|
||||||
menuOpen=false
|
menuOpen=false
|
||||||
ESX.UI.Menu.CloseAll()
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -62,36 +61,39 @@ CreateThread(function ()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function OpenDrugShop()
|
function OpenDrugShop()
|
||||||
ESX.UI.Menu.CloseAll()
|
local elements = {
|
||||||
local elements = {}
|
{unselectable = true, icon = "fas fa-cannabis", title = TranslateCap('dealer_title')}
|
||||||
|
}
|
||||||
menuOpen = true
|
menuOpen = true
|
||||||
|
|
||||||
for k, v in pairs(ESX.GetPlayerData().inventory) do
|
for k, v in pairs(ESX.GetPlayerData().inventory) do
|
||||||
local price = Config.DrugDealerItems[v.name]
|
local price = Config.DrugDealerItems[v.name]
|
||||||
|
|
||||||
if price and v.count > 0 then
|
if price and v.count > 0 then
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = ('%s - <span style="color:green;">%s</span>'):format(v.label, TranslateCap('dealer_item', ESX.Math.GroupDigits(price))),
|
icon = "fas fa-shopping-basket",
|
||||||
|
title = ('%s - <span style="color:green;">%s</span>'):format(v.label, TranslateCap('dealer_item', ESX.Math.GroupDigits(price))),
|
||||||
name = v.name,
|
name = v.name,
|
||||||
price = price,
|
price = price,
|
||||||
|
}
|
||||||
-- menu properties
|
|
||||||
type = 'slider',
|
|
||||||
value = 1,
|
|
||||||
min = 1,
|
|
||||||
max = v.count
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'drug_shop', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('dealer_title'),
|
local elements2 = {
|
||||||
align = 'top-left',
|
{unselectable = true, icon = "fas fa-shopping-basket", title = element.title},
|
||||||
elements = elements
|
{icon = "fas fa-shopping-basket", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount you want to sell", inputMin = Config.SellMenu.Min, inputMax = Config.SellMenu.Max},
|
||||||
}, function(data, menu)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
TriggerServerEvent('esx_drugs:sellDrug', data.current.name, data.current.value)
|
}
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local amount = menu2.eles[2].inputValue
|
||||||
|
ESX.CloseContext()
|
||||||
|
TriggerServerEvent('esx_drugs:sellDrug', element.name, amount)
|
||||||
|
end, function(menu)
|
||||||
|
menuOpen = false
|
||||||
|
end)
|
||||||
|
end, function(menu)
|
||||||
menuOpen = false
|
menuOpen = false
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -99,7 +101,7 @@ end
|
|||||||
AddEventHandler('onResourceStop', function(resource)
|
AddEventHandler('onResourceStop', function(resource)
|
||||||
if resource == GetCurrentResourceName() then
|
if resource == GetCurrentResourceName() then
|
||||||
if menuOpen then
|
if menuOpen then
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -109,39 +111,20 @@ function OpenBuyLicenseMenu(licenseName)
|
|||||||
local license = Config.LicensePrices[licenseName]
|
local license = Config.LicensePrices[licenseName]
|
||||||
|
|
||||||
local elements = {
|
local elements = {
|
||||||
{
|
{unselectable = true, title = TranslateCap('purchase_license')},
|
||||||
label = TranslateCap('license_no'),
|
{title = ('%s - <span style="color:green;">%s</span>'):format(license.label, TranslateCap('dealer_item', ESX.Math.GroupDigits(license.price))), value = licenseName, price = license.price, licenseName = license.label}
|
||||||
value = 'no'
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
label = ('%s - <span style="color:green;">%s</span>'):format(license.label, TranslateCap('dealer_item', ESX.Math.GroupDigits(license.price))),
|
|
||||||
value = licenseName,
|
|
||||||
price = license.price,
|
|
||||||
licenseName = license.label
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'license_shop', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('license_title'),
|
ESX.TriggerServerCallback('esx_drugs:buyLicense', function(boughtLicense)
|
||||||
align = 'top-left',
|
if boughtLicense then
|
||||||
elements = elements
|
ESX.CloseContext()
|
||||||
}, function(data, menu)
|
ESX.ShowNotification(TranslateCap('license_bought', element.licenseName, ESX.Math.GroupDigits(element.price)))
|
||||||
|
else
|
||||||
if data.current.value ~= 'no' then
|
ESX.ShowNotification(TranslateCap('license_bought_fail', element.licenseName))
|
||||||
ESX.TriggerServerCallback('esx_drugs:buyLicense', function(boughtLicense)
|
end
|
||||||
if boughtLicense then
|
end, element.value)
|
||||||
ESX.ShowNotification(TranslateCap('license_bought', data.current.licenseName, ESX.Math.GroupDigits(data.current.price)))
|
end, function(menu)
|
||||||
else
|
|
||||||
ESX.ShowNotification(TranslateCap('license_bought_fail', data.current.licenseName))
|
|
||||||
end
|
|
||||||
end, data.current.value)
|
|
||||||
else
|
|
||||||
menu.close()
|
|
||||||
end
|
|
||||||
|
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
menuOpen = false
|
menuOpen = false
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -31,3 +31,10 @@ Config.Marker = {
|
|||||||
Size = vector3(1.5,1.5,1.0),
|
Size = vector3(1.5,1.5,1.0),
|
||||||
Type = 1,
|
Type = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- min amount of Config.DrugDealerItems to sell
|
||||||
|
-- max amount of Config.DrugDealerItems to sell
|
||||||
|
Config.SellMenu = {
|
||||||
|
Min = 1,
|
||||||
|
Max = 50
|
||||||
|
}
|
||||||
|
|||||||
@@ -27,17 +27,14 @@ RegisterNetEvent('esx:setJob',function(job)
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function OpenMenu()
|
function OpenMenu()
|
||||||
ESX.UI.Menu.CloseAll()
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-shirt", title = TranslateCap('cloakroom')},
|
||||||
|
{icon = "fas fa-shirt", title = TranslateCap('job_wear'), value = "job_wear"},
|
||||||
|
{icon = "fas fa-shirt", title = TranslateCap('citizen_wear'), value = "citizen_wear"},
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'cloakroom',
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
{
|
if element.value == "citizen_wear" then
|
||||||
title = TranslateCap('cloakroom'),
|
|
||||||
elements = {
|
|
||||||
{label = TranslateCap('job_wear'), value = 'job_wear'},
|
|
||||||
{label = TranslateCap('citizen_wear'), value = 'citizen_wear'}
|
|
||||||
}
|
|
||||||
}, function(data, menu)
|
|
||||||
if data.current.value == 'citizen_wear' then
|
|
||||||
onDuty = false
|
onDuty = false
|
||||||
ESX.ShowNotification(TranslateCap('offduty'),"success")
|
ESX.ShowNotification(TranslateCap('offduty'),"success")
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
@@ -49,7 +46,7 @@ function OpenMenu()
|
|||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
elseif data.current.value == 'job_wear' then
|
elseif element.value == "job_wear" then
|
||||||
onDuty = true
|
onDuty = true
|
||||||
ESX.ShowNotification(TranslateCap('onduty'), "success")
|
ESX.ShowNotification(TranslateCap('onduty'), "success")
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
@@ -68,10 +65,6 @@ function OpenMenu()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.close()
|
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -54,44 +54,41 @@ end
|
|||||||
|
|
||||||
function OpenMechanicActionsMenu()
|
function OpenMechanicActionsMenu()
|
||||||
local elements = {
|
local elements = {
|
||||||
{label = TranslateCap('vehicle_list'), value = 'vehicle_list'},
|
{unselectable = true, icon = "fas fa-gear", title = TranslateCap('mechanic')},
|
||||||
{label = TranslateCap('work_wear'), value = 'cloakroom'},
|
{icon = "fas fa-car", title = TranslateCap('vehicle_list'), value = 'vehicle_list'},
|
||||||
{label = TranslateCap('civ_wear'), value = 'cloakroom2'},
|
{icon = "fas fa-shirt", title = TranslateCap('work_wear'), value = 'cloakroom'},
|
||||||
{label = TranslateCap('deposit_stock'), value = 'put_stock'},
|
{icon = "fas fa-shirt", title = TranslateCap('civ_wear'), value = 'cloakroom2'},
|
||||||
{label = TranslateCap('withdraw_stock'), value = 'get_stock'}
|
{icon = "fas fa-box", title = TranslateCap('deposit_stock'), value = 'put_stock'},
|
||||||
|
{icon = "fas fa-box", title = TranslateCap('withdraw_stock'), value = 'get_stock'}
|
||||||
}
|
}
|
||||||
|
|
||||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name == 'boss' then
|
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name == 'boss' then
|
||||||
table.insert(elements, {label = TranslateCap('boss_actions'), value = 'boss_actions'})
|
elements[#elements+1] = {
|
||||||
|
icon = 'fas fa-boss',
|
||||||
|
title = TranslateCap('boss_actions'),
|
||||||
|
value = 'boss_actions'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
if element.value == 'vehicle_list' then
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_actions', {
|
|
||||||
title = TranslateCap('mechanic'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
if data.current.value == 'vehicle_list' then
|
|
||||||
if Config.EnableSocietyOwnedVehicles then
|
if Config.EnableSocietyOwnedVehicles then
|
||||||
|
local elements2 = {
|
||||||
local elements = {}
|
{unselectable = true, icon = "fas fa-car", title = TranslateCap('service_vehicle')}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles)
|
ESX.TriggerServerCallback('esx_society:getVehiclesInGarage', function(vehicles)
|
||||||
for i=1, #vehicles, 1 do
|
for i=1, #vehicles, 1 do
|
||||||
table.insert(elements, {
|
elements2[#elements2+1] = {
|
||||||
label = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']',
|
icon = 'fas fa-car',
|
||||||
|
title = GetDisplayNameFromVehicleModel(vehicles[i].model) .. ' [' .. vehicles[i].plate .. ']',
|
||||||
value = vehicles[i]
|
value = vehicles[i]
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_spawner', {
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
title = TranslateCap('service_vehicle'),
|
ESX.CloseContext()
|
||||||
align = 'top-left',
|
local vehicleProps = element.value
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
local vehicleProps = data.current.value
|
|
||||||
|
|
||||||
ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle)
|
ESX.Game.SpawnVehicle(vehicleProps.model, Config.Zones.VehicleSpawnPoint.Pos, 270.0, function(vehicle)
|
||||||
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
ESX.Game.SetVehicleProperties(vehicle, vehicleProps)
|
||||||
@@ -100,38 +97,35 @@ function OpenMechanicActionsMenu()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mechanic', vehicleProps)
|
TriggerServerEvent('esx_society:removeVehicleFromGarage', 'mechanic', vehicleProps)
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end, 'mechanic')
|
end, 'mechanic')
|
||||||
|
|
||||||
else
|
else
|
||||||
|
local elements2 = {
|
||||||
local elements = {
|
{unselectable = true, icon = "fas fa-car", title = TranslateCap('service_vehicle')},
|
||||||
{label = TranslateCap('flat_bed'), value = 'flatbed'},
|
{icon = "fas fa-truck", title = TranslateCap('flat_bed'), value = 'flatbed'},
|
||||||
{label = TranslateCap('tow_truck'), value = 'towtruck2'}
|
{icon = "fas fa-truck", title = TranslateCap('tow_truck'), value = 'towtruck2'}
|
||||||
}
|
}
|
||||||
|
|
||||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and (ESX.PlayerData.job.grade_name == 'boss' or ESX.PlayerData.job.grade_name == 'chief' or ESX.PlayerData.job.grade_name == 'experimente') then
|
if Config.EnablePlayerManagement and ESX.PlayerData.job and (ESX.PlayerData.job.grade_name == 'boss' or ESX.PlayerData.job.grade_name == 'chief' or ESX.PlayerData.job.grade_name == 'experimente') then
|
||||||
table.insert(elements, {label = 'SlamVan', value = 'slamvan3'})
|
elements2[#elements2+1] = {
|
||||||
|
icon = 'fas fa-truck',
|
||||||
|
title = 'Slamvan',
|
||||||
|
value = 'slamvan3'
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'spawn_vehicle', {
|
|
||||||
title = TranslateCap('service_vehicle'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
if Config.MaxInService == -1 then
|
if Config.MaxInService == -1 then
|
||||||
ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle)
|
ESX.CloseContext()
|
||||||
|
ESX.Game.SpawnVehicle(element2.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle)
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount)
|
ESX.TriggerServerCallback('esx_service:enableService', function(canTakeService, maxInService, inServiceCount)
|
||||||
if canTakeService then
|
if canTakeService then
|
||||||
ESX.Game.SpawnVehicle(data.current.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle)
|
ESX.CloseContext()
|
||||||
|
ESX.Game.SpawnVehicle(element2.value, Config.Zones.VehicleSpawnPoint.Pos, 90.0, function(vehicle)
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
TaskWarpPedIntoVehicle(playerPed, vehicle, -1)
|
||||||
end)
|
end)
|
||||||
@@ -140,16 +134,10 @@ function OpenMechanicActionsMenu()
|
|||||||
end
|
end
|
||||||
end, 'mechanic')
|
end, 'mechanic')
|
||||||
end
|
end
|
||||||
|
|
||||||
menu.close()
|
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
OpenMechanicActionsMenu()
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'cloakroom' then
|
elseif element.value == 'cloakroom' then
|
||||||
menu.close()
|
ESX.CloseContext()
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
if skin.sex == 0 then
|
if skin.sex == 0 then
|
||||||
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
|
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_male)
|
||||||
@@ -157,27 +145,24 @@ function OpenMechanicActionsMenu()
|
|||||||
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
|
TriggerEvent('skinchanger:loadClothes', skin, jobSkin.skin_female)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
elseif data.current.value == 'cloakroom2' then
|
elseif element.value == 'cloakroom2' then
|
||||||
menu.close()
|
ESX.CloseContext()
|
||||||
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
ESX.TriggerServerCallback('esx_skin:getPlayerSkin', function(skin, jobSkin)
|
||||||
TriggerEvent('skinchanger:loadSkin', skin)
|
TriggerEvent('skinchanger:loadSkin', skin)
|
||||||
end)
|
end)
|
||||||
|
elseif Config.OxInventory and (element.value == 'put_stock' or element.value == 'get_stock') then
|
||||||
elseif Config.OxInventory and (data.current.value == 'put_stock' or data.current.value == 'get_stock') then
|
|
||||||
exports.ox_inventory:openInventory('stash', 'society_mechanic')
|
exports.ox_inventory:openInventory('stash', 'society_mechanic')
|
||||||
return ESX.UI.Menu.CloseAll()
|
return ESX.CloseContext()
|
||||||
elseif data.current.value == 'put_stock' then
|
elseif element.value == 'put_stock' then
|
||||||
OpenPutStocksMenu()
|
OpenPutStocksMenu()
|
||||||
elseif data.current.value == 'get_stock' then
|
elseif element.value == 'get_stock' then
|
||||||
OpenGetStocksMenu()
|
OpenGetStocksMenu()
|
||||||
elseif data.current.value == 'boss_actions' then
|
elseif element.value == 'boss_actions' then
|
||||||
TriggerEvent('esx_society:openBossMenu', 'mechanic', function(data, menu)
|
TriggerEvent('esx_society:openBossMenu', 'mechanic', function(data, menu)
|
||||||
menu.close()
|
menu.close()
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
|
||||||
|
|
||||||
CurrentAction = 'mechanic_actions_menu'
|
CurrentAction = 'mechanic_actions_menu'
|
||||||
CurrentActionMsg = TranslateCap('open_actions')
|
CurrentActionMsg = TranslateCap('open_actions')
|
||||||
CurrentActionData = {}
|
CurrentActionData = {}
|
||||||
@@ -187,29 +172,21 @@ end
|
|||||||
function OpenMechanicHarvestMenu()
|
function OpenMechanicHarvestMenu()
|
||||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
||||||
local elements = {
|
local elements = {
|
||||||
{label = TranslateCap('gas_can'), value = 'gaz_bottle'},
|
{unselectable = true, icon = "fas fa-gear", title = "Mechanic Harvest Menu"},
|
||||||
{label = TranslateCap('repair_tools'), value = 'fix_tool'},
|
{icon = "fas fa-gear", title = TranslateCap('gas_can'), value = 'gaz_bottle'},
|
||||||
{label = TranslateCap('body_work_tools'), value = 'caro_tool'}
|
{icon = "fas fa-gear", title = TranslateCap('repair_tools'), value = 'fix_tool'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('body_work_tools'), value = 'caro_tool'}
|
||||||
}
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
if element.value == 'gaz_bottle' then
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_harvest', {
|
|
||||||
title = TranslateCap('harvest'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
|
|
||||||
if data.current.value == 'gaz_bottle' then
|
|
||||||
TriggerServerEvent('esx_mechanicjob:startHarvest')
|
TriggerServerEvent('esx_mechanicjob:startHarvest')
|
||||||
elseif data.current.value == 'fix_tool' then
|
elseif element.value == 'fix_tool' then
|
||||||
TriggerServerEvent('esx_mechanicjob:startHarvest2')
|
TriggerServerEvent('esx_mechanicjob:startHarvest2')
|
||||||
elseif data.current.value == 'caro_tool' then
|
elseif element.value == 'caro_tool' then
|
||||||
TriggerServerEvent('esx_mechanicjob:startHarvest3')
|
TriggerServerEvent('esx_mechanicjob:startHarvest3')
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
|
||||||
CurrentAction = 'mechanic_harvest_menu'
|
CurrentAction = 'mechanic_harvest_menu'
|
||||||
CurrentActionMsg = TranslateCap('harvest_menu')
|
CurrentActionMsg = TranslateCap('harvest_menu')
|
||||||
CurrentActionData = {}
|
CurrentActionData = {}
|
||||||
@@ -222,30 +199,21 @@ end
|
|||||||
function OpenMechanicCraftMenu()
|
function OpenMechanicCraftMenu()
|
||||||
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
if Config.EnablePlayerManagement and ESX.PlayerData.job and ESX.PlayerData.job.grade_name ~= 'recrue' then
|
||||||
local elements = {
|
local elements = {
|
||||||
{label = TranslateCap('blowtorch'), value = 'blow_pipe'},
|
{unselectable = true, icon = "fas fa-gear", title = "Mechanic Craft Menu"},
|
||||||
{label = TranslateCap('repair_kit'), value = 'fix_kit'},
|
{icon = "fas fa-gear", title = TranslateCap('blowtorch'), value = 'blow_pipe'},
|
||||||
{label = TranslateCap('body_kit'), value = 'caro_kit'}
|
{icon = "fas fa-gear", title = TranslateCap('repair_kit'), value = 'fix_kit'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('body_kit'), value = 'caro_kit'}
|
||||||
}
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
if element.value == 'blow_pipe' then
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mechanic_craft', {
|
|
||||||
title = TranslateCap('craft'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
|
|
||||||
if data.current.value == 'blow_pipe' then
|
|
||||||
TriggerServerEvent('esx_mechanicjob:startCraft')
|
TriggerServerEvent('esx_mechanicjob:startCraft')
|
||||||
elseif data.current.value == 'fix_kit' then
|
elseif element.value == 'fix_kit' then
|
||||||
TriggerServerEvent('esx_mechanicjob:startCraft2')
|
TriggerServerEvent('esx_mechanicjob:startCraft2')
|
||||||
elseif data.current.value == 'caro_kit' then
|
elseif element.value == 'caro_kit' then
|
||||||
TriggerServerEvent('esx_mechanicjob:startCraft3')
|
TriggerServerEvent('esx_mechanicjob:startCraft3')
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
|
||||||
|
|
||||||
CurrentAction = 'mechanic_craft_menu'
|
CurrentAction = 'mechanic_craft_menu'
|
||||||
CurrentActionMsg = TranslateCap('craft_menu')
|
CurrentActionMsg = TranslateCap('craft_menu')
|
||||||
CurrentActionData = {}
|
CurrentActionData = {}
|
||||||
@@ -256,27 +224,29 @@ function OpenMechanicCraftMenu()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function OpenMobileMechanicActionsMenu()
|
function OpenMobileMechanicActionsMenu()
|
||||||
ESX.UI.Menu.CloseAll()
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-gear", title = TranslateCap('mechanic')},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('billing'), value = 'billing'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('hijack'), value = 'hijack_vehicle'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('repair'), value = 'fix_vehicle'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('clean'), value = 'clean_vehicle'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('imp_veh'), value = 'del_vehicle'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('flat_bed'), value = 'dep_vehicle'},
|
||||||
|
{icon = "fas fa-gear", title = TranslateCap('place_objects'), value = 'object_spawner'}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('mechanic'),
|
|
||||||
align = 'top-left',
|
|
||||||
elements = {
|
|
||||||
{label = TranslateCap('billing'), value = 'billing'},
|
|
||||||
{label = TranslateCap('hijack'), value = 'hijack_vehicle'},
|
|
||||||
{label = TranslateCap('repair'), value = 'fix_vehicle'},
|
|
||||||
{label = TranslateCap('clean'), value = 'clean_vehicle'},
|
|
||||||
{label = TranslateCap('imp_veh'), value = 'del_vehicle'},
|
|
||||||
{label = TranslateCap('flat_bed'), value = 'dep_vehicle'},
|
|
||||||
{label = TranslateCap('place_objects'), value = 'object_spawner'}
|
|
||||||
}}, function(data, menu)
|
|
||||||
if isBusy then return end
|
if isBusy then return end
|
||||||
|
|
||||||
if data.current.value == 'billing' then
|
if element.value == "billing" then
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'billing', {
|
local elements2 = {
|
||||||
title = TranslateCap('invoice_amount')
|
{unselectable = true, icon = "fas fa-scroll", title = element.title},
|
||||||
}, function(data, menu)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
|
||||||
local amount = tonumber(data.value)
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local amount = tonumber(menu2.eles[2].inputValue)
|
||||||
|
|
||||||
if amount == nil or amount < 0 then
|
if amount == nil or amount < 0 then
|
||||||
ESX.ShowNotification(TranslateCap('amount_invalid'), "error")
|
ESX.ShowNotification(TranslateCap('amount_invalid'), "error")
|
||||||
@@ -289,10 +259,8 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mechanic', TranslateCap('mechanic'), amount)
|
TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(closestPlayer), 'society_mechanic', TranslateCap('mechanic'), amount)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
elseif data.current.value == 'hijack_vehicle' then
|
elseif element.value == "hijack_vehicle" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
@@ -318,7 +286,7 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'fix_vehicle' then
|
elseif element.value == "fix_vehicle" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
@@ -346,7 +314,7 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'clean_vehicle' then
|
elseif element.value == "clean_vehicle" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local vehicle = ESX.Game.GetVehicleInDirection()
|
local vehicle = ESX.Game.GetVehicleInDirection()
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
@@ -371,7 +339,7 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
ESX.ShowNotification(TranslateCap('no_vehicle_nearby'))
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'del_vehicle' then
|
elseif element.value == "del_vehicle" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
|
|
||||||
if IsPedSittingInAnyVehicle(playerPed) then
|
if IsPedSittingInAnyVehicle(playerPed) then
|
||||||
@@ -393,7 +361,7 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
ESX.ShowNotification(TranslateCap('must_near'))
|
ESX.ShowNotification(TranslateCap('must_near'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'dep_vehicle' then
|
elseif element.value == "dep_vehicle" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
local vehicle = GetVehiclePedIsIn(playerPed, true)
|
local vehicle = GetVehiclePedIsIn(playerPed, true)
|
||||||
|
|
||||||
@@ -459,7 +427,7 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('imp_flatbed'))
|
ESX.ShowNotification(TranslateCap('imp_flatbed'))
|
||||||
end
|
end
|
||||||
elseif data.current.value == 'object_spawner' then
|
elseif element.value == "object_spawner" then
|
||||||
local playerPed = PlayerPedId()
|
local playerPed = PlayerPedId()
|
||||||
|
|
||||||
if IsPedSittingInAnyVehicle(playerPed) then
|
if IsPedSittingInAnyVehicle(playerPed) then
|
||||||
@@ -467,14 +435,14 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'mobile_mechanic_actions_spawn', {
|
local elements2 = {
|
||||||
title = TranslateCap('objects'),
|
{unselectable= true, icon = "fas fa-object", title = TranslateCap('objects')},
|
||||||
align = 'top-left',
|
{icon = "fas fa-object", title = TranslateCap('roadcone'), value = 'prop_roadcone02a'},
|
||||||
elements = {
|
{icon = "fas fa-object", title = TranslateCap('toolbox'), value = 'prop_toolchest_01'}
|
||||||
{label = TranslateCap('roadcone'), value = 'prop_roadcone02a'},
|
}
|
||||||
{label = TranslateCap('toolbox'), value = 'prop_toolchest_01'}
|
|
||||||
}}, function(data2, menu2)
|
ESX.OpenContext("right", elements2, function(menuObj,elementObj)
|
||||||
local model = data2.current.value
|
local model = elementObj.value
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
local forward = GetEntityForwardVector(playerPed)
|
local forward = GetEntityForwardVector(playerPed)
|
||||||
local x, y, z = table.unpack(coords + forward * 1.0)
|
local x, y, z = table.unpack(coords + forward * 1.0)
|
||||||
@@ -489,100 +457,92 @@ function OpenMobileMechanicActionsMenu()
|
|||||||
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
SetEntityHeading(obj, GetEntityHeading(playerPed))
|
||||||
PlaceObjectOnGroundProperly(obj)
|
PlaceObjectOnGroundProperly(obj)
|
||||||
end)
|
end)
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpenGetStocksMenu()
|
function OpenGetStocksMenu()
|
||||||
ESX.TriggerServerCallback('esx_mechanicjob:getStockItems', function(items)
|
ESX.TriggerServerCallback('esx_mechanicjob:getStockItems', function(items)
|
||||||
local elements = {}
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-box", title = TranslateCap('mechanic_stock')}
|
||||||
|
}
|
||||||
|
|
||||||
for i=1, #items, 1 do
|
for i=1, #items, 1 do
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = 'x' .. items[i].count .. ' ' .. items[i].label,
|
icon = 'fas fa-box',
|
||||||
|
title = 'x' .. items[i].count .. ' ' .. items[i].label,
|
||||||
value = items[i].name
|
value = items[i].name
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('mechanic_stock'),
|
local itemName = element.value
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
local itemName = data.current.value
|
|
||||||
|
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', {
|
local elements2 = {
|
||||||
title = TranslateCap('quantity')
|
{unselectable = true, icon = "fas fa-box", title = element.title},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 100, inputPlaceholder = "Amount to withdraw.."},
|
||||||
local count = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local count = tonumber(menu2.eles[2].inputValue)
|
||||||
|
|
||||||
if count == nil then
|
if count == nil then
|
||||||
ESX.ShowNotification(TranslateCap('invalid_quantity'))
|
ESX.ShowNotification(TranslateCap('invalid_quantity'))
|
||||||
else
|
else
|
||||||
menu2.close()
|
ESX.CloseContext()
|
||||||
menu.close()
|
|
||||||
TriggerServerEvent('esx_mechanicjob:getStockItem', itemName, count)
|
TriggerServerEvent('esx_mechanicjob:getStockItem', itemName, count)
|
||||||
|
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
OpenGetStocksMenu()
|
OpenGetStocksMenu()
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
function OpenPutStocksMenu()
|
function OpenPutStocksMenu()
|
||||||
ESX.TriggerServerCallback('esx_mechanicjob:getPlayerInventory', function(inventory)
|
ESX.TriggerServerCallback('esx_mechanicjob:getPlayerInventory', function(inventory)
|
||||||
local elements = {}
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-box", title = TranslateCap('inventory')}
|
||||||
|
}
|
||||||
|
|
||||||
for i=1, #inventory.items, 1 do
|
for i=1, #inventory.items, 1 do
|
||||||
local item = inventory.items[i]
|
local item = inventory.items[i]
|
||||||
|
|
||||||
if item.count > 0 then
|
if item.count > 0 then
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = item.label .. ' x' .. item.count,
|
icon = 'fas fa-box',
|
||||||
|
title = item.label .. ' x' .. item.count,
|
||||||
type = 'item_standard',
|
type = 'item_standard',
|
||||||
value = item.name
|
value = item.name
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'stocks_menu', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('inventory'),
|
local itemName = element.value
|
||||||
align = 'top-left',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
local itemName = data.current.value
|
|
||||||
|
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', {
|
local elements2 = {
|
||||||
title = TranslateCap('quantity')
|
{unselectable = true, icon = "fas fa-box", title = element.title},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 100, inputPlaceholder = "Amount to deposit.."},
|
||||||
local count = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local count = tonumber(menu2.eles[2].inputValue)
|
||||||
|
|
||||||
if count == nil then
|
if count == nil then
|
||||||
ESX.ShowNotification(TranslateCap('invalid_quantity'))
|
ESX.ShowNotification(TranslateCap('invalid_quantity'))
|
||||||
else
|
else
|
||||||
menu2.close()
|
ESX.CloseContext()
|
||||||
menu.close()
|
|
||||||
TriggerServerEvent('esx_mechanicjob:putStockItems', itemName, count)
|
TriggerServerEvent('esx_mechanicjob:putStockItems', itemName, count)
|
||||||
|
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
OpenPutStocksMenu()
|
OpenPutStocksMenu()
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
@@ -738,7 +698,7 @@ AddEventHandler('esx_mechanicjob:hasExitedMarker', function(zone)
|
|||||||
end
|
end
|
||||||
|
|
||||||
CurrentAction = nil
|
CurrentAction = nil
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
AddEventHandler('esx_mechanicjob:hasEnteredEntityZone', function(entity)
|
AddEventHandler('esx_mechanicjob:hasEnteredEntityZone', function(entity)
|
||||||
|
|||||||
@@ -2,49 +2,39 @@ local hasAlreadyEnteredMarker, lastZone
|
|||||||
local currentAction, currentActionMsg, currentActionData = nil, nil, {}
|
local currentAction, currentActionMsg, currentActionData = nil, nil, {}
|
||||||
|
|
||||||
function OpenShopMenu(zone)
|
function OpenShopMenu(zone)
|
||||||
local elements = {}
|
local elements = {
|
||||||
|
{unselectable = true, icon = "fas fa-shopping-basket", title = TranslateCap('shop') }
|
||||||
|
}
|
||||||
|
|
||||||
for i=1, #Config.Zones[zone].Items, 1 do
|
for i=1, #Config.Zones[zone].Items, 1 do
|
||||||
local item = Config.Zones[zone].Items[i]
|
local item = Config.Zones[zone].Items[i]
|
||||||
|
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = ('%s - <span style="color:green;">%s</span>'):format(item.label, TranslateCap('shop_item', ESX.Math.GroupDigits(item.price))),
|
icon = "fas fa-shopping-basket",
|
||||||
|
title = ('%s - <span style="color:green;">%s</span>'):format(item.label, TranslateCap('shop_item', ESX.Math.GroupDigits(item.price))),
|
||||||
itemLabel = item.label,
|
itemLabel = item.label,
|
||||||
item = item.name,
|
item = item.name,
|
||||||
price = item.price,
|
price = item.price
|
||||||
|
}
|
||||||
-- menu properties
|
|
||||||
value = 1,
|
|
||||||
type = 'slider',
|
|
||||||
min = 1,
|
|
||||||
max = 100
|
|
||||||
})
|
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
|
local elements2 = {
|
||||||
|
{unselectable = true, icon = "fas fa-shopping-basket", title = element.title},
|
||||||
|
{icon = "fas fa-shopping-basket", title = "Amount", input = true, inputType = "number", inputPlaceholder = "Amount you want to buy", inputMin = 1, inputMax = 25},
|
||||||
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop', {
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
title = TranslateCap('shop'),
|
local amount = menu2.eles[2].inputValue
|
||||||
align = 'bottom-left',
|
ESX.CloseContext()
|
||||||
elements = elements
|
TriggerServerEvent('esx_shops:buyItem', element.item, amount, zone)
|
||||||
}, function(data, menu)
|
end, function(menu)
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'shop_confirm', {
|
currentAction = 'shop_menu'
|
||||||
title = TranslateCap('shop_confirm', data.current.value, data.current.itemLabel, ESX.Math.GroupDigits(data.current.price * data.current.value)),
|
currentActionMsg = TranslateCap('press_menu')
|
||||||
align = 'bottom-left',
|
currentActionData = {zone = zone}
|
||||||
elements = {
|
|
||||||
{label = TranslateCap('no'), value = 'no'},
|
|
||||||
{label = TranslateCap('yes'), value = 'yes'}
|
|
||||||
}}, function(data2, menu2)
|
|
||||||
if data2.current.value == 'yes' then
|
|
||||||
TriggerServerEvent('esx_shops:buyItem', data.current.item, data.current.value, zone)
|
|
||||||
end
|
|
||||||
|
|
||||||
menu2.close()
|
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end, function(data, menu)
|
end, function(menu)
|
||||||
menu.close()
|
|
||||||
|
|
||||||
currentAction = 'shop_menu'
|
currentAction = 'shop_menu'
|
||||||
currentActionMsg = TranslateCap('press_menu')
|
currentActionMsg = TranslateCap('press_menu')
|
||||||
currentActionData = {zone = zone}
|
currentActionData = {zone = zone}
|
||||||
|
|||||||
@@ -322,24 +322,24 @@ function OpenGetStocksMenu()
|
|||||||
|
|
||||||
ESX.OpenContext("right", elements, function(menu,element)
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
local itemName = element.value
|
local itemName = element.value
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_get_item_count', {
|
local elements2 = {
|
||||||
title = TranslateCap('quantity')
|
{unselectable = true, icon = "fas fa-box", title = element.title},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 100, inputPlaceholder = "Amount to withdraw.."},
|
||||||
local count = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local count = tonumber(menu2.eles[2].inputValue)
|
||||||
|
|
||||||
if count == nil then
|
if count == nil then
|
||||||
ESX.ShowNotification(TranslateCap('quantity_invalid'))
|
ESX.ShowNotification(TranslateCap('quantity_invalid'))
|
||||||
else
|
else
|
||||||
menu2.close()
|
|
||||||
ESX.CloseContext()
|
ESX.CloseContext()
|
||||||
|
|
||||||
-- todo: refresh on callback
|
|
||||||
TriggerServerEvent('esx_taxijob:getStockItem', itemName, count)
|
TriggerServerEvent('esx_taxijob:getStockItem', itemName, count)
|
||||||
|
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
OpenGetStocksMenu()
|
OpenGetStocksMenu()
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end, function(menu)
|
end, function(menu)
|
||||||
@@ -370,24 +370,24 @@ function OpenPutStocksMenu()
|
|||||||
ESX.OpenContext("right", elements, function(menu,element)
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
local itemName = element.value
|
local itemName = element.value
|
||||||
|
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'stocks_menu_put_item_count', {
|
local elements2 = {
|
||||||
title = TranslateCap('quantity')
|
{unselectable = true, icon = "fas fa-box", title = element.title},
|
||||||
}, function(data2, menu2)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 100, inputPlaceholder = "Amount to deposit.."},
|
||||||
local count = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local count = tonumber(menu2.eles[2].inputValue)
|
||||||
|
|
||||||
if count == nil then
|
if count == nil then
|
||||||
ESX.ShowNotification(TranslateCap('quantity_invalid'))
|
ESX.ShowNotification(TranslateCap('quantity_invalid'))
|
||||||
else
|
else
|
||||||
menu2.close()
|
|
||||||
ESX.CloseContext()
|
ESX.CloseContext()
|
||||||
|
|
||||||
-- todo: refresh on callback
|
-- todo: refresh on callback
|
||||||
TriggerServerEvent('esx_taxijob:putStockItems', itemName, count)
|
TriggerServerEvent('esx_taxijob:putStockItems', itemName, count)
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
OpenPutStocksMenu()
|
OpenPutStocksMenu()
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end, function(menu)
|
end, function(menu)
|
||||||
|
|||||||
@@ -99,12 +99,13 @@ end)
|
|||||||
RegisterNetEvent('esx_taxijob:putStockItems')
|
RegisterNetEvent('esx_taxijob:putStockItems')
|
||||||
AddEventHandler('esx_taxijob:putStockItems', function(itemName, count)
|
AddEventHandler('esx_taxijob:putStockItems', function(itemName, count)
|
||||||
local xPlayer = ESX.GetPlayerFromId(source)
|
local xPlayer = ESX.GetPlayerFromId(source)
|
||||||
|
local sourceItem = xPlayer.getInventoryItem(itemName)
|
||||||
|
|
||||||
if xPlayer.job.name == 'taxi' then
|
if xPlayer.job.name == 'taxi' then
|
||||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_taxi', function(inventory)
|
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_taxi', function(inventory)
|
||||||
local item = inventory.getItem(itemName)
|
local item = inventory.getItem(itemName)
|
||||||
|
|
||||||
if item.count > 0 then
|
if sourceItem.count >= count and count > 0 then
|
||||||
xPlayer.removeInventoryItem(itemName, count)
|
xPlayer.removeInventoryItem(itemName, count)
|
||||||
inventory.addItem(itemName, count)
|
inventory.addItem(itemName, count)
|
||||||
xPlayer.showNotification(TranslateCap('have_deposited', count, item.label))
|
xPlayer.showNotification(TranslateCap('have_deposited', count, item.label))
|
||||||
|
|||||||
Reference in New Issue
Block a user