ESX = exports["es_extended"]:getSharedObject() local showMenu = false local DynamicMenuItems = {} -- Keybind Lookup table local keybindControls = { ["`"] = 243, ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57, ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177, ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18, ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182, ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81, ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70, ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178, ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173, ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118 } local MAX_MENU_ITEMS = 7 --[[ MenuItemId2 = exports['qb-radialmenu']:AddOption({ id = 'open_garage_menu', title = 'Open Garage', icon = 'warehouse', type = 'client', event = 'qb-garages:client:OpenMenu', shouldClose = true }, MenuItemId2) ]] local function AddOption(data, id) local menuID = #DynamicMenuItems + 1 local newItem = {} newItem.id = data.id newItem.title = data.title newItem.icon = '#' ..data.icon newItem.functionName = data.event newItem.eventType = data.type DynamicMenuItems[#DynamicMenuItems+1] = newItem -- print(menuID) return menuID end local function RemoveOption(id) DynamicMenuItems[id] = nil end exports('AddOption', AddOption) exports('RemoveOption', RemoveOption) -- Main thread Citizen.CreateThread(function() local keyBind = "F1" local keyBind2 = "F1" while true do Citizen.Wait(0) SetBigmapActive(false, false) -- Zapri meni, če je prikazan in pritisnjen gumb if IsControlPressed(1, keybindControls[keyBind2]) and GetLastInputMethod(2) and showMenu then showMenu = false SetNuiFocus(false, false) end -- ODPIRANJE MENIJA if IsControlPressed(1, keybindControls[keyBind2]) and GetLastInputMethod(2) then -- Preveri, če je igralec vklenjen if exports.wasabi_police:IsHandcuffed() then -- Če je vklenjen, prekini izvajanje in ne odpri menija goto skipMenu end showMenu = true local enabledMenus = {} for _, menuConfig in ipairs(rootMenuConfig) do if menuConfig:enableMenu() then local dataElements = {} local hasSubMenus = false if menuConfig.subMenus ~= nil and #menuConfig.subMenus > 0 then hasSubMenus = true local previousMenu = dataElements local currentElement = {} for i = 1, #menuConfig.subMenus do currentElement[#currentElement+1] = newSubMenus[menuConfig.subMenus[i]] currentElement[#currentElement].id = menuConfig.subMenus[i] currentElement[#currentElement].enableMenu = nil if i % MAX_MENU_ITEMS == 0 and i < (#menuConfig.subMenus - 1) then previousMenu[MAX_MENU_ITEMS + 1] = { id = "_more", title = "More", icon = "#more", items = currentElement } previousMenu = currentElement currentElement = {} end end if #currentElement > 0 then previousMenu[MAX_MENU_ITEMS + 1] = { id = "_more", title = "More", icon = "#more", items = currentElement } end dataElements = dataElements[MAX_MENU_ITEMS + 1].items end enabledMenus[#enabledMenus+1] = { id = menuConfig.id, title = menuConfig.displayName, functionName = menuConfig.functionName, icon = menuConfig.icon, } if hasSubMenus then enabledMenus[#enabledMenus].items = dataElements end end end if #DynamicMenuItems >= 1 then for k, v in pairs(DynamicMenuItems) do enabledMenus[#enabledMenus+1] = { id = v.id, title = v.title, functionName = v.functionName, eventType = v.eventType, icon = v.icon, } end end SendNUIMessage({ state = "show", resourceName = GetCurrentResourceName(), data = enabledMenus, menuType = (IsPedInAnyVehicle(PlayerPedId(), false) and 'small' or 'default') }) SetCursorLocation(0.5, 0.5) SetNuiFocus(true, true) PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1) while showMenu == true do Citizen.Wait(100) end Citizen.Wait(100) while IsControlPressed(1, keybindControls[keyBind2]) and GetLastInputMethod(2) do Citizen.Wait(100) end end ::skipMenu:: end end) -- Callback function for closing menu RegisterNUICallback('closemenu', function(data, cb) -- Clear focus and destroy UI showMenu = false SetNuiFocus(false, false) SendNUIMessage({ state = 'destroy' }) -- Play sound PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1) -- Send ACK to callback function cb('ok') end) -- Callback function for when a slice is clicked, execute command RegisterNUICallback('triggerAction', function(data, cb) -- Clear focus and destroy UI showMenu = false SetNuiFocus(false, false) SendNUIMessage({ state = 'destroy' }) if not data.eventType then data.eventType = "client" end -- Play sound PlaySoundFrontend(-1, "NAV", "HUD_AMMO_SHOP_SOUNDSET", 1) -- Run command --ExecuteCommand(data.action) if data.eventType == "client" then TriggerEvent(data.action, data.parameters) elseif data.eventType == "server" then TriggerServerEvent(data.action, data.parameters) elseif data.eventType == "command" then ExecuteCommand(data.action) end -- Send ACK to callback function cb('ok') end) RegisterNetEvent('elixir:emotes', function () ExecuteCommand('emotes') end) RegisterNetEvent('carmenuOpen', function () ExecuteCommand('carmenu') end) RegisterNetEvent("menu:menuexit") AddEventHandler("menu:menuexit", function() showMenu = false SetNuiFocus(false, false) end) RegisterCommand("nui_false", function(source, args) showMenu = false SetNuiFocus(false, false) SendNUIMessage({ state = 'destroy' }) end) RegisterNetEvent("ygx:togglegas") AddEventHandler("ygx:togglegas", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords for k,v in pairs(GasStations) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords = v end end SetNewWaypoint(closestCoords) QBCore.Functions.Notify('Nearest Gas Station has been marked on the Map.', 'success', 3000) end) RegisterNetEvent("ygx:togglebarber") AddEventHandler("ygx:togglebarber", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords1 for k,v in pairs(BarberShops) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords1 = v end end SetNewWaypoint(closestCoords1) QBCore.Functions.Notify('Nearest Barber has been marked on the Map.', 'success', 3000) end) RegisterNetEvent("ygx:toggletattos") AddEventHandler("ygx:toggletattos", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords2 for k,v in pairs(TattoShops) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords2 = v end end SetNewWaypoint(closestCoords1) end) RegisterNetEvent("fk:karakol") AddEventHandler("fk:karakol", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords2 for k,v in pairs(Karakol) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords2 = v end end SetNewWaypoint(closestCoords2) end) RegisterNetEvent("fk:hastane") AddEventHandler("fk:hastane", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords2 for k,v in pairs(Hastane) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords2 = v end end SetNewWaypoint(closestCoords2) end) RegisterNetEvent("fk:galeri") AddEventHandler("fk:galeri", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords2 for k,v in pairs(Galeri) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords2 = v end end SetNewWaypoint(closestCoords2) QBCore.Functions.Notify('PDM has been marked on the Map.', 'success', 3000) end) RegisterNetEvent("fk:motel") AddEventHandler("fk:motel", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 1000 local closestCoords2 for k,v in pairs(Motel) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords2 = v end end SetNewWaypoint(closestCoords2) end) RegisterNetEvent("sloline:garage") AddEventHandler("sloline:garage", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Garage) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:gunclub") AddEventHandler("sloline:gunclub", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Gunclub) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:lspd") AddEventHandler("sloline:lspd", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Police) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:bcso") AddEventHandler("sloline:bcso", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Sheriff) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:ems") AddEventHandler("sloline:ems", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Ems) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:ottos") AddEventHandler("sloline:ottos", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Ottos) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:benny") AddEventHandler("sloline:benny", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Benny) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:seaton") AddEventHandler("sloline:seaton", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Seaton) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) RegisterNetEvent("sloline:bank") AddEventHandler("sloline:bank", function() -- DeleteWaypoint() local currentGasBlip = 0 local coords = GetEntityCoords(PlayerPedId()) local closest = 50000 local closestCoords6 for k,v in pairs(Bank) do local dstcheck = GetDistanceBetweenCoords(coords, v) if dstcheck < closest then closest = dstcheck closestCoords6 = v end end SetNewWaypoint(closestCoords6) end) TattoShops = { vector3(1322.6, -1651.9, 51.2), vector3(-1153.6, -1425.6, 4.9), vector3(322.1, 180.4, 103.5), vector3(-3170.0, 1075.0, 20.8), vector3(1864.6, 3747.7, 33.0), vector3(-293.7, 6200.0, 31.4) } Garage = { vector3(-32.9669, 6536.8506, 31.4883), vector3(-81.0692, 6337.7188, 31.5907), vector3(1695.3708, 4768.7612, 41.9975), vector3(1701.9417, 3761.6892, 34.4482), vector3(1872.7571, 3726.5605, 32.9788), vector3(220.6673, 2603.1558, 45.7734), vector3(-2962.3145, 375.2243, 14.8180), vector3(1098.9518, 242.6620, 80.9906), vector3(363.0942, 296.7308, 103.5065), vector3(1144.7573, -464.7796, 67.3280), vector3(-1362.2163, -0.2401, 53.6568), vector3(-1844.0287, -615.5162, 11.2406), vector3(-1250.3245, -1424.7078, 4.3229), vector3(-348.4606, -877.7077, 31.0715), vector3(233.6009, -1758.3412, 29.0061), vector3(785.8832, -2955.4177, 6.0245), vector3(-833.0775, -2350.9424, 14.5706) } Bank = { vector3(237.5095, 217.3646, 106.2868), vector3(-353.116, -52.650, 49.036), vector3(311.928, -281.780, 54.164), vector3(-112.2052, 6461.7212, 31.4836), vector3(1176.0374, 2710.1172, 38.0880), vector3(-2966.9033, 482.8644, 15.6917), vector3(-1211.8763, -334.0350, 37.7809), vector3(147.8671, -1043.5034, 29.3680), vector3(1853.5143, 3861.9919, 35.9046), } Gunclub = { vector3(811.5873, -2146.7144, 29.4327), } Ottos = { vector3(819.6077, -815.3216, 26.2135), } Seaton = { vector3(1711.7880, 3693.7314, 42.7378), } Bennys = { vector3(-238.8114, -1324.4645, 31.2962), } Police = { vector3(-498.8604, -986.7128, 22.9241), } Sheriff = { vector3(-436.0326, 6015.8345, 31.4895), } Ems = { vector3(1749.7233, 3628.0676, 34.9851), } BarberShops = { vector3(-814.308, -183.823, 36.568), vector3(136.826, -1708.373, 28.291), vector3(-1282.604, -1116.757, 5.990), vector3(1931.513, 3729.671, 31.844), vector3(1212.840, -472.921, 65.208), vector3(-32.885, -152.319, 56.076), vector3(-278.077, 6228.463, 30.695), } GasStations = { vector3(49.4187, 2778.793, 58.043), vector3(263.894, 2606.463, 44.983), vector3(1039.958, 2671.134, 39.550), vector3(1207.260, 2660.175, 37.899), vector3(2539.685, 2594.192, 37.944), vector3(2679.858, 3263.946, 55.240), vector3(2005.055, 3773.887, 32.403), vector3(1687.156, 4929.392, 42.078), vector3(1701.314, 6416.028, 32.763), vector3(179.857, 6602.839, 31.868), vector3(-94.4619, 6419.594, 31.489), vector3(-2554.996, 2334.40, 33.078), vector3(-1800.375, 803.661, 138.651), vector3(-1437.622, -276.747, 46.207), vector3(-2096.243, -320.286, 13.168), vector3(-724.619, -935.1631, 19.213), vector3(-526.019, -1211.003, 18.184), vector3(-70.2148, -1761.792, 29.534), vector3(265.648, -1261.309, 29.292), vector3(819.653, -1028.846, 26.403), vector3(1208.951, -1402.567,35.224), vector3(1181.381, -330.847, 69.316), vector3(620.843, 269.100, 103.089), vector3(2581.321, 362.039, 108.468), vector3(176.631, -1562.025, 29.263), vector3(176.631, -1562.025, 29.263), vector3(-319.292, -1471.715, 30.549), vector3(1784.324, 3330.55, 41.253) } ---- EMOTES RegisterNetEvent('elixir:exp1', function () ExecuteCommand('e angry') end) RegisterNetEvent('elixir:exp2', function () ExecuteCommand('e drunk') end) RegisterNetEvent('elixir:exp3', function () ExecuteCommand('e dumb') end) RegisterNetEvent('elixir:exp4', function () ExecuteCommand('e electrocuted') end) RegisterNetEvent('elixir:exp5', function () ExecuteCommand('e grumpy') end) RegisterNetEvent('elixir:exp6', function () ExecuteCommand('e grumpy2') end) RegisterNetEvent('elixir:exp7', function () ExecuteCommand('e grumpy3') end) RegisterNetEvent('elixir:exp8', function () ExecuteCommand('e happy') end) RegisterNetEvent('elixir:exp9', function () ExecuteCommand('e injured') end) RegisterNetEvent('elixir:exp10', function () ExecuteCommand('e joyful') end) RegisterNetEvent('elixir:exp11', function () ExecuteCommand('e mouthbreather') end) RegisterNetEvent('elixir:exp12', function () ExecuteCommand('e shocked') end) RegisterNetEvent('elixir:exp13', function () ExecuteCommand('e sleeping') end) RegisterNetEvent('elixir:exp14', function () ExecuteCommand('e smug') end) RegisterNetEvent('elixir:exp15', function () ExecuteCommand('e speculative') end) RegisterNetEvent('elixir:exp16', function () ExecuteCommand('e stressed') end) RegisterNetEvent('elixir:exp17', function () ExecuteCommand('e sulking') end) RegisterNetEvent('elixir:exp18', function () ExecuteCommand('e weird') end) RegisterNetEvent('elixir:exp19', function () ExecuteCommand('e weird2') end)