1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-25 03:11:15 +02:00
parent 1c20ce80a1
commit c5cf83125b

View file

@ -17,85 +17,19 @@ CreateThread(function()
end
end)
-- Überprüfen, ob das Modell gültig ist und geladen werden kann
-- Registriere Target für alle konfigurierten Shisha-Props
CreateThread(function()
Debug("Überprüfe Prop-Modell-Hash...")
local modelName = "prop_bong_01"
local modelHash = GetHashKey(modelName)
Debug(modelName .. " Hash: " .. modelHash)
if IsModelValid(modelHash) then
Debug("Modell ist gültig!")
else
Debug("Modell ist NICHT gültig!")
end
if IsModelInCdimage(modelHash) then
Debug("Modell ist im CD-Image!")
else
Debug("Modell ist NICHT im CD-Image!")
end
-- Versuche, das Modell zu laden
RequestModel(modelHash)
local timeout = 0
while not HasModelLoaded(modelHash) and timeout < 50 do
Wait(100)
timeout = timeout + 1
end
if HasModelLoaded(modelHash) then
Debug("Modell erfolgreich geladen!")
else
Debug("Modell konnte nach " .. timeout * 100 .. "ms nicht geladen werden!")
end
end)
-- Registriere Target für Modell
CreateThread(function()
Debug("Registriere Target für Modelle...")
-- Versuche sowohl String- als auch Hash-Methoden
local modelName = "prop_bong_01"
local modelHash = GetHashKey(modelName)
-- Methode 1: Mit String
exports['qb-target']:AddTargetModel(modelName, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen (String)',
}
},
distance = 2.0
})
Debug("Target für Modell-String registriert: " .. modelName)
-- Methode 2: Mit Hash
exports['qb-target']:AddTargetModel(modelHash, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen (Hash)',
}
},
distance = 2.0
})
Debug("Target für Modell-Hash registriert: " .. modelHash)
Wait(2000) -- Warte etwas länger, um sicherzustellen, dass alles geladen ist
Debug("Registriere Target für Shisha-Props...")
-- Registriere alle konfigurierten Shisha-Props
for _, propName in ipairs(Config.ShishaProps) do
Debug("Versuche Target für Modell zu registrieren: " .. propName)
-- Methode 1: Mit String-Namen
exports['qb-target']:AddTargetModel(propName, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
@ -104,8 +38,38 @@ CreateThread(function()
},
distance = 2.0
})
Debug("Target für Modell registriert: " .. propName)
-- Methode 2: Mit Hash (für zusätzliche Sicherheit)
local modelHash = GetHashKey(propName)
exports['qb-target']:AddTargetModel(modelHash, {
options = {
{
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen',
}
},
distance = 2.0
})
Debug("Target für Modell registriert: " .. propName .. " (Hash: " .. modelHash .. ")")
end
-- Zusätzlich explizit prop_bong_01 registrieren, da es häufig verwendet wird
local bongModel = "prop_bong_01"
exports['qb-target']:AddTargetModel(bongModel, {
options = {
{
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen',
}
},
distance = 2.0
})
Debug("Target für Standard-Bong registriert: " .. bongModel)
end)
-- Event Handler für das Öffnen des Menüs