structura foldere
mutat kq- folders in un singur folder [kq]
This commit is contained in:
+118
@@ -0,0 +1,118 @@
|
||||
if Config.MenuType ~= 'esx_context' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.Framework == 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
function OpenCopyKeys()
|
||||
local elements = {}
|
||||
TriggerServerCallback(Config.Eventprefix..':server:getVehicles', function(vehicles)
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE")
|
||||
})
|
||||
for _,v in pairs(vehicles) do
|
||||
local hashVehicule = v.vehicle.model
|
||||
local plate = v.vehicle.plate
|
||||
local vehicleName = GetDisplayNameFromVehicleModel(hashVehicule)
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_MODEL").." " .. vehicleName .. " ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate ,
|
||||
name = "take",
|
||||
metadata = {vehicleName, plate}
|
||||
})
|
||||
end
|
||||
ESX.OpenContext("right" , elements, function(menu,element)
|
||||
if element.name == "take" then
|
||||
clonekey(element.metadata[2], element.metadata[1])
|
||||
ESX.CloseContext()
|
||||
end
|
||||
end, function(menu)
|
||||
ESX.CloseContext()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenPlateMenu()
|
||||
|
||||
if Config.PlateType == 'menu' then
|
||||
|
||||
|
||||
local elements = {}
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_BUY_PLATE")
|
||||
})
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_BUY_PLATE_DESCRIPTION")..Config.NPCPlatePrice['price'],
|
||||
name = "take",
|
||||
})
|
||||
table.insert(elements, {
|
||||
title = Lang('VEHICLEKEYS_MENU_BUY_CHANGEPLATE_DESCRIPTION') .. Config.ChangePlateItemPrice['price'],
|
||||
name = "screwdriver",
|
||||
})
|
||||
ESX.OpenContext("right" , elements, function(menu,element)
|
||||
if element.name == "take" then
|
||||
TriggerEvent(Config.Eventprefix..':buyPlate')
|
||||
ESX.CloseContext()
|
||||
elseif element.name == "screwdriver" then
|
||||
TriggerEvent(Config.Eventprefix..':buyScrewdriver')
|
||||
ESX.CloseContext()
|
||||
end
|
||||
end, function(menu)
|
||||
ESX.CloseContext()
|
||||
end)
|
||||
|
||||
end
|
||||
|
||||
if Config.PlateType == 'shop' then
|
||||
|
||||
local generatePlate = GeneratePlate()
|
||||
local plate = {
|
||||
plate = generatePlate,
|
||||
}
|
||||
local shop = Lang('VEHICLEKEYS_PLATE_SHOP_NAME')
|
||||
local ShopItems = {
|
||||
label = Lang('VEHICLEKEYS_PLATE_SHOP_LABEL'),
|
||||
items = {
|
||||
{name = Config.PlateItem ,amount = 1, price = Config.PlatePrice['price'], slot= 1, info = plate },
|
||||
{name = Config.ChangePlateItem, amount = 1, price = Config.ChangePlateItemPrice['price'], slot = 2 },
|
||||
},
|
||||
}
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", shop, ShopItems)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function OpenTrackerMenu(gpsdata)
|
||||
local addedVehicles = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:GetPlayerIdentifier', function(PlayerIdentifier)
|
||||
local elements = {}
|
||||
|
||||
for _, v in ipairs(gpsdata) do
|
||||
if v.Player == PlayerIdentifier and not addedVehicles[v.plate] then
|
||||
table.insert(elements, {
|
||||
icon = 'car',
|
||||
title = string.format(Lang('VEHICLEKEYS_TRACKER_MENU_DESC'), v.plate),
|
||||
value = v.plate
|
||||
})
|
||||
addedVehicles[v.plate] = true
|
||||
end
|
||||
end
|
||||
|
||||
if #elements == 0 then
|
||||
table.insert(elements, {
|
||||
icon = 'times',
|
||||
title = Lang('VEHICLEKEYS_TRACKER_NO_VEHICLES'),
|
||||
disabled = true
|
||||
})
|
||||
end
|
||||
|
||||
ESX.OpenContext("right" , elements, function(data)
|
||||
if data.current.value then
|
||||
TriggerEvent(Config.Eventprefix..':client:LocateVehicleWithPlate', data.current.value)
|
||||
end
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+296
@@ -0,0 +1,296 @@
|
||||
if Config.MenuType ~= 'esx_menu_default' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.Framework == 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.InventoryScript == 'qs' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'ox' then
|
||||
function GetPlateFromItem(item)
|
||||
local plate = item.metadata and item.metadata.plate or nil
|
||||
return plate
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
local model = item.metadata and item.metadata.model or nil
|
||||
return model
|
||||
end
|
||||
elseif Config.InventoryScript == 'qb' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'codem' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info[1] and item.info[1].description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'core_inventory' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
else
|
||||
-- Handle other cases or provide a default implementation
|
||||
function GetPlateFromItem(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function OpenCopyKeys()
|
||||
local vehicleMenuElements = {
|
||||
{
|
||||
label = Lang("VEHICLEKEYS_MENU_OWNED_VEHICLES") .. ' - $' .. Config.CopyKeysCost,
|
||||
name = "owned_vehicles",
|
||||
icon = 'car',
|
||||
},
|
||||
{
|
||||
label = Lang("VEHICLEKEYS_MENU_OWNED_KEYS") .. ' - $' .. Config.InventoryCopyKeysCost,
|
||||
name = "owned_keys",
|
||||
icon = 'key',
|
||||
},
|
||||
}
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_keys_menu_choice', {
|
||||
title = Lang("VEHICLEKEYS_MENU_CHOICE_TITLE"),
|
||||
align = Config.MenuPlacement,
|
||||
elements = vehicleMenuElements,
|
||||
}, function(data, menu)
|
||||
-- Handle menu interactions here
|
||||
local currentElement = data.current
|
||||
|
||||
if currentElement.name == "owned_vehicles" then
|
||||
OpenVehicleKeysMenu()
|
||||
elseif currentElement.name == "owned_keys" then
|
||||
OpenOwnedKeysMenu()
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenVehicleKeysMenu()
|
||||
local vehicleMenuElements = {}
|
||||
TriggerServerCallback(Config.Eventprefix..':server:getVehicles', function(vehicles)
|
||||
if Config.Debug then
|
||||
print(json.encode(vehicles))
|
||||
end
|
||||
|
||||
for _,v in pairs(vehicles) do
|
||||
local hashVehicle = v.vehicle.model
|
||||
local plate = v.vehicle.plate
|
||||
local vehicleName = GetDisplayNameFromVehicleModel(hashVehicle)
|
||||
|
||||
print("Plate: " .. plate)
|
||||
print("Vehicle Name: " .. vehicleName)
|
||||
|
||||
|
||||
table.insert(vehicleMenuElements, {
|
||||
label = Lang("VEHICLEKEYS_MENU_MODEL").." " .. vehicleName .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'car',
|
||||
value = {plate = plate, model = vehicleName},
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(vehicleMenuElements, {
|
||||
label = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
action = "back",
|
||||
})
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_keys_menu', {
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
align = Config.MenuPlacement,
|
||||
elements = vehicleMenuElements,
|
||||
}, function(data, menu)
|
||||
local currentElement = data.current
|
||||
if currentElement.action == "back" then
|
||||
OpenCopyKeys()
|
||||
else
|
||||
clonekey(data.current.value.plate, data.current.value.model, true, Config.CopyKeysCost)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenOwnedKeysMenu()
|
||||
local elements = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix .. ':server:GetPlayerItems', function(items)
|
||||
if items then
|
||||
local keysFound = false
|
||||
|
||||
for _, item in pairs(items) do
|
||||
local plate = GetPlateFromItem(item)
|
||||
local model = GetModelFromItem(item)
|
||||
|
||||
print("Plate:", plate)
|
||||
print("Model:", model)
|
||||
|
||||
if plate and model then
|
||||
table.insert(elements, {
|
||||
label = Lang("VEHICLEKEYS_MENU_MODEL").." " .. model .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'key',
|
||||
value = {plate = plate, model = model},
|
||||
})
|
||||
|
||||
keysFound = true
|
||||
end
|
||||
end
|
||||
|
||||
if not keysFound then
|
||||
table.insert(elements, {
|
||||
label = Lang("NO_KEYS_FOUND"),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
action = "none",
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(elements, {
|
||||
label = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
action = "back",
|
||||
})
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_keys_menu', {
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
align = Config.MenuPlacement,
|
||||
elements = elements,
|
||||
}, function(data, menu)
|
||||
-- Handle menu interactions here
|
||||
local currentElement = data.current
|
||||
|
||||
if currentElement.action == "back" then
|
||||
OpenCopyKeys()
|
||||
elseif currentElement.action == "none" then
|
||||
return
|
||||
else
|
||||
clonekey(data.current.value.plate, data.current.value.model, true, Config.InventoryCopyKeysCost)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenPlateMenu()
|
||||
if Config.PlateType == 'menu' then
|
||||
local plateMenuElements = {
|
||||
{
|
||||
label = Lang('VEHICLEKEYS_MENU_BUY_PLATE_DESCRIPTION') .. ' - $' .. Config.PlatePrice['price'],
|
||||
name = "buy_plate",
|
||||
icon = 'car',
|
||||
onSelect = function(args, menu)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyPlate')
|
||||
end,
|
||||
},
|
||||
{
|
||||
label = Lang('VEHICLEKEYS_MENU_BUY_CHANGEPLATE_DESCRIPTION') .. ' - $' .. Config.ChangePlateItemPrice['price'],
|
||||
name = "buy_change_plate",
|
||||
icon = 'screwdriver',
|
||||
onSelect = function(args, menu)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyScrewdriver')
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
ESX.UI.Menu.CloseAll()
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehicle_keys_menu_plate', {
|
||||
title = Lang('VEHICLEKEYS_MENU_TITLE_PLATE'),
|
||||
align = Config.MenuPlacement,
|
||||
elements = plateMenuElements,
|
||||
}, function(data, menu)
|
||||
-- Handle menu interactions here
|
||||
local currentElement = data.current
|
||||
|
||||
if currentElement.name == "buy_plate" then
|
||||
TriggerEvent(Config.Eventprefix .. ':buyPlate')
|
||||
elseif currentElement.name == "buy_change_plate" then
|
||||
TriggerEvent(Config.Eventprefix .. ':buyScrewdriver')
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
elseif Config.PlateType == 'shop' then
|
||||
local generatePlate = GeneratePlate()
|
||||
local plate = {
|
||||
plate = generatePlate,
|
||||
}
|
||||
local shop = Lang('VEHICLEKEYS_PLATE_SHOP_NAME')
|
||||
local shopItems = {
|
||||
label = Lang('VEHICLEKEYS_PLATE_SHOP_LABEL'),
|
||||
items = {
|
||||
{name = Config.PlateItem, amount = 1, price = Config.PlatePrice['price'], slot = 1, info = plate},
|
||||
{name = Config.ChangePlateItem, amount = 1, price = Config.ChangePlateItemPrice['price'], slot = 2},
|
||||
},
|
||||
}
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", shop, ShopItems)
|
||||
end
|
||||
end
|
||||
|
||||
function OpenTrackerMenu(gpsdata)
|
||||
local addedVehicles = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:GetPlayerIdentifier', function(PlayerIdentifier)
|
||||
local elements = {}
|
||||
|
||||
for _, v in ipairs(gpsdata) do
|
||||
if v.Player == PlayerIdentifier and not addedVehicles[v.plate] then
|
||||
table.insert(elements, {
|
||||
label = string.format(Lang('VEHICLEKEYS_TRACKER_MENU_DESC'), v.plate),
|
||||
icon = 'car',
|
||||
value = v.plate
|
||||
})
|
||||
addedVehicles[v.plate] = true
|
||||
end
|
||||
end
|
||||
|
||||
if #elements == 0 then
|
||||
table.insert(elements, {
|
||||
label = Lang('VEHICLEKEYS_TRACKER_NO_VEHICLES'),
|
||||
disabled = true
|
||||
})
|
||||
end
|
||||
|
||||
ESX.UI.Menu.Open('default', GetCurrentResourceName(), 'vehiclekeys_gps_menu', {
|
||||
title = Lang('VEHICLEKEYS_TRACKER_MENU_TITLE'),
|
||||
align = 'top-left',
|
||||
elements = elements
|
||||
}, function(data, menu)
|
||||
if data.current.value then
|
||||
TriggerEvent(Config.Eventprefix..':client:LocateVehicleWithPlate', data.current.value)
|
||||
end
|
||||
end, function(data, menu)
|
||||
menu.close()
|
||||
end)
|
||||
end)
|
||||
end
|
||||
+240
@@ -0,0 +1,240 @@
|
||||
if Config.MenuType ~= 'ox_lib' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.Framework == 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.InventoryScript == 'qs' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'ox' then
|
||||
function GetPlateFromItem(item)
|
||||
local plate = item.metadata and item.metadata.plate or nil
|
||||
return plate
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
local model = item.metadata and item.metadata.model or nil
|
||||
return model
|
||||
end
|
||||
elseif Config.InventoryScript == 'qb' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'codem' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info[1] and item.info[1].description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'core_inventory' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
else
|
||||
-- Handle other cases or provide a default implementation
|
||||
function GetPlateFromItem(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function OpenCopyKeys()
|
||||
local elements = {}
|
||||
local vehicleMenu = {
|
||||
{
|
||||
title = Lang("VEHICLEKEYS_MENU_OWNED_VEHICLES") .. ' - $' .. Config.CopyKeysCost,
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
OpenVehicleKeysMenu()
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = Lang("VEHICLEKEYS_MENU_OWNED_KEYS") .. ' - $' .. Config.InventoryCopyKeysCost,
|
||||
icon = 'key',
|
||||
onSelect = function(args)
|
||||
OpenOwnedKeysMenu()
|
||||
end,
|
||||
},
|
||||
}
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_CHOICE',
|
||||
title = Lang("VEHICLEKEYS_MENU_CHOICE_TITLE"),
|
||||
options = vehicleMenu,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_CHOICE')
|
||||
end
|
||||
|
||||
function OpenVehicleKeysMenu()
|
||||
local elements = {}
|
||||
TriggerServerCallback(Config.Eventprefix..':server:getVehicles', function(vehicles)
|
||||
if Config.Debug then
|
||||
print(json.encode(vehicles))
|
||||
end
|
||||
for _,v in pairs(vehicles) do
|
||||
local hashVehicule = v.vehicle.model
|
||||
local plate = v.vehicle.plate
|
||||
local vehicleName = GetDisplayNameFromVehicleModel(hashVehicule)
|
||||
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_MODEL").." " .. vehicleName .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
clonekey(plate, vehicleName, true, Config.CopyKeysCost)
|
||||
end,
|
||||
})
|
||||
end
|
||||
table.insert(elements, {
|
||||
title = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
onSelect = function(args)
|
||||
OpenCopyKeys()
|
||||
end,
|
||||
})
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE',
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
options = elements,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE')
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenOwnedKeysMenu()
|
||||
local elements = {}
|
||||
TriggerServerCallback(Config.Eventprefix .. ':server:GetPlayerItems', function(items)
|
||||
if items then
|
||||
local keysFound = false
|
||||
for _, item in pairs(items) do
|
||||
local plate = GetPlateFromItem(item)
|
||||
local model = GetModelFromItem(item)
|
||||
if plate and model then
|
||||
keysFound = true
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_MODEL").." " .. model .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'key',
|
||||
onSelect = function(args)
|
||||
clonekey(plate, model, true, Config.InventoryCopyKeysCost)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
if not keysFound then
|
||||
table.insert(elements, {
|
||||
title = Lang("NO_KEYS_FOUND"),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
table.insert(elements, {
|
||||
title = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
onSelect = function(args)
|
||||
OpenCopyKeys()
|
||||
end,
|
||||
})
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE',
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
options = elements,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE')
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenPlateMenu()
|
||||
if Config.PlateType == 'menu' then
|
||||
local elements = {}
|
||||
|
||||
table.insert(elements, {
|
||||
title = Lang('VEHICLEKEYS_MENU_BUY_PLATE_DESCRIPTION') .. ' - $' .. Config.PlatePrice['price'],
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyPlate')
|
||||
end,
|
||||
})
|
||||
|
||||
table.insert(elements, {
|
||||
title = Lang('VEHICLEKEYS_MENU_BUY_CHANGEPLATE_DESCRIPTION') .. ' - $' .. Config.ChangePlateItemPrice['price'],
|
||||
icon = 'screwdriver',
|
||||
onSelect = function(args)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyScrewdriver')
|
||||
end,
|
||||
})
|
||||
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE_PLATE',
|
||||
title = Lang('VEHICLEKEYS_MENU_TITLE_PLATE'),
|
||||
options = elements,
|
||||
})
|
||||
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE_PLATE')
|
||||
end
|
||||
|
||||
if Config.PlateType == 'shop' then
|
||||
local generatePlate = GeneratePlate()
|
||||
local plate = { plate = generatePlate }
|
||||
local shop = Lang('VEHICLEKEYS_PLATE_SHOP_NAME')
|
||||
local ShopItems = {
|
||||
label = Lang('VEHICLEKEYS_PLATE_SHOP_LABEL'),
|
||||
items = {
|
||||
{ name = Config.PlateItem, amount = 1, price = Config.PlatePrice['price'], slot = 1, info = plate },
|
||||
{ name = Config.ChangePlateItem, amount = 1, price = Config.ChangePlateItemPrice['price'], slot = 2 },
|
||||
},
|
||||
}
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", shop, ShopItems)
|
||||
end
|
||||
end
|
||||
|
||||
function OpenTrackerMenu(gpsdata)
|
||||
local addedVehicles = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:GetPlayerIdentifier', function(PlayerIdentifier)
|
||||
lib.registerContext({
|
||||
id = 'vehiclekeys_gps_menu',
|
||||
title = Lang('VEHICLEKEYS_TRACKER_MENU_TITLE'),
|
||||
options = (function()
|
||||
local options = {}
|
||||
for _, v in ipairs(gpsdata) do
|
||||
if v.Player == PlayerIdentifier and not addedVehicles[v.plate] then
|
||||
table.insert(options, {
|
||||
title = v.model,
|
||||
description = string.format(Lang('VEHICLEKEYS_TRACKER_MENU_DESC'), v.plate),
|
||||
icon = 'car',
|
||||
onSelect = function() TriggerEvent(Config.Eventprefix..':client:LocateVehicleWithPlate', v.plate) end
|
||||
})
|
||||
addedVehicles[v.plate] = true
|
||||
end
|
||||
end
|
||||
if #options == 0 then
|
||||
table.insert(options, { title = Lang('VEHICLEKEYS_TRACKER_NO_VEHICLES'), disabled = true })
|
||||
end
|
||||
return options
|
||||
end)()
|
||||
})
|
||||
|
||||
lib.showContext('vehiclekeys_gps_menu')
|
||||
end)
|
||||
end
|
||||
|
||||
+260
@@ -0,0 +1,260 @@
|
||||
if Config.MenuType ~= 'ox_lib' then
|
||||
return
|
||||
end
|
||||
if Config.Framework == 'esx' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.InventoryScript == 'qs' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'ox' then
|
||||
function GetPlateFromItem(item)
|
||||
local plate = item.metadata and item.metadata.plate or nil
|
||||
return plate
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
local model = item.metadata and item.metadata.model or nil
|
||||
return model
|
||||
end
|
||||
elseif Config.InventoryScript == 'qb' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'codem' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info[1] and item.info[1].description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'core_inventory' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
else
|
||||
-- Handle other cases or provide a default implementation
|
||||
function GetPlateFromItem(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function OpenCopyKeys()
|
||||
local elements = {}
|
||||
local vehicleMenu = {
|
||||
{
|
||||
title = Lang("VEHICLEKEYS_MENU_OWNED_VEHICLES") .. ' - $' .. Config.CopyKeysCost,
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
OpenVehicleKeysMenu()
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = Lang("VEHICLEKEYS_MENU_OWNED_KEYS") .. ' - $' .. Config.InventoryCopyKeysCost,
|
||||
icon = 'key',
|
||||
onSelect = function(args)
|
||||
OpenOwnedKeysMenu()
|
||||
end,
|
||||
},
|
||||
}
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_CHOICE',
|
||||
title = Lang("VEHICLEKEYS_MENU_CHOICE_TITLE"),
|
||||
options = vehicleMenu,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_CHOICE')
|
||||
end
|
||||
|
||||
function OpenVehicleKeysMenu()
|
||||
local elements = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:getVehicles', function(vehicles)
|
||||
if not vehicles or #vehicles == 0 then
|
||||
print('No vehicles received from server callback')
|
||||
return
|
||||
end
|
||||
print(json.encode(vehicles))
|
||||
for _, v in pairs(vehicles) do
|
||||
local vehicleData = QBCore.Shared.Vehicles[v.vehicle]
|
||||
local vehicleName = vehicleData and vehicleData['name']
|
||||
|
||||
if not v.vehicle then
|
||||
print('Missing vehicle information:', v.vehicle)
|
||||
elseif not v.plate then
|
||||
print('Missing plate information for vehicle:', v.vehicle)
|
||||
elseif not vehicleName then
|
||||
print('Missing vehicle details:', v.vehicle, 'QBShared:', vehicleData or 'nil')
|
||||
else
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_MODEL").." " .. vehicleName .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. v.plate,
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
clonekey(v.plate, vehicleData['model'], true, Config.CopyKeysCost)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
table.insert(elements, {
|
||||
title = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
onSelect = function(args)
|
||||
OpenCopyKeys()
|
||||
end,
|
||||
})
|
||||
|
||||
if #elements > 0 then
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE',
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
options = elements,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE')
|
||||
else
|
||||
print('No valid vehicles to display in the menu')
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenOwnedKeysMenu()
|
||||
local elements = {}
|
||||
TriggerServerCallback(Config.Eventprefix .. ':server:GetPlayerItems', function(items)
|
||||
if items then
|
||||
local keysFound = false
|
||||
for _, item in pairs(items) do
|
||||
local plate = GetPlateFromItem(item)
|
||||
local model = GetModelFromItem(item)
|
||||
if plate and model then
|
||||
keysFound = true
|
||||
table.insert(elements, {
|
||||
title = Lang("VEHICLEKEYS_MENU_MODEL").." " .. model .. ", ".. Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'key',
|
||||
onSelect = function(args)
|
||||
clonekey(plate, model, true, Config.InventoryCopyKeysCost)
|
||||
end,
|
||||
})
|
||||
end
|
||||
end
|
||||
if not keysFound then
|
||||
table.insert(elements, {
|
||||
title = Lang("NO_KEYS_FOUND"),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
})
|
||||
end
|
||||
end
|
||||
table.insert(elements, {
|
||||
title = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
onSelect = function(args)
|
||||
OpenCopyKeys()
|
||||
end,
|
||||
})
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE',
|
||||
title = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
options = elements,
|
||||
})
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE')
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenPlateMenu()
|
||||
|
||||
if Config.PlateType == 'menu' then
|
||||
|
||||
local elements = {}
|
||||
table.insert(elements, {
|
||||
title = Lang('VEHICLEKEYS_MENU_BUY_PLATE_DESCRIPTION') .. ' - $' .. Config.PlatePrice['price'],
|
||||
icon = 'car',
|
||||
onSelect = function(args)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyPlate')
|
||||
end,
|
||||
})
|
||||
table.insert(elements, {
|
||||
title = Lang('VEHICLEKEYS_MENU_BUY_CHANGEPLATE_DESCRIPTION') .. ' - $' .. Config.ChangePlateItemPrice['price'],
|
||||
icon = 'screwdriver',
|
||||
onSelect = function(args)
|
||||
TriggerEvent(Config.Eventprefix .. ':buyScrewdriver')
|
||||
end,
|
||||
})
|
||||
|
||||
lib.registerContext({
|
||||
id = 'VEHICLEKEYS_MENU_TITLE_PLATE',
|
||||
title = Lang('VEHICLEKEYS_MENU_TITLE_PLATE'),
|
||||
options = elements,
|
||||
})
|
||||
|
||||
lib.showContext('VEHICLEKEYS_MENU_TITLE_PLATE')
|
||||
|
||||
end
|
||||
|
||||
if Config.PlateType == 'shop' then
|
||||
|
||||
local generatePlate = GeneratePlate()
|
||||
local plate = {
|
||||
plate = generatePlate,
|
||||
}
|
||||
local shop = Lang('VEHICLEKEYS_PLATE_SHOP_NAME')
|
||||
local ShopItems = {
|
||||
label = Lang('VEHICLEKEYS_PLATE_SHOP_LABEL'),
|
||||
items = {
|
||||
{name = Config.PlateItem ,amount = 1, price = Config.PlatePrice['price'], slot= 1, info = plate },
|
||||
{name = Config.ChangePlateItem, amount = 1, price = Config.ChangePlateItemPrice['price'], slot = 2 },
|
||||
},
|
||||
}
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", shop, ShopItems)
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function OpenTrackerMenu(gpsdata)
|
||||
local addedVehicles = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:GetPlayerIdentifier', function(PlayerIdentifier)
|
||||
lib.registerContext({
|
||||
id = 'vehiclekeys_gps_menu',
|
||||
title = Lang('VEHICLEKEYS_TRACKER_MENU_TITLE'),
|
||||
options = (function()
|
||||
local options = {}
|
||||
for _, v in ipairs(gpsdata) do
|
||||
if v.Player == PlayerIdentifier and not addedVehicles[v.plate] then
|
||||
table.insert(options, {
|
||||
title = v.model,
|
||||
description = string.format(Lang('VEHICLEKEYS_TRACKER_MENU_DESC'), v.plate),
|
||||
icon = 'car',
|
||||
onSelect = function() TriggerEvent(Config.Eventprefix..':client:LocateVehicleWithPlate', v.plate) end
|
||||
})
|
||||
addedVehicles[v.plate] = true
|
||||
end
|
||||
end
|
||||
if #options == 0 then
|
||||
table.insert(options, { title = Lang('VEHICLEKEYS_TRACKER_NO_VEHICLES'), disabled = true })
|
||||
end
|
||||
return options
|
||||
end)()
|
||||
})
|
||||
|
||||
lib.showContext('vehiclekeys_gps_menu')
|
||||
end)
|
||||
end
|
||||
@@ -0,0 +1,306 @@
|
||||
if Config.MenuType ~= 'qb' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.Framework == 'esx' then
|
||||
return
|
||||
end
|
||||
|
||||
if Config.InventoryScript == 'qs' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'ox' then
|
||||
function GetPlateFromItem(item)
|
||||
local plate = item.metadata and item.metadata.plate or nil
|
||||
return plate
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
local model = item.metadata and item.metadata.model or nil
|
||||
return model
|
||||
end
|
||||
elseif Config.InventoryScript == 'qb' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'codem' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info[1] and item.info[1].description or nil
|
||||
end
|
||||
elseif Config.InventoryScript == 'core_inventory' then
|
||||
function GetPlateFromItem(item)
|
||||
return item.info and item.info.plate or nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return item.info and item.info.description or nil
|
||||
end
|
||||
else
|
||||
-- Handle other cases or provide a default implementation
|
||||
function GetPlateFromItem(item)
|
||||
return nil
|
||||
end
|
||||
|
||||
function GetModelFromItem(item)
|
||||
return nil
|
||||
end
|
||||
end
|
||||
|
||||
function OpenCopyKeys()
|
||||
local elements = {}
|
||||
|
||||
-- Ensure Config is defined and has the expected properties
|
||||
if not Config or not Config.MenuType or not Config.CopyKeysCost or not Config.InventoryCopyKeysCost then
|
||||
print("Error: Config is not properly defined.")
|
||||
return
|
||||
end
|
||||
|
||||
-- Add the menu header
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_CHOICE_TITLE"),
|
||||
icon = 'fa-solid fa-infinity',
|
||||
isMenuHeader = true,
|
||||
})
|
||||
|
||||
-- Add menu options
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_OWNED_VEHICLES") .. ' - $' .. Config.CopyKeysCost,
|
||||
icon = 'car',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = OpenVehicleKeysMenu, -- Reference to the function without ()
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_OWNED_KEYS") .. ' - $' .. Config.InventoryCopyKeysCost,
|
||||
icon = 'key',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = OpenOwnedKeysMenu, -- Reference to the function without ()
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
|
||||
-- Ensure 'qb-menu' is set correctly
|
||||
if not exports['qb-menu'] then
|
||||
print("Error: qb-menu resource not found.")
|
||||
return
|
||||
end
|
||||
|
||||
exports['qb-menu']:openMenu(elements)
|
||||
end
|
||||
|
||||
|
||||
function OpenVehicleKeysMenu()
|
||||
local elements = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:getVehicles', function(vehicles)
|
||||
table.insert(elements, {
|
||||
isMenuHeader = true,
|
||||
header = Lang("VEHICLEKEYS_MENU_TITLE"),
|
||||
icon = 'fa-solid fa-infinity'
|
||||
})
|
||||
|
||||
for k,v in pairs(vehicles) do -- loop through our table
|
||||
if not v.vehicle then
|
||||
return print('Missing vehicle:', v.vehicle)
|
||||
elseif not v.plate then
|
||||
return print('Missing plate:', v.plate, ' Vehicle:', v.vehicle)
|
||||
end
|
||||
|
||||
if not QBCore.Shared.Vehicles or not QBCore.Shared.Vehicles[v.vehicle] or not QBCore.Shared.Vehicles[v.vehicle]['name'] then
|
||||
return print('Missing vehicle details:', v.vehicle, 'QBShared : ', QBCore.Shared.Vehicles[v.vehicle] and QBCore.Shared.Vehicles[v.vehicle]['name'] or 'nil')
|
||||
end
|
||||
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_MODEL").." " .. QBCore.Shared.Vehicles[v.vehicle]['name'] .. " ",
|
||||
txt = Lang("VEHICLEKEYS_MENU_PLATE").." " .. v.plate,
|
||||
icon = 'fa-solid fa-face-grin-tears',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = function()
|
||||
clonekey(v.plate, QBCore.Shared.Vehicles[v.vehicle]['model'], true, Config.CopyKeysCost)
|
||||
end,
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
table.insert(elements, {
|
||||
header = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = OpenCopyKeys,
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
exports[qb_menu_name]:openMenu(elements) -- open our menu
|
||||
end)
|
||||
end
|
||||
|
||||
function OpenOwnedKeysMenu()
|
||||
local elements = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix .. ':server:GetPlayerItems', function(items)
|
||||
if items and next(items) ~= nil then -- Check if items is not empty
|
||||
local keysFound = false
|
||||
for _, item in pairs(items) do
|
||||
local plate = GetPlateFromItem(item)
|
||||
local model = GetModelFromItem(item)
|
||||
if plate and model then
|
||||
keysFound = true
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_MODEL").." " .. model .. " ",
|
||||
txt = Lang("VEHICLEKEYS_MENU_PLATE").." " .. plate,
|
||||
icon = 'fa-solid fa-face-grin-tears',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = function()
|
||||
clonekey(plate, model, true, Config.InventoryCopyKeysCost)
|
||||
end,
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
if not keysFound then
|
||||
table.insert(elements, {
|
||||
header = Lang("NO_KEYS_FOUND"),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
})
|
||||
end
|
||||
else
|
||||
table.insert(elements, {
|
||||
header = Lang("NO_KEYS_FOUND"),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(elements, {
|
||||
header = Lang("BACK_TO_PREVIOUS_MENU"),
|
||||
icon = 'arrow-left',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = OpenCopyKeys,
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
|
||||
-- Adapt the following lines for qb-menu
|
||||
exports['qb-menu']:openMenu(elements) -- open our menu
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
|
||||
function OpenPlateMenu()
|
||||
if Config.PlateType == 'menu' then
|
||||
local elements = {}
|
||||
table.insert(elements, {
|
||||
isHeader = true,
|
||||
header = Lang("VEHICLEKEYS_MENU_TITLE_PLATE"),
|
||||
icon = 'fa-solid fa-toolbox',
|
||||
isMenuHeader = true,
|
||||
})
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_BUY_PLATE"),
|
||||
txt = Lang("VEHICLEKEYS_MENU_BUY_PLATE_DESCRIPTION")..Config.PlatePrice['price'],
|
||||
icon = 'fa-solid fa-face-grin-tears',
|
||||
params = {
|
||||
event = Config.Eventprefix..':buyPlate',
|
||||
}
|
||||
})
|
||||
table.insert(elements, {
|
||||
header = Lang("VEHICLEKEYS_MENU_BUY_SCREWDRIVER"),
|
||||
txt = Lang('VEHICLEKEYS_MENU_BUY_CHANGEPLATE_DESCRIPTION') .. Config.ChangePlateItemPrice['price'],
|
||||
icon = 'fa-solid fa-screwdriver',
|
||||
params = {
|
||||
event = Config.Eventprefix..':buyScrewdriver',
|
||||
}
|
||||
})
|
||||
exports[qb_menu_name]:openMenu(elements)
|
||||
end
|
||||
if Config.PlateType == 'shop' then
|
||||
local generatePlate = GeneratePlate()
|
||||
local plate = {
|
||||
plate = generatePlate,
|
||||
}
|
||||
local shop = Lang('VEHICLEKEYS_PLATE_SHOP_NAME')
|
||||
local ShopItems = {
|
||||
label = Lang('VEHICLEKEYS_PLATE_SHOP_LABEL'),
|
||||
items = {
|
||||
{name = Config.PlateItem ,amount = 1, price = Config.PlatePrice['price'], slot= 1, info = plate },
|
||||
{name = Config.ChangePlateItem, amount = 1, price = Config.ChangePlateItemPrice['price'], slot = 2 },
|
||||
},
|
||||
}
|
||||
TriggerServerEvent("inventory:server:OpenInventory", "shop", shop, ShopItems)
|
||||
end
|
||||
end
|
||||
|
||||
function OpenTrackerMenu(gpsdata)
|
||||
local addedVehicles = {}
|
||||
|
||||
TriggerServerCallback(Config.Eventprefix..':server:GetPlayerIdentifier', function(PlayerIdentifier)
|
||||
local elements = {}
|
||||
|
||||
for _, v in ipairs(gpsdata) do
|
||||
if v.Player == PlayerIdentifier and not addedVehicles[v.plate] then
|
||||
table.insert(elements, {
|
||||
header = string.format(Lang('VEHICLEKEYS_TRACKER_MENU_DESC'), v.plate),
|
||||
txt = v.model,
|
||||
icon = 'car',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = function()
|
||||
TriggerEvent(Config.Eventprefix..':client:LocateVehicleWithPlate', v.plate)
|
||||
end,
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
addedVehicles[v.plate] = true
|
||||
end
|
||||
end
|
||||
|
||||
if #elements == 0 then
|
||||
table.insert(elements, {
|
||||
header = Lang('VEHICLEKEYS_TRACKER_NO_VEHICLES'),
|
||||
icon = 'exclamation-circle',
|
||||
disabled = true,
|
||||
})
|
||||
end
|
||||
|
||||
table.insert(elements, {
|
||||
header = Lang('BACK_TO_PREVIOUS_MENU'),
|
||||
icon = 'arrow-left',
|
||||
params = {
|
||||
isAction = true,
|
||||
event = OpenPreviousMenu, -- Cambiar a la función para regresar al menú anterior
|
||||
args = {}
|
||||
}
|
||||
})
|
||||
|
||||
-- Open the menu using qb-menu
|
||||
exports['qb-menu']:openMenu(elements) -- Abre el menú
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user