1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-25 02:51:13 +02:00
parent 8dbe72603d
commit a0175cbe69
2 changed files with 162 additions and 17 deletions

View file

@ -5,23 +5,154 @@ local function Debug(msg)
print("^2[Shisha Debug] ^7" .. msg)
end
-- Check if qb-target is available
CreateThread(function()
Debug("Script starting...")
for _, prop in pairs(Config.ShishaProps) do
exports['qb-target']:AddTargetModel(prop, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen',
}
},
distance = 2.0
})
Wait(1000)
Debug("Checking if qb-target is available...")
if exports['qb-target'] then
Debug("qb-target export is available")
else
Debug("ERROR: qb-target export is NOT available!")
end
end)
-- Check if the model is valid and can be loaded
CreateThread(function()
Debug("Checking prop model hash...")
local modelName = "prop_bong_01"
local modelHash = GetHashKey(modelName)
Debug(modelName .. " hash: " .. modelHash)
if IsModelValid(modelHash) then
Debug("Model is valid!")
else
Debug("Model is NOT valid!")
end
if IsModelInCdimage(modelHash) then
Debug("Model is in CD image!")
else
Debug("Model is NOT in CD image!")
end
-- Try to load the model
RequestModel(modelHash)
local timeout = 0
while not HasModelLoaded(modelHash) and timeout < 50 do
Wait(100)
timeout = timeout + 1
end
if HasModelLoaded(modelHash) then
Debug("Model loaded successfully!")
else
Debug("Model failed to load after " .. timeout * 100 .. "ms!")
end
end)
-- Register target for model
CreateThread(function()
Debug("Registering target for models...")
-- Try both string and hash methods
local modelName = "prop_bong_01"
local modelHash = GetHashKey(modelName)
-- Method 1: Using 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 registered for model string: " .. modelName)
-- Method 2: Using 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 registered for model hash: " .. modelHash)
end)
-- Create props at specific locations if needed
CreateThread(function()
if Config.SpawnProps then
Debug("Creating shisha props at defined locations...")
for i, location in ipairs(Config.ShishaLocations) do
local modelHash = GetHashKey("prop_bong_01")
RequestModel(modelHash)
while not HasModelLoaded(modelHash) do
Wait(10)
end
local obj = CreateObject(modelHash, location.coords.x, location.coords.y, location.coords.z - 1.0, false, false, false)
SetEntityHeading(obj, location.heading)
PlaceObjectOnGroundProperly(obj)
FreezeEntityPosition(obj, true)
exports['qb-target']:AddTargetEntity(obj, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen (Entity)',
}
},
distance = 2.0
})
Debug("Created shisha prop #" .. i .. " at " .. json.encode(location.coords))
end
end
end)
-- Add box zones as a fallback
CreateThread(function()
if Config.UseBoxZones then
Debug("Setting up box zones for shisha locations...")
for i, location in ipairs(Config.ShishaLocations) do
exports['qb-target']:AddBoxZone("shisha_"..i, location.coords, 0.75, 0.75, {
name = "shisha_"..i,
heading = location.heading,
debugPoly = Config.DebugPoly,
minZ = location.coords.z - 0.5,
maxZ = location.coords.z + 0.5
}, {
options = {
{
num = 1,
type = "client",
event = "nordi_shisha:client:OpenMenu",
icon = 'fas fa-smoking',
label = 'Shisha rauchen (Zone)',
}
},
distance = 2.0
})
Debug("Created box zone for shisha #" .. i)
end
end
Debug("Target options registered")
end)
-- Event Handler für das Öffnen des Menüs
@ -132,7 +263,7 @@ end
function SmokeShisha(selectedShisha)
local ped = PlayerPedId()
local propName = "v_corp_lngestoolfd"
local propName = "v_corp_lngestoolfd" -- Dieses Modell wird aus dem Stream-Ordner geladen
local propBone = 28422
local propCoords = vector3(0.0, 0.0, -0.03)