From 9c4920eaf5d06c088327b0d6aa4b3a681ef70f11 Mon Sep 17 00:00:00 2001 From: Miho931 <98314142+Miho931@users.noreply.github.com> Date: Mon, 9 Jun 2025 18:14:06 +0200 Subject: [PATCH] =?UTF-8?q?Zone=20Einstellung=20ge=C3=A4ndert,=20da=20ohne?= =?UTF-8?q?=20Funktion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resources/[carscripts]/mh_garage/client/main.lua | 13 +++++++------ .../[carscripts]/mh_garage/client/retrieve.lua | 4 ++-- resources/[carscripts]/mh_garage/client/stored.lua | 14 +++++++------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/resources/[carscripts]/mh_garage/client/main.lua b/resources/[carscripts]/mh_garage/client/main.lua index 06daa6bba..ada1d66a8 100644 --- a/resources/[carscripts]/mh_garage/client/main.lua +++ b/resources/[carscripts]/mh_garage/client/main.lua @@ -3,6 +3,7 @@ QBCore = exports['qb-core']:GetCoreObject() Player = nil local npcHandle = nil local isNPCSpawned = false +CurrentZone = nil Citizen.CreateThread(function() while Player == nil do @@ -79,10 +80,12 @@ CreateThread(function() local spawnDistance = v.NPC.distance if dist < spawnDistance and not isNPCSpawned then + CurrentZone = v SpawnGuardNPC(v.NPC) Wait(300) - AddTargetOptions(v) + AddTargetOptions() elseif dist > spawnDistance and isNPCSpawned then + CurrentZone = nil exports['qb-target']:RemoveTargetEntity(npcHandle) RemoveGuardNPC() end @@ -92,7 +95,7 @@ CreateThread(function() end end) -function AddTargetOptions(zone) +function AddTargetOptions()) local opt = { { @@ -100,14 +103,12 @@ function AddTargetOptions(zone) event = "mh_garage:storeVehicle", icon = "fas fa-parking", label = "Fahrzeug einparken", - args = zone }, { type = "client", event = "mh_garage:retrieveVehicle", icon = "fas fa-car", label = "Fahrzeug ausparken", - args = zone } } @@ -126,9 +127,9 @@ function AddTargetOptions(zone) }) end -function Notification(text, type, zone) +function Notification(text, type) lib.notify({ - title = "Garage - "..zone, + title = "Garage - "..CurrentZone.name, description = text, type = type, position = 'top', diff --git a/resources/[carscripts]/mh_garage/client/retrieve.lua b/resources/[carscripts]/mh_garage/client/retrieve.lua index 276140771..f9e3d7342 100644 --- a/resources/[carscripts]/mh_garage/client/retrieve.lua +++ b/resources/[carscripts]/mh_garage/client/retrieve.lua @@ -1,5 +1,5 @@ RegisterNetEvent('mh_garage:retrieveVehicle') -AddEventHandler('mh_garage:retrieveVehicle', function(zone) +AddEventHandler('mh_garage:retrieveVehicle', function() local ped = PlayerPedId() local coords = GetEntityCoords(ped) local random = SelectName() @@ -26,5 +26,5 @@ AddEventHandler('mh_garage:retrieveVehicle', function(zone) }) lib.showContext("retrieveVehicle") - end, zone.name) + end, CurrentZone.name) end) \ No newline at end of file diff --git a/resources/[carscripts]/mh_garage/client/stored.lua b/resources/[carscripts]/mh_garage/client/stored.lua index 5aaf6f973..20a4c50a4 100644 --- a/resources/[carscripts]/mh_garage/client/stored.lua +++ b/resources/[carscripts]/mh_garage/client/stored.lua @@ -1,5 +1,5 @@ RegisterNetEvent('mh_garage:storeVehicle') -AddEventHandler('mh_garage:storeVehicle', function(zone) +AddEventHandler('mh_garage:storeVehicle', function() local ped = PlayerPedId() local coords = GetEntityCoords(ped) local vehicles = GetGamePool('CVehicle') @@ -16,15 +16,15 @@ AddEventHandler('mh_garage:storeVehicle', function(zone) description = GetRandomCarDescription(), icon = "car", onSelect = function() - print(zone.price) - if zone.price ~= false then + print(CurrentZone.price) + if CurrentZone.price ~= false then lib.hideContext("StoredVehicles") lib.registerContext({ id = "thisVehicle", title = random.name, options = { - {title = "Kosten: "..zone.price}, + {title = "Kosten: "..CurrentZone.price}, {title = ""}, { title = "Akzeptieren", @@ -34,14 +34,14 @@ AddEventHandler('mh_garage:storeVehicle', function(zone) QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb) if cb.status then DeleteVehicle(vehicles[i]) - Notification(cb.text, cb.type, zone.name) + Notification(cb.text, cb.type, CurrentZone.name) else if cb.police and Config.EnabledPolice then exports["roadphone"]:sendDispatch("Hier hat grade jemand versucht, ein Fahrzeug einzuparken.\nDas Zündschloss sah Beschädigt aus.\nKennzeichen: "..veh.plate, 'police', nil) end Notification(cb.text, cb.type) end - end, veh, zone) + end, veh, CurrentZone) end }, { @@ -57,7 +57,7 @@ AddEventHandler('mh_garage:storeVehicle', function(zone) lib.showContext("thisVehicle") else - StoredVehicle(vehicles[i], zone) + StoredVehicle(vehicles[i], CurrentZone) end end })