forked from Simnation/Main
60 lines
No EOL
2.4 KiB
Lua
60 lines
No EOL
2.4 KiB
Lua
RegisterNetEvent('mh_garage:storeVehicle')
|
|
AddEventHandler('mh_garage:storeVehicle', function(zone)
|
|
print("Trigger Stored Vehicle...")
|
|
print(json.encode(zone))
|
|
local coords = GetEntityCoords(PlayerPedId())
|
|
local vehicles = GetGamePool('CVehicle')
|
|
local random = SelectName()
|
|
|
|
local opt = {}
|
|
for i = 1, #vehicles, 1 do
|
|
local veh_coords = GetEntityCoords(vehicles[i])
|
|
local distance = #(veh_coords - coords)
|
|
if distance < 40.0 then
|
|
local mods = QBCore.Functions.GetVehicleProperties(vehicles[i])
|
|
table.insert(opt, {
|
|
title = "Kennzeichen: "..mods.plate,
|
|
description = "Soll dieses Fahrzeug eingeparkt werden?",
|
|
icon = "car",
|
|
onSelect = function()
|
|
if zone.price == nil then
|
|
|
|
else
|
|
local alert = lib.alertDialog({
|
|
header = "Parkplatz kosten",
|
|
content = "Parkplatkosten pro Fahrzeug: "..zone.price.."\n\nWillst du das Parkplatz trotzdem Einparken?",
|
|
centered = true,
|
|
cancel = true
|
|
})
|
|
|
|
print(alert)
|
|
print(json.encode(alert))
|
|
end
|
|
end
|
|
})
|
|
lib.registerContext({
|
|
id = "StoredVehicles",
|
|
title = random.name.."\n\n"..random.description,
|
|
options = opt
|
|
})
|
|
lib.showContext("StoredVehicles")
|
|
end
|
|
end
|
|
end)
|
|
|
|
function SelectName()
|
|
local names = {
|
|
{name = "Garagen-Guru",
|
|
description = "passt auf, dass keiner falsch parkt, Schranken nicht durchdrehen und Autos nicht fliegen!"},
|
|
{name = "Torflüsterer",
|
|
description = "Redet Schranken gut zu wenn diese wieder nicht funktionieren."},
|
|
{name = "Parkplatz-Papst",
|
|
description = "segnet jedes Auto, das diese heilige Halle betritt. Kein Ölverlust ohne dein Amen!"},
|
|
{name = "Schranken-Schamane",
|
|
description = "Elektronik und Technik? Kein Problem! Ich kontrolliere den Strom der Schranken mit reiner Willenskraft und Kabelbinder!"},
|
|
{name = "Chef vom Schuppen",
|
|
description = "Wer falsch parkt, kriegt nicht den Abschleppdienst, sondern eine Ansprache. Kurz. Hart. Legendär!"}
|
|
}
|
|
|
|
return names[math.random(1, #names)]
|
|
end |