1
0
Fork 0
forked from Simnation/Main
This commit is contained in:
Nordi98 2025-06-25 03:34:12 +02:00
parent e69f440a3c
commit e5a5cdd799
2 changed files with 20 additions and 15 deletions

View file

@ -1,11 +1,11 @@
local QBCore = exports['qb-core']:GetCoreObject()
-- Debug Print Funktion
-- Debug Print Function
local function Debug(msg)
print("^2[Shisha Debug] ^7" .. msg)
end
-- Überprüfen, ob qb-target verfügbar ist
-- Check if qb-target is available
CreateThread(function()
Wait(1000)
Debug("Überprüfe, ob qb-target verfügbar ist...")
@ -17,12 +17,12 @@ CreateThread(function()
end
end)
-- Registriere Target für das funktionierende Shisha-Prop
-- Register Target for Shisha Props
CreateThread(function()
Wait(2000) -- Warte etwas länger, um sicherzustellen, dass alles geladen ist
Wait(2000) -- Wait a bit longer to ensure everything is loaded
Debug("Registriere Target für Shisha-Props...")
-- Registriere das funktionierende Modell
-- Register the working model
local workingModel = "sf_prop_sf_g_bong_01a"
Debug("Registriere Target für funktionierendes Modell: " .. workingModel)
@ -40,7 +40,7 @@ CreateThread(function()
Debug("Target für Modell registriert: " .. workingModel)
-- Versuche auch andere Modelle zu registrieren
-- Try to register other models as well
for _, propName in ipairs(Config.ShishaProps) do
if propName ~= workingModel then
Debug("Versuche zusätzliches Modell zu registrieren: " .. propName)
@ -60,13 +60,14 @@ CreateThread(function()
end
end)
-- Event Handler für das Öffnen des Menüs
-- Event Handler for opening the menu
RegisterNetEvent('nordi_shisha:client:OpenMenu')
AddEventHandler('nordi_shisha:client:OpenMenu', function()
Debug("Öffne Menü...")
OpenShishaMenu()
end)
-- Check if player has required ingredients
function CheckIngredients(requirements)
local hasItems = true
local missingItems = {}
@ -85,6 +86,7 @@ function CheckIngredients(requirements)
return hasItems, missingItems
end
-- Show warning for missing ingredients
function ShowMissingIngredientsWarning(missingItems)
local warningText = "Fehlende Zutaten:\n"
for _, item in ipairs(missingItems) do
@ -95,6 +97,7 @@ function ShowMissingIngredientsWarning(missingItems)
QBCore.Functions.Notify(warningText, "error", 5000)
end
-- Open the shisha menu
function OpenShishaMenu()
Debug("Erstelle Menüoptionen...")
local options = {}
@ -135,6 +138,7 @@ function OpenShishaMenu()
lib.showContext('shisha_menu')
end
-- Prepare and smoke shisha
function PrepareAndSmokeShisha(selectedShisha)
Debug("Starte Shisha-Vorbereitung...")
local player = PlayerPedId()
@ -155,20 +159,21 @@ function PrepareAndSmokeShisha(selectedShisha)
animDict = animDict,
anim = anim,
flags = 49,
}, {}, {}, function() -- Erfolg
}, {}, {}, function() -- Success
Debug("Shisha-Vorbereitung erfolgreich, löse Server-Event aus...")
TriggerServerEvent('shisha-script:consumeTobacco', selectedShisha.requires)
-- Nach erfolgreicher Vorbereitung direkt rauchen
-- Start smoking after successful preparation
SmokeShisha(selectedShisha)
end, function() -- Abgebrochen
end, function() -- Cancelled
Debug("Shisha-Vorbereitung abgebrochen")
QBCore.Functions.Notify("Vorbereitung abgebrochen", "error")
end)
end
-- Smoke shisha function
function SmokeShisha(selectedShisha)
local ped = PlayerPedId()
local propName = "v_corp_lngestoolfd" -- Dieses Modell wird aus dem Stream-Ordner geladen
local propName = "v_corp_lngestoolfd" -- This model is loaded from the stream folder
local propBone = 28422
local propCoords = vector3(0.0, 0.0, -0.03)
@ -192,18 +197,18 @@ function SmokeShisha(selectedShisha)
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", Config.SmokeTime or 10000, false, true, {
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", Config.SmokeTime or 30000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Erfolg
}, {}, {}, {}, function() -- Success
ClearPedTasks(ped)
DeleteObject(prop)
TriggerEvent("evidence:client:SetStatus", "weedsmell", 300)
TriggerServerEvent('hud:server:RelieveStress', math.random(15, 25))
QBCore.Functions.Notify("Du fühlst dich entspannt...", "success")
end, function() -- Abgebrochen
end, function() -- Cancelled
ClearPedTasks(ped)
DeleteObject(prop)
end)