forked from Simnation/Main
Update stored.lua
This commit is contained in:
parent
03fd2d2e7b
commit
383c34245b
1 changed files with 15 additions and 20 deletions
|
@ -4,10 +4,10 @@ AddEventHandler('mh_garage:storeVehicle', function(zone)
|
||||||
print(json.encode(zone))
|
print(json.encode(zone))
|
||||||
local coords = GetEntityCoords(PlayerPedId())
|
local coords = GetEntityCoords(PlayerPedId())
|
||||||
local vehicles = GetGamePool('CVehicle')
|
local vehicles = GetGamePool('CVehicle')
|
||||||
local randomname, randomdes = SelectName()
|
local random = SelectName()
|
||||||
|
|
||||||
local opt = {}
|
local opt = {}
|
||||||
print("1")
|
print(json.encode(random))
|
||||||
for i = 1, #vehicles, 1 do
|
for i = 1, #vehicles, 1 do
|
||||||
local veh_coords = GetEntityCoords(vehicles[i])
|
local veh_coords = GetEntityCoords(vehicles[i])
|
||||||
local distance = #(veh_coords - coords)
|
local distance = #(veh_coords - coords)
|
||||||
|
@ -38,8 +38,8 @@ print("3")
|
||||||
print("4")
|
print("4")
|
||||||
lib.registerContext({
|
lib.registerContext({
|
||||||
id = "StoredVehicles",
|
id = "StoredVehicles",
|
||||||
title = randomname,
|
title = random[1],
|
||||||
description = randomdes,
|
description = random[2],
|
||||||
options = opt
|
options = opt
|
||||||
})
|
})
|
||||||
print("5")
|
print("5")
|
||||||
|
@ -50,22 +50,17 @@ end)
|
||||||
|
|
||||||
function SelectName()
|
function SelectName()
|
||||||
local names = {
|
local names = {
|
||||||
["Garagen-Guru"] = "passt auf, dass keiner falsch parkt, Schranken nicht durchdrehen und Autos nicht fliegen!",
|
{name = "Garagen-Guru",
|
||||||
["Torflüsterer"] = "Redet Schranken gut zu wenn diese wieder nicht funktionieren.",
|
description = "passt auf, dass keiner falsch parkt, Schranken nicht durchdrehen und Autos nicht fliegen!"},
|
||||||
["Parkplatz-Papst"] = "segnet jedes Auto, das diese heilige Halle betritt. Kein Ölverlust ohne dein Amen!",
|
{name = "Torflüsterer",
|
||||||
["Schranken-Schamane"] = "Elektronik und Technik? Kein Problem! Ich kontrolliere den Strom der Schranken mit reiner Willenskraft und Kabelbinder!",
|
description = "Redet Schranken gut zu wenn diese wieder nicht funktionieren."},
|
||||||
["Chef vom Schuppen"] = "Wer falsch parkt, kriegt nicht den Abschleppdienst, sondern eine Ansprache. Kurz. Hart. Legendär!"
|
{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!"}
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Schlüssel extrahieren
|
return names[math.random(1, #names)]
|
||||||
local keys = {}
|
|
||||||
for k in pairs(names) do
|
|
||||||
table.insert(keys, k)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Zufälligen Schlüssel wählen
|
|
||||||
local randomKey = keys[math.random(1, #keys)]
|
|
||||||
|
|
||||||
-- Gib Titel und Beschreibung zurück
|
|
||||||
return randomKey, names[randomKey]
|
|
||||||
end
|
end
|
Loading…
Add table
Add a link
Reference in a new issue