diff --git a/resources/[carscripts]/mh_garage/client/stored.lua b/resources/[carscripts]/mh_garage/client/stored.lua index 5a0eae05f..d0689d229 100644 --- a/resources/[carscripts]/mh_garage/client/stored.lua +++ b/resources/[carscripts]/mh_garage/client/stored.lua @@ -14,73 +14,69 @@ AddEventHandler('mh_garage:storeVehicle', function() local lc_fuelLevel = exports["lc_fuel"]:GetFuel(vehicles[i]) -- Get the fuel level mods.fuelLevel = lc_fuelLevel - QBCore.Functions.TriggerCallback('mh_garage:CheckownerVehicles', function(cb) - if cb then - table.insert(opt, { - title = "Kennzeichen: "..mods.plate, - description = GetRandomCarDescription(), - icon = "car", - onSelect = function() - print(CurrentZone.price) - if CurrentZone.price ~= nil then - lib.hideContext("StoredVehicles") + table.insert(opt, { + title = "Kennzeichen: "..mods.plate, + description = GetRandomCarDescription(), + icon = "car", + onSelect = function() + print(CurrentZone.price) + if CurrentZone.price ~= nil then + lib.hideContext("StoredVehicles") - lib.registerContext({ - id = "thisVehicle", - title = random.name, - options = { - {title = "Kosten: "..CurrentZone.price.."$"}, - {title = "", disabled = true}, - { - title = "Akzeptieren", - description = "Geld wird vom Bankkonto abgebucht!", - icon = "check", - onSelect = function() - lib.hideContext("thisVehicle") - QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb) - if cb.status then - TriggerServerEvent('mh_Parking:deleteVehicle', mods.plate, NetworkGetNetworkIdFromEntity(vehicles[i])) - --DeleteVehicle(vehicles[i]) - 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) + lib.registerContext({ + id = "thisVehicle", + title = random.name, + options = { + {title = "Kosten: "..CurrentZone.price.."$"}, + {title = "", disabled = true}, + { + title = "Akzeptieren", + description = "Geld wird vom Bankkonto abgebucht!", + icon = "check", + onSelect = function() + lib.hideContext("thisVehicle") + QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb) + if cb.status then + TriggerServerEvent('mh_Parking:deleteVehicle', mods.plate, NetworkGetNetworkIdFromEntity(vehicles[i])) + --DeleteVehicle(vehicles[i]) + 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 - end, mods, CurrentZone) - end - }, - { - title = "Abbrechen", - description = "Das ist sehr Schade,", - icon = "close", - onSelect = function() - lib.hideContext("thisVehicle") - end - } - } - }) - - lib.showContext("thisVehicle") - else - QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb) - if cb.status then - TriggerServerEvent('mh_Parking:deleteVehicle', mods.plate, NetworkGetNetworkIdFromEntity(vehicles[i])) - --DeleteVehicle(vehicles[i]) - 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) + Notification(cb.text, cb.type) + end + end, mods, CurrentZone) end - Notification(cb.text, cb.type) + }, + { + title = "Abbrechen", + description = "Das ist sehr Schade,", + icon = "close", + onSelect = function() + lib.hideContext("thisVehicle") + end + } + } + }) + + lib.showContext("thisVehicle") + else + QBCore.Functions.TriggerCallback('mh_garage:storedVehicle', function(cb) + if cb.status then + TriggerServerEvent('mh_Parking:deleteVehicle', mods.plate, NetworkGetNetworkIdFromEntity(vehicles[i])) + --DeleteVehicle(vehicles[i]) + 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 - end, mods, CurrentZone) - end + Notification(cb.text, cb.type) + end + end, mods, CurrentZone) end - }) end - end, mods.plate) + }) lib.registerContext({ id = "StoredVehicles", title = random.name.."\n\n"..random.description,