2025-07-26 02:34:34 +02:00
|
|
|
-- Fahrzeug zurückgeben (GEÄNDERT - ohne im Auto zu sitzen)
|
2025-07-26 00:28:59 +02:00
|
|
|
RegisterNetEvent('vehiclerental:client:returnVehicle', function(data)
|
2025-07-26 02:34:34 +02:00
|
|
|
-- Hole alle aktiven Mietverhältnisse des Spielers
|
|
|
|
QBCore.Functions.TriggerCallback('vehiclerental:server:getPlayerRentals', function(rentals)
|
|
|
|
if not rentals or #rentals == 0 then
|
|
|
|
QBCore.Functions.Notify('Du hast keine aktiven Mietverhältnisse!', 'error')
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
-- Erstelle Menü mit allen gemieteten Fahrzeugen
|
|
|
|
local options = {}
|
|
|
|
for i = 1, #rentals do
|
|
|
|
local rental = rentals[i]
|
|
|
|
|
|
|
|
table.insert(options, {
|
|
|
|
title = rental.vehicle_model .. " - " .. rental.vehicle_plate,
|
2025-07-26 02:42:03 +02:00
|
|
|
description = "Zurückgeben " .. rental.timeText,
|
2025-07-26 02:34:34 +02:00
|
|
|
icon = 'car',
|
|
|
|
onSelect = function()
|
|
|
|
returnSpecificVehicle(rental.vehicle_plate, data.locationId)
|
|
|
|
end
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
|
|
|
lib.registerContext({
|
|
|
|
id = 'return_vehicle_menu',
|
|
|
|
title = 'Fahrzeug zurückgeben',
|
|
|
|
options = options
|
|
|
|
})
|
|
|
|
|
|
|
|
lib.showContext('return_vehicle_menu')
|
|
|
|
end)
|
|
|
|
end)
|