mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-02 19:28:52 +00:00
@@ -1088,22 +1088,26 @@ end
|
|||||||
|
|
||||||
function ESX.ShowInventory()
|
function ESX.ShowInventory()
|
||||||
local playerPed = ESX.PlayerData.ped
|
local playerPed = ESX.PlayerData.ped
|
||||||
local elements, currentWeight = {}, 0
|
local elements = {
|
||||||
|
{unselectable = true, icon = 'fas fa-box', title = 'Player Inventory'}
|
||||||
|
}
|
||||||
|
local currentWeight = 0
|
||||||
|
|
||||||
for i=1, #(ESX.PlayerData.accounts) do
|
for i=1, #(ESX.PlayerData.accounts) do
|
||||||
if ESX.PlayerData.accounts[i].money > 0 then
|
if ESX.PlayerData.accounts[i].money > 0 then
|
||||||
local formattedMoney = TranslateCap('locale_currency', ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money))
|
local formattedMoney = TranslateCap('locale_currency', ESX.Math.GroupDigits(ESX.PlayerData.accounts[i].money))
|
||||||
local canDrop = ESX.PlayerData.accounts[i].name ~= 'bank'
|
local canDrop = ESX.PlayerData.accounts[i].name ~= 'bank'
|
||||||
|
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = ('%s: <span style="color:green;">%s</span>'):format(ESX.PlayerData.accounts[i].label, formattedMoney),
|
icon = 'fas fa-money-bill-wave',
|
||||||
|
title = ('%s: <span style="color:green;">%s</span>'):format(ESX.PlayerData.accounts[i].label, formattedMoney),
|
||||||
count = ESX.PlayerData.accounts[i].money,
|
count = ESX.PlayerData.accounts[i].money,
|
||||||
type = 'item_account',
|
type = 'item_account',
|
||||||
value = ESX.PlayerData.accounts[i].name,
|
value = ESX.PlayerData.accounts[i].name,
|
||||||
usable = false,
|
usable = false,
|
||||||
rare = false,
|
rare = false,
|
||||||
canRemove = canDrop
|
canRemove = canDrop
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1111,15 +1115,16 @@ function ESX.ShowInventory()
|
|||||||
if v.count > 0 then
|
if v.count > 0 then
|
||||||
currentWeight = currentWeight + (v.weight * v.count)
|
currentWeight = currentWeight + (v.weight * v.count)
|
||||||
|
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = ('%s x%s'):format(v.label, v.count),
|
icon = 'fas fa-box',
|
||||||
|
title = ('%s x%s'):format(v.label, v.count),
|
||||||
count = v.count,
|
count = v.count,
|
||||||
type = 'item_standard',
|
type = 'item_standard',
|
||||||
value = v.name,
|
value = v.name,
|
||||||
usable = v.usable,
|
usable = v.usable,
|
||||||
rare = v.rare,
|
rare = v.rare,
|
||||||
canRemove = v.canRemove
|
canRemove = v.canRemove
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -1135,8 +1140,9 @@ function ESX.ShowInventory()
|
|||||||
label = v.label
|
label = v.label
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(elements, {
|
elements[#elements+1] = {
|
||||||
label = label,
|
icon = 'fas fa-gun',
|
||||||
|
title = label,
|
||||||
count = 1,
|
count = 1,
|
||||||
type = 'item_weapon',
|
type = 'item_weapon',
|
||||||
value = v.name,
|
value = v.name,
|
||||||
@@ -1145,76 +1151,80 @@ function ESX.ShowInventory()
|
|||||||
ammo = ammo,
|
ammo = ammo,
|
||||||
canGiveAmmo = (v.ammo ~= nil),
|
canGiveAmmo = (v.ammo ~= nil),
|
||||||
canRemove = true
|
canRemove = true
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.CloseAll()
|
elements[#elements+1] = {
|
||||||
|
unselectable = true,
|
||||||
|
icon = "fas fa-weight",
|
||||||
|
title = "Current Weight: "..currentWeight
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.CloseContext()
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'inventory', {
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
title = TranslateCap('inventory', currentWeight, ESX.PlayerData.maxWeight),
|
|
||||||
align = 'bottom-right',
|
|
||||||
elements = elements
|
|
||||||
}, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
local player, distance = ESX.Game.GetClosestPlayer()
|
local player, distance = ESX.Game.GetClosestPlayer()
|
||||||
elements = {}
|
|
||||||
|
|
||||||
if data.current.usable then
|
elements2 = {}
|
||||||
table.insert(elements, {
|
|
||||||
label = TranslateCap('use'),
|
if element.usable then
|
||||||
|
elements2[#elements2+1] = {
|
||||||
|
icon = "fas fa-utensils",
|
||||||
|
title = TranslateCap('use'),
|
||||||
action = 'use',
|
action = 'use',
|
||||||
type = data.current.type,
|
type = element.type,
|
||||||
value = data.current.value
|
value = element.value
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.current.canRemove then
|
if element.canRemove then
|
||||||
if player ~= -1 and distance <= 3.0 then
|
if player ~= -1 and distance <= 3.0 then
|
||||||
table.insert(elements, {
|
elements2[#elements2+1] = {
|
||||||
label = TranslateCap('give'),
|
icon = "fas fa-hands",
|
||||||
|
title = TranslateCap('give'),
|
||||||
action = 'give',
|
action = 'give',
|
||||||
type = data.current.type,
|
type = element.type,
|
||||||
value = data.current.value
|
value = element.value
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(elements, {
|
elements2[#elements2+1] = {
|
||||||
label = TranslateCap('remove'),
|
icon = "fas fa-trash",
|
||||||
|
title = TranslateCap('remove'),
|
||||||
action = 'remove',
|
action = 'remove',
|
||||||
type = data.current.type,
|
type = element.type,
|
||||||
value = data.current.value
|
value = element.value
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
if data.current.type == 'item_weapon' and data.current.canGiveAmmo and data.current.ammo > 0 and player ~= -1 and
|
if element.type == 'item_weapon' and element.canGiveAmmo and element.ammo > 0 and player ~= -1 and distance <= 3.0 then
|
||||||
distance <= 3.0 then
|
elements2[#elements2+1] = {
|
||||||
table.insert(elements, {
|
icon = "fas fa-gun",
|
||||||
label = TranslateCap('giveammo'),
|
title = TranslateCap('giveammo'),
|
||||||
action = 'give_ammo',
|
action = 'give_ammo',
|
||||||
type = data.current.type,
|
type = element.type,
|
||||||
value = data.current.value
|
value = element.value
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
table.insert(elements, {
|
elements2[#elements2+1] = {
|
||||||
label = TranslateCap('return'),
|
icon = "fas fa-arrow-left",
|
||||||
|
title = TranslateCap('return'),
|
||||||
action = 'return'
|
action = 'return'
|
||||||
})
|
}
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'inventory_item', {
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
title = data.current.label,
|
local item, type = element2.value, element2.type
|
||||||
align = 'bottom-right',
|
|
||||||
elements = elements
|
|
||||||
}, function(data1, menu1)
|
|
||||||
local item, type = data1.current.value, data1.current.type
|
|
||||||
|
|
||||||
if data1.current.action == 'give' then
|
if element2.action == "give" then
|
||||||
local playersNearby = ESX.Game.GetPlayersInArea(GetEntityCoords(playerPed), 3.0)
|
local playersNearby = ESX.Game.GetPlayersInArea(GetEntityCoords(playerPed), 3.0)
|
||||||
|
|
||||||
if #playersNearby > 0 then
|
if #playersNearby > 0 then
|
||||||
local players = {}
|
local players = {}
|
||||||
elements = {}
|
elements3 = {
|
||||||
|
{unselectable = true, icon = "fas fa-users", title = "Nearby Players"}
|
||||||
|
}
|
||||||
|
|
||||||
for k, playerNearby in ipairs(playersNearby) do
|
for k, playerNearby in ipairs(playersNearby) do
|
||||||
players[GetPlayerServerId(playerNearby)] = true
|
players[GetPlayerServerId(playerNearby)] = true
|
||||||
@@ -1222,19 +1232,15 @@ function ESX.ShowInventory()
|
|||||||
|
|
||||||
ESX.TriggerServerCallback('esx:getPlayerNames', function(returnedPlayers)
|
ESX.TriggerServerCallback('esx:getPlayerNames', function(returnedPlayers)
|
||||||
for playerId, playerName in pairs(returnedPlayers) do
|
for playerId, playerName in pairs(returnedPlayers) do
|
||||||
table.insert(elements, {
|
elements3[#elements3+1] = {
|
||||||
label = playerName,
|
icon = "fas fa-user",
|
||||||
|
title = playerName,
|
||||||
playerId = playerId
|
playerId = playerId
|
||||||
})
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'give_item_to', {
|
ESX.OpenContext("right", elements3, function(menu3,element3)
|
||||||
title = TranslateCap('give_to'),
|
local selectedPlayer, selectedPlayerId = GetPlayerFromServerId(element3.playerId), element3.playerId
|
||||||
align = 'bottom-right',
|
|
||||||
elements = elements
|
|
||||||
}, function(data2, menu2)
|
|
||||||
local selectedPlayer, selectedPlayerId = GetPlayerFromServerId(data2.current.playerId),
|
|
||||||
data2.current.playerId
|
|
||||||
playersNearby = ESX.Game.GetPlayersInArea(GetEntityCoords(playerPed), 3.0)
|
playersNearby = ESX.Game.GetPlayersInArea(GetEntityCoords(playerPed), 3.0)
|
||||||
playersNearby = ESX.Table.Set(playersNearby)
|
playersNearby = ESX.Table.Set(playersNearby)
|
||||||
|
|
||||||
@@ -1244,62 +1250,58 @@ function ESX.ShowInventory()
|
|||||||
if IsPedOnFoot(selectedPlayerPed) and not IsPedFalling(selectedPlayerPed) then
|
if IsPedOnFoot(selectedPlayerPed) and not IsPedFalling(selectedPlayerPed) then
|
||||||
if type == 'item_weapon' then
|
if type == 'item_weapon' then
|
||||||
TriggerServerEvent('esx:giveInventoryItem', selectedPlayerId, type, item, nil)
|
TriggerServerEvent('esx:giveInventoryItem', selectedPlayerId, type, item, nil)
|
||||||
menu2.close()
|
ESX.CloseContext()
|
||||||
menu1.close()
|
|
||||||
else
|
else
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(),
|
local elementsG = {
|
||||||
'inventory_item_count_give', {
|
{unselectable = true, icon = "fas fa-trash", title = element.title},
|
||||||
title = TranslateCap('amount')
|
{icon = "fas fa-tally", title = "Amount.", input = true, inputType = "number", inputPlaceholder = "Amount to give..", inputMin = 1, inputMax = 1000},
|
||||||
}, function(data3, menu3)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
local quantity = tonumber(data3.value)
|
}
|
||||||
|
|
||||||
if quantity and quantity > 0 and data.current.count >= quantity then
|
ESX.OpenContext("right", elementsG, function(menuG,elementG)
|
||||||
TriggerServerEvent('esx:giveInventoryItem', selectedPlayerId, type,
|
local quantity = tonumber(menuG.eles[2].inputValue)
|
||||||
item, quantity)
|
|
||||||
menu3.close()
|
if quantity and quantity > 0 and element.count >= quantity then
|
||||||
menu2.close()
|
TriggerServerEvent('esx:giveInventoryItem', selectedPlayerId, type, item, quantity)
|
||||||
menu1.close()
|
ESX.CloseContext()
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
||||||
end
|
end
|
||||||
end, function(data3, menu3)
|
end)
|
||||||
menu3.close()
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('in_vehicle'))
|
ESX.ShowNotification(TranslateCap('in_vehicle'))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('players_nearby'))
|
ESX.ShowNotification(TranslateCap('players_nearby'))
|
||||||
menu2.close()
|
ESX.CloseContext()
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end, players)
|
end, players)
|
||||||
else
|
|
||||||
ESX.ShowNotification(TranslateCap('players_nearby'))
|
|
||||||
end
|
end
|
||||||
elseif data1.current.action == 'remove' then
|
elseif element2.action == "remove" then
|
||||||
if IsPedOnFoot(playerPed) and not IsPedFalling(playerPed) then
|
if IsPedOnFoot(playerPed) and not IsPedFalling(playerPed) then
|
||||||
local dict, anim = 'weapons@first_person@aim_rng@generic@projectile@sticky_bomb@', 'plant_floor'
|
local dict, anim = 'weapons@first_person@aim_rng@generic@projectile@sticky_bomb@', 'plant_floor'
|
||||||
ESX.Streaming.RequestAnimDict(dict)
|
ESX.Streaming.RequestAnimDict(dict)
|
||||||
|
|
||||||
if type == 'item_weapon' then
|
if type == 'item_weapon' then
|
||||||
menu1.close()
|
ESX.CloseContext()
|
||||||
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
||||||
RemoveAnimDict(dict)
|
RemoveAnimDict(dict)
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
TriggerServerEvent('esx:removeInventoryItem', type, item)
|
TriggerServerEvent('esx:removeInventoryItem', type, item)
|
||||||
else
|
else
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'inventory_item_count_remove', {
|
local elementsR = {
|
||||||
title = TranslateCap('amount')
|
{unselectable = true, icon = "fas fa-trash", title = element.title},
|
||||||
}, function(data2, menu2)
|
{icon = "fas fa-tally", title = "Amount.", input = true, inputType = "number", inputPlaceholder = "Amount to remove..", inputMin = 1, inputMax = 1000},
|
||||||
local quantity = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
if quantity and quantity > 0 and data.current.count >= quantity then
|
ESX.OpenContext("right", elementsR, function(menuR,elementR)
|
||||||
menu2.close()
|
local quantity = tonumber(menuR.eles[2].inputValue)
|
||||||
menu1.close()
|
|
||||||
|
if quantity and quantity > 0 and element.count >= quantity then
|
||||||
|
ESX.CloseContext()
|
||||||
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
TaskPlayAnim(playerPed, dict, anim, 8.0, 1.0, 1000, 16, 0.0, false, false, false)
|
||||||
RemoveAnimDict(dict)
|
RemoveAnimDict(dict)
|
||||||
Wait(1000)
|
Wait(1000)
|
||||||
@@ -1307,17 +1309,16 @@ function ESX.ShowInventory()
|
|||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
elseif data1.current.action == 'use' then
|
elseif element2.action == "use" then
|
||||||
|
ESX.CloseContext()
|
||||||
TriggerServerEvent('esx:useItem', item)
|
TriggerServerEvent('esx:useItem', item)
|
||||||
elseif data1.current.action == 'return' then
|
elseif element2.action == "return" then
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
ESX.ShowInventory()
|
ESX.ShowInventory()
|
||||||
elseif data1.current.action == 'give_ammo' then
|
elseif element2.action == "give_ammo" then
|
||||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||||
local closestPed = GetPlayerPed(closestPlayer)
|
local closestPed = GetPlayerPed(closestPlayer)
|
||||||
local pedAmmo = GetAmmoInPedWeapon(playerPed, joaat(item))
|
local pedAmmo = GetAmmoInPedWeapon(playerPed, joaat(item))
|
||||||
@@ -1325,25 +1326,25 @@ function ESX.ShowInventory()
|
|||||||
if IsPedOnFoot(closestPed) and not IsPedFalling(closestPed) then
|
if IsPedOnFoot(closestPed) and not IsPedFalling(closestPed) then
|
||||||
if closestPlayer ~= -1 and closestDistance < 3.0 then
|
if closestPlayer ~= -1 and closestDistance < 3.0 then
|
||||||
if pedAmmo > 0 then
|
if pedAmmo > 0 then
|
||||||
ESX.UI.Menu.Open('dialog', GetCurrentResourceName(), 'inventory_item_count_give', {
|
local elementsGA = {
|
||||||
title = TranslateCap('amountammo')
|
{unselectable = true, icon = "fas fa-trash", title = element.title},
|
||||||
}, function(data2, menu2)
|
{icon = "fas fa-tally", title = "Amount.", input = true, inputType = "number", inputPlaceholder = "Amount to give..", inputMin = 1, inputMax = 1000},
|
||||||
local quantity = tonumber(data2.value)
|
{icon = "fas fa-check-double", title = "Confirm", val = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
|
ESX.OpenContext("right", elementsGA, function(menuGA,elementGA)
|
||||||
|
local quantity = tonumber(menuGA.eles[2].inputValue)
|
||||||
|
|
||||||
if quantity and quantity > 0 then
|
if quantity and quantity > 0 then
|
||||||
if pedAmmo >= quantity then
|
if pedAmmo >= quantity then
|
||||||
TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer),
|
TriggerServerEvent('esx:giveInventoryItem', GetPlayerServerId(closestPlayer), 'item_ammo', item, quantity)
|
||||||
'item_ammo', item, quantity)
|
ESX.CloseContext()
|
||||||
menu2.close()
|
|
||||||
menu1.close()
|
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('noammo'))
|
ESX.ShowNotification(TranslateCap('noammo'))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
||||||
end
|
end
|
||||||
end, function(data2, menu2)
|
|
||||||
menu2.close()
|
|
||||||
end)
|
end)
|
||||||
else
|
else
|
||||||
ESX.ShowNotification(TranslateCap('noammo'))
|
ESX.ShowNotification(TranslateCap('noammo'))
|
||||||
@@ -1355,12 +1356,7 @@ function ESX.ShowInventory()
|
|||||||
ESX.ShowNotification(TranslateCap('in_vehicle'))
|
ESX.ShowNotification(TranslateCap('in_vehicle'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, function(data1, menu1)
|
|
||||||
ESX.UI.Menu.CloseAll()
|
|
||||||
ESX.ShowInventory()
|
|
||||||
end)
|
end)
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -250,9 +250,7 @@ if not Config.OxInventory then
|
|||||||
ESX.UI.ShowInventoryItemNotification(true, item, count)
|
ESX.UI.ShowInventoryItemNotification(true, item, count)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
ESX.ShowInventory()
|
||||||
ESX.ShowInventory()
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('esx:removeInventoryItem')
|
RegisterNetEvent('esx:removeInventoryItem')
|
||||||
@@ -269,9 +267,7 @@ if not Config.OxInventory then
|
|||||||
ESX.UI.ShowInventoryItemNotification(false, item, count)
|
ESX.UI.ShowInventoryItemNotification(false, item, count)
|
||||||
end
|
end
|
||||||
|
|
||||||
if ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
ESX.ShowInventory()
|
||||||
ESX.ShowInventory()
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
RegisterNetEvent('esx:addWeapon')
|
RegisterNetEvent('esx:addWeapon')
|
||||||
@@ -442,7 +438,7 @@ end
|
|||||||
|
|
||||||
if not Config.OxInventory and Config.EnableDefaultInventory then
|
if not Config.OxInventory and Config.EnableDefaultInventory then
|
||||||
RegisterCommand('showinv', function()
|
RegisterCommand('showinv', function()
|
||||||
if not ESX.PlayerData.dead and not ESX.UI.Menu.IsOpen('default', 'es_extended', 'inventory') then
|
if not ESX.PlayerData.dead then
|
||||||
ESX.ShowInventory()
|
ESX.ShowInventory()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ if ESX.GetConfig().Multichar then
|
|||||||
RenderScriptCams(true, false, 1, true, true)
|
RenderScriptCams(true, false, 1, true, true)
|
||||||
SetCamCoord(cam, offset.x, offset.y, offset.z)
|
SetCamCoord(cam, offset.x, offset.y, offset.z)
|
||||||
PointCamAtCoord(cam, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z + 1.3)
|
PointCamAtCoord(cam, Config.Spawn.x, Config.Spawn.y, Config.Spawn.z + 1.3)
|
||||||
ESX.UI.Menu.CloseAll()
|
|
||||||
ESX.UI.HUD.SetDisplay(0.0)
|
ESX.UI.HUD.SetDisplay(0.0)
|
||||||
StartLoop()
|
StartLoop()
|
||||||
ShutdownLoadingScreen()
|
ShutdownLoadingScreen()
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ end)
|
|||||||
|
|
||||||
AddEventHandler('esx_shops:hasExitedMarker', function(zone)
|
AddEventHandler('esx_shops:hasExitedMarker', function(zone)
|
||||||
currentAction = nil
|
currentAction = nil
|
||||||
ESX.UI.Menu.CloseAll()
|
ESX.CloseContext()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Create Blips
|
-- Create Blips
|
||||||
|
|||||||
@@ -238,15 +238,18 @@ function OpenMobileTaxiActionsMenu()
|
|||||||
|
|
||||||
ESX.OpenContext("right", elements, function(menu,element)
|
ESX.OpenContext("right", elements, function(menu,element)
|
||||||
if element.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-taxi", title = element.title},
|
||||||
}, function(data, menu)
|
{title = "Amount", input = true, inputType = "number", inputMin = 1, inputMax = 250000, inputPlaceholder = "Amount to bill.."},
|
||||||
|
{icon = "fas fa-check-double", title = "Confirm", value = "confirm"}
|
||||||
|
}
|
||||||
|
|
||||||
local amount = tonumber(data.value)
|
ESX.OpenContext("right", elements2, function(menu2,element2)
|
||||||
|
local amount = tonumber(menu2.eles[2].inputValue)
|
||||||
if amount == nil then
|
if amount == nil then
|
||||||
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
ESX.ShowNotification(TranslateCap('amount_invalid'))
|
||||||
else
|
else
|
||||||
menu.close()
|
ESX.CloseContext()
|
||||||
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
local closestPlayer, closestDistance = ESX.Game.GetClosestPlayer()
|
||||||
if closestPlayer == -1 or closestDistance > 3.0 then
|
if closestPlayer == -1 or closestDistance > 3.0 then
|
||||||
ESX.ShowNotification(TranslateCap('no_players_near'))
|
ESX.ShowNotification(TranslateCap('no_players_near'))
|
||||||
@@ -256,8 +259,6 @@ function OpenMobileTaxiActionsMenu()
|
|||||||
ESX.ShowNotification(TranslateCap('billing_sent'))
|
ESX.ShowNotification(TranslateCap('billing_sent'))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end, function(data, menu)
|
|
||||||
menu.close()
|
|
||||||
end)
|
end)
|
||||||
elseif element.value == "start_job" then
|
elseif element.value == "start_job" then
|
||||||
if OnJob then
|
if OnJob then
|
||||||
|
|||||||
Reference in New Issue
Block a user