From 8a47b4502dc80bdc164c6050dc44420b809cbbb7 Mon Sep 17 00:00:00 2001 From: Nordi98 Date: Thu, 31 Jul 2025 06:41:48 +0200 Subject: [PATCH] ed --- .../[carscripts]/nordi_seats/client/main.lua | 355 ++++++++++++++++-- .../[carscripts]/nordi_seats/fxmanifest.lua | 4 +- .../[carscripts]/nordi_seats/server/main.lua | 8 +- .../[housing]/brutal_housing/cl_utils.lua | 4 +- resources/[housing]/brutal_housing/config.lua | 2 +- 5 files changed, 343 insertions(+), 30 deletions(-) diff --git a/resources/[carscripts]/nordi_seats/client/main.lua b/resources/[carscripts]/nordi_seats/client/main.lua index 75bd3410b..f17ab4f3e 100644 --- a/resources/[carscripts]/nordi_seats/client/main.lua +++ b/resources/[carscripts]/nordi_seats/client/main.lua @@ -52,7 +52,7 @@ end -- Lade verankerte Boote vom Server local function loadAnchoredBoats() - QBCore.Functions.TriggerCallback('nordi_seats:server:getAnchoredBoats', function(serverAnchors) + QBCore.Functions.TriggerCallback('nordi_carmenu:server:getAnchoredBoats', function(serverAnchors) if serverAnchors then for plate, anchorData in pairs(serverAnchors) do -- Finde Fahrzeug mit dieser Kennzeichen @@ -84,7 +84,7 @@ end local function saveAnchorToServer(vehicle, anchorData) local vehicleProps = QBCore.Functions.GetVehicleProperties(vehicle) if vehicleProps.plate then - TriggerServerEvent('nordi_seats:server:saveAnchor', vehicleProps.plate, anchorData) + TriggerServerEvent('nordi_carmenu:server:saveAnchor', vehicleProps.plate, anchorData) end end @@ -92,7 +92,7 @@ end local function removeAnchorFromServer(vehicle) local vehicleProps = QBCore.Functions.GetVehicleProperties(vehicle) if vehicleProps.plate then - TriggerServerEvent('nordi_seats:server:removeAnchor', vehicleProps.plate) + TriggerServerEvent('nordi_carmenu:server:removeAnchor', vehicleProps.plate) end end @@ -159,7 +159,7 @@ CreateThread(function() -- Prüfe ob dieses Boot einen gespeicherten Anker hat local vehicleProps = QBCore.Functions.GetVehicleProperties(vehicle) if vehicleProps.plate then - QBCore.Functions.TriggerCallback('nordi_seats:server:getAnchorByPlate', function(anchorData) + QBCore.Functions.TriggerCallback('nordi_carmenu:server:getAnchorByPlate', function(anchorData) if anchorData then -- Setze Boot an gespeicherte Position SetEntityCoords(vehicle, anchorData.coords.x, anchorData.coords.y, anchorData.coords.z) @@ -370,8 +370,319 @@ local function switchSeat(vehicle, newSeatIndex) end end +-- Tür-Kontrollfunktion +local function controlDoor(vehicle, doorIndex) + if GetVehicleDoorAngleRatio(vehicle, doorIndex) > 0.0 then + SetVehicleDoorShut(vehicle, doorIndex, false) + QBCore.Functions.Notify('Tür geschlossen', 'success') + else + SetVehicleDoorOpen(vehicle, doorIndex, false, false) + QBCore.Functions.Notify('Tür geöffnet', 'success') + end +end + +-- Fenster-Kontrollfunktion +local function controlWindow(vehicle, windowIndex) + if IsVehicleWindowIntact(vehicle, windowIndex) then + RollDownWindow(vehicle, windowIndex) + QBCore.Functions.Notify('Fenster geöffnet', 'success') + else + RollUpWindow(vehicle, windowIndex) + QBCore.Functions.Notify('Fenster geschlossen', 'success') + end +end + +-- Extras-Kontrollfunktion +local function controlExtra(vehicle, extraId) + if DoesExtraExist(vehicle, extraId) then + if IsVehicleExtraTurnedOn(vehicle, extraId) then + SetVehicleExtra(vehicle, extraId, true) + QBCore.Functions.Notify('Extra ' .. extraId .. ' deaktiviert', 'success') + else + SetVehicleExtra(vehicle, extraId, false) + QBCore.Functions.Notify('Extra ' .. extraId .. ' aktiviert', 'success') + end + end +end + +-- Türen-Kontrollmenü +function showDoorControlMenu(vehicle) + local options = { + { + title = '🚪 Alle Türen', + description = 'Alle Türen öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + for i = 0, 5 do + if GetVehicleDoorAngleRatio(vehicle, i) > 0.0 then + SetVehicleDoorShut(vehicle, i, false) + else + SetVehicleDoorOpen(vehicle, i, false, false) + end + end + QBCore.Functions.Notify('Alle Türen umgeschaltet', 'success') + end + }, + { + title = '🚪 Fahrertür', + description = 'Fahrertür öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + controlDoor(vehicle, 0) + end + }, + { + title = '🚪 Beifahrertür', + description = 'Beifahrertür öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + controlDoor(vehicle, 1) + end + }, + { + title = '🚪 Hinten Links', + description = 'Hintere linke Tür öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + controlDoor(vehicle, 2) + end + }, + { + title = '🚪 Hinten Rechts', + description = 'Hintere rechte Tür öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + controlDoor(vehicle, 3) + end + }, + { + title = '🚪 Motorhaube', + description = 'Motorhaube öffnen/schließen', + icon = 'fas fa-car', + onSelect = function() + controlDoor(vehicle, 4) + end + }, + { + title = '🚪 Kofferraum', + description = 'Kofferraum öffnen/schließen', + icon = 'fas fa-box', + onSelect = function() + controlDoor(vehicle, 5) + end + }, + { + title = '← Zurück', + description = 'Zurück zum Hauptmenü', + icon = 'fas fa-arrow-left', + onSelect = function() + showVehicleControlMenu(vehicle) + end + } + } + + lib.registerContext({ + id = 'vehicle_door_menu', + title = '🚪 Türen steuern', + options = options + }) + + lib.showContext('vehicle_door_menu') +end + +-- Fenster-Kontrollmenü +function showWindowControlMenu(vehicle) + local options = { + { + title = '🪟 Alle Fenster', + description = 'Alle Fenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + for i = 0, 3 do + if IsVehicleWindowIntact(vehicle, i) then + RollDownWindow(vehicle, i) + else + RollUpWindow(vehicle, i) + end + end + QBCore.Functions.Notify('Alle Fenster umgeschaltet', 'success') + end + }, + { + title = '🪟 Fahrerfenster', + description = 'Fahrerfenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + controlWindow(vehicle, 0) + end + }, + { + title = '🪟 Beifahrerfenster', + description = 'Beifahrerfenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + controlWindow(vehicle, 1) + end + }, + { + title = '🪟 Hinten Links', + description = 'Hinteres linkes Fenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + controlWindow(vehicle, 2) + end + }, + { + title = '🪟 Hinten Rechts', + description = 'Hinteres rechtes Fenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + controlWindow(vehicle, 3) + end + }, + { + title = '← Zurück', + description = 'Zurück zum Hauptmenü', + icon = 'fas fa-arrow-left', + onSelect = function() + showVehicleControlMenu(vehicle) + end + } + } + + lib.registerContext({ + id = 'vehicle_window_menu', + title = '🪟 Fenster steuern', + options = options + }) + + lib.showContext('vehicle_window_menu') +end + +-- Extras-Kontrollmenü +function showExtrasControlMenu(vehicle) + local options = {} + + -- Prüfe welche Extras existieren + local hasExtras = false + for i = 0, 14 do + if DoesExtraExist(vehicle, i) then + hasExtras = true + local status = IsVehicleExtraTurnedOn(vehicle, i) and "Aktiviert" or "Deaktiviert" + table.insert(options, { + title = '🔧 Extra ' .. i, + description = 'Status: ' .. status, + icon = 'fas fa-puzzle-piece', + onSelect = function() + controlExtra(vehicle, i) + showExtrasControlMenu(vehicle) -- Aktualisiere Menü für aktuellen Status + end + }) + end + end + + if not hasExtras then + table.insert(options, { + title = 'Keine Extras verfügbar', + description = 'Dieses Fahrzeug hat keine Extras', + icon = 'fas fa-times', + disabled = true + }) + end + + table.insert(options, { + title = '← Zurück', + description = 'Zurück zum Hauptmenü', + icon = 'fas fa-arrow-left', + onSelect = function() + showVehicleControlMenu(vehicle) + end + }) + + lib.registerContext({ + id = 'vehicle_extras_menu', + title = '🔧 Extras steuern', + options = options + }) + + lib.showContext('vehicle_extras_menu') +end + +-- Hauptmenü für Fahrzeugsteuerung +function showVehicleControlMenu(vehicle) + local options = { + { + title = '🚪 Türen steuern', + description = 'Türen öffnen/schließen', + icon = 'fas fa-door-open', + onSelect = function() + showDoorControlMenu(vehicle) + end + }, + { + title = '🪟 Fenster steuern', + description = 'Fenster öffnen/schließen', + icon = 'fas fa-window-maximize', + onSelect = function() + showWindowControlMenu(vehicle) + end + }, + { + title = '🔧 Extras steuern', + description = 'Fahrzeug-Extras ein/ausschalten', + icon = 'fas fa-puzzle-piece', + onSelect = function() + showExtrasControlMenu(vehicle) + end + }, + { + title = '👥 Sitzplätze', + description = 'Sitzplatz wechseln oder aussteigen', + icon = 'fas fa-chair', + onSelect = function() + showSeatMenu(vehicle) + end + }, + { + title = '📋 Fahrzeuginfo', + description = 'Informationen über das Fahrzeug', + icon = 'fas fa-info-circle', + onSelect = function() + showVehicleInfo(vehicle) + end + } + } + + -- Boot-spezifische Anker-Option + if isBoat(vehicle) then + local isAnchored = isBoatAnchored(vehicle) + local playerPed = PlayerPedId() + local currentSeat = getCurrentSeat(playerPed, vehicle) + + if currentSeat == -1 then -- Nur Kapitän kann Anker bedienen + table.insert(options, 1, { + title = isAnchored and '⚓ Anker lichten' or '⚓ Anker werfen', + description = isAnchored and 'Boot wieder beweglich machen' or 'Boot an aktueller Position verankern', + icon = 'fas fa-anchor', + onSelect = function() + toggleAnchor(vehicle) + showVehicleControlMenu(vehicle) -- Aktualisiere Menü für aktuellen Status + end + }) + end + end + + lib.registerContext({ + id = 'vehicle_control_menu', + title = '🚗 Fahrzeugsteuerung', + options = options + }) + + lib.showContext('vehicle_control_menu') +end + -- Hauptmenü für Sitzauswahl -local function showSeatMenu(vehicle) +function showSeatMenu(vehicle) local playerPed = PlayerPedId() local isInVehicle = IsPedInVehicle(playerPed, vehicle, false) local availableSeats = getAvailableSeats(vehicle) @@ -474,6 +785,8 @@ local function showSeatMenu(vehicle) description = exitDesc, icon = 'fas fa-door-open', onSelect = function() + TaskLeaveVehicle(playerPed, vehicle, 0) + local exitMsg = isVehicleBoat and 'Du gehst von Bord...' TaskLeaveVehicle(playerPed, vehicle, 0) local exitMsg = isVehicleBoat and 'Du gehst von Bord...' or 'Du steigst aus dem Fahrzeug aus...' QBCore.Functions.Notify(exitMsg, 'primary') @@ -481,13 +794,13 @@ local function showSeatMenu(vehicle) }) end - -- Fahrzeuginfo + -- Zurück zum Hauptmenü table.insert(options, { - title = '📋 Fahrzeuginfo', - description = 'Informationen über das Fahrzeug', - icon = 'fas fa-info-circle', + title = '← Zurück zum Hauptmenü', + description = 'Zurück zur Fahrzeugsteuerung', + icon = 'fas fa-arrow-left', onSelect = function() - showVehicleInfo(vehicle) + showVehicleControlMenu(vehicle) end }) @@ -572,10 +885,10 @@ function showVehicleInfo(vehicle) table.insert(options, { title = '← Zurück', - description = 'Zurück zum Sitzmenü', + description = 'Zurück zum Hauptmenü', icon = 'fas fa-arrow-left', onSelect = function() - showSeatMenu(vehicle) + showVehicleControlMenu(vehicle) end }) @@ -594,9 +907,9 @@ CreateThread(function() options = { { type = "client", - event = "vehicle:openSeatMenu", + event = "vehicle:openControlMenu", icon = "fas fa-car", - label = "Sitzplatz wählen", + label = "Fahrzeug steuern", } }, distance = 3.0 @@ -604,10 +917,10 @@ CreateThread(function() end) -- Event Handler -RegisterNetEvent('vehicle:openSeatMenu', function(data) +RegisterNetEvent('vehicle:openControlMenu', function(data) local vehicle = data.entity if DoesEntityExist(vehicle) and IsEntityAVehicle(vehicle) then - showSeatMenu(vehicle) + showVehicleControlMenu(vehicle) else QBCore.Functions.Notify('Kein gültiges Fahrzeug gefunden!', 'error') end @@ -636,18 +949,18 @@ AddEventHandler('onResourceStop', function(resourceName) end) -- Keybind für schnellen Zugriff -RegisterCommand('seats', function() +RegisterCommand('carmenu', function() local playerPed = PlayerPedId() local vehicle = GetVehiclePedIsIn(playerPed, false) if vehicle ~= 0 then - showSeatMenu(vehicle) + showVehicleControlMenu(vehicle) else local coords = GetEntityCoords(playerPed) local closestVehicle = GetClosestVehicle(coords.x, coords.y, coords.z, 5.0, 0, 71) if DoesEntityExist(closestVehicle) then - showSeatMenu(closestVehicle) + showVehicleControlMenu(closestVehicle) else QBCore.Functions.Notify('Kein Fahrzeug in der Nähe!', 'error') end @@ -671,6 +984,6 @@ RegisterCommand('anchor', function() end end, false) --- Keybinds registrieren (F1 statt F6) -RegisterKeyMapping('seats', 'Sitzplatz Menü öffnen', 'keyboard', 'F1') +-- Keybinds registrieren +RegisterKeyMapping('carmenu', 'Fahrzeug Menü öffnen', 'keyboard', 'F1') RegisterKeyMapping('anchor', 'Anker werfen/lichten', 'keyboard', 'H') diff --git a/resources/[carscripts]/nordi_seats/fxmanifest.lua b/resources/[carscripts]/nordi_seats/fxmanifest.lua index 5ecac15e7..188546ce3 100644 --- a/resources/[carscripts]/nordi_seats/fxmanifest.lua +++ b/resources/[carscripts]/nordi_seats/fxmanifest.lua @@ -2,8 +2,8 @@ fx_version 'cerulean' game 'gta5' author 'Nordi' -description 'Fahrzeug Sitz-Auswahl Script für QBCore mit persistenten Ankern' -version '1.1.0' +description 'Fahrzeug Steuerungsmenü für QBCore mit Sitzen, Türen, Fenstern und Extras' +version '2.0.0' shared_scripts { '@ox_lib/init.lua' diff --git a/resources/[carscripts]/nordi_seats/server/main.lua b/resources/[carscripts]/nordi_seats/server/main.lua index 4f59cdf38..52d730966 100644 --- a/resources/[carscripts]/nordi_seats/server/main.lua +++ b/resources/[carscripts]/nordi_seats/server/main.lua @@ -32,7 +32,7 @@ local function removeAnchorFromDB(plate) end -- Events -RegisterNetEvent('nordi_seats:server:saveAnchor', function(plate, anchorData) +RegisterNetEvent('nordi_carmenu:server:saveAnchor', function(plate, anchorData) local src = source if not plate or not anchorData then return end @@ -42,7 +42,7 @@ RegisterNetEvent('nordi_seats:server:saveAnchor', function(plate, anchorData) print("^2[Anker]^7 Boot " .. plate .. " wurde verankert (Spieler: " .. src .. ")") end) -RegisterNetEvent('nordi_seats:server:removeAnchor', function(plate) +RegisterNetEvent('nordi_carmenu:server:removeAnchor', function(plate) local src = source if not plate then return end @@ -53,11 +53,11 @@ RegisterNetEvent('nordi_seats:server:removeAnchor', function(plate) end) -- Callbacks -QBCore.Functions.CreateCallback('nordi_seats:server:getAnchoredBoats', function(source, cb) +QBCore.Functions.CreateCallback('nordi_carmenu:server:getAnchoredBoats', function(source, cb) cb(anchoredBoats) end) -QBCore.Functions.CreateCallback('nordi_seats:server:getAnchorByPlate', function(source, cb, plate) +QBCore.Functions.CreateCallback('nordi_carmenu:server:getAnchorByPlate', function(source, cb, plate) cb(anchoredBoats[plate]) end) diff --git a/resources/[housing]/brutal_housing/cl_utils.lua b/resources/[housing]/brutal_housing/cl_utils.lua index d6d8dae16..3164fbc9d 100644 --- a/resources/[housing]/brutal_housing/cl_utils.lua +++ b/resources/[housing]/brutal_housing/cl_utils.lua @@ -14,8 +14,8 @@ function notification(title, text, time, type) -- Default ESX Notify: --TriggerEvent('esx:showNotification', text) - -- Default QB Notify: - --TriggerEvent('QBCore:Notify', text, 'info', 5000) + Default QB Notify: + TriggerEvent('QBCore:Notify', text, 'info', 5000) -- OKOK Notify: -- exports['okokNotify']:Alert(title, text, time, type, false) diff --git a/resources/[housing]/brutal_housing/config.lua b/resources/[housing]/brutal_housing/config.lua index 9bb40ffa8..49cfb3f2b 100644 --- a/resources/[housing]/brutal_housing/config.lua +++ b/resources/[housing]/brutal_housing/config.lua @@ -17,7 +17,7 @@ Config = { TextUI = 'ox_lib', -- false / 'brutal_textui' / 'ox_lib' / 'okokTextUI' / 'ESXTextUI' / 'QBDrawText' // Custom can be add in the cl_utils.lua!!! BrutalKeys = true, -- Buy here: https://store.brutalscripts.com BrutalPoliceJob = false, -- Buy here: https://store.brutalscripts.com | Better connection - BrutalNotify = true, -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> cl_utils.lua + BrutalNotify = false, -- Buy here: (4€+VAT) https://store.brutalscripts.com | Or set up your own notify >> cl_utils.lua SteamName = false, -- true = Steam name | false = character name AdminGroups = {'superadmin', 'admin', 'mod', 'god'},