forked from Simnation/Main
60 lines
1.7 KiB
Lua
60 lines
1.7 KiB
Lua
local QBCore = exports['qb-core']:GetCoreObject()
|
|
|
|
local function ShowMenu(location)
|
|
-- Replace this with your actual menu display code
|
|
QBCore.Functions.Notify("Öffne Speisekarte für " .. location, "primary", 5000)
|
|
-- Animation and prop attach logic here
|
|
end
|
|
|
|
local restaurantLocations = Config.RestaurantLocations
|
|
|
|
CreateThread(function()
|
|
for name, loc in pairs(restaurantLocations) do
|
|
exports['qb-target']:AddBoxZone(name, vector3(loc.x, loc.y, loc.z), 1.5, 1.5, {
|
|
name = name,
|
|
heading = 0,
|
|
debugPoly = false,
|
|
minZ = loc.z - 1,
|
|
maxZ = loc.z + 1,
|
|
}, {
|
|
options = {
|
|
{
|
|
type = "client",
|
|
event = "qb_restaurantmenu:client:openMenu",
|
|
icon = "fas fa-utensils",
|
|
label = "Drücke E um die Speisekarte zu sehen",
|
|
restaurant = name
|
|
}
|
|
},
|
|
distance = 2.0
|
|
})
|
|
end
|
|
end)
|
|
|
|
RegisterNetEvent('qb_restaurantmenu:client:openMenu', function(data)
|
|
local restaurant = data.restaurant
|
|
ShowMenu(restaurant)
|
|
end)
|
|
|
|
|
|
-- Sample menus for each restaurant
|
|
local Menus = {
|
|
Burgershot = {"Burger", "Pommes", "Cola"},
|
|
PizzaThis = {"Pizza Margherita", "Pizza Salami", "Fanta"},
|
|
TacoFarmer = {"Taco", "Burrito", "Sprite"},
|
|
OdinsBar = {"Bier", "Odin", "Loki"}
|
|
}
|
|
|
|
function ShowMenu(location)
|
|
SetNuiFocus(true, true)
|
|
SendNUIMessage({
|
|
type = "openMenu",
|
|
restaurant = location,
|
|
items = Menus[location] or {}
|
|
})
|
|
end
|
|
|
|
RegisterNUICallback("closeMenu", function(data, cb)
|
|
SetNuiFocus(false, false)
|
|
cb("ok")
|
|
end)
|