1
0
Fork 0
forked from Simnation/Main

Update client.lua

This commit is contained in:
Nordi98 2025-06-25 03:46:55 +02:00
parent e5a5cdd799
commit c6ac3afcd2

View file

@ -120,7 +120,7 @@ function OpenShishaMenu()
onSelect = function()
local canMake, missingItems = CheckIngredients(shisha.requires)
if canMake then
PrepareAndSmokeShisha(shisha)
PrepareShisha(shisha)
else
ShowMissingIngredientsWarning(missingItems)
end
@ -138,28 +138,17 @@ function OpenShishaMenu()
lib.showContext('shisha_menu')
end
-- Prepare and smoke shisha
function PrepareAndSmokeShisha(selectedShisha)
-- Prepare shisha function (without animation)
function PrepareShisha(selectedShisha)
Debug("Starte Shisha-Vorbereitung...")
local player = PlayerPedId()
local animDict = "anim@heists@humane_labs@finale@keycards"
local anim = "ped_a_enter_loop"
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Wait(0)
end
-- Simple preparation without animation
QBCore.Functions.Progressbar("prepare_shisha", selectedShisha.label.." wird vorbereitet...", Config.PrepareTime or 5000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = animDict,
anim = anim,
flags = 49,
}, {}, {}, function() -- Success
}, {}, {}, {}, function() -- Success
Debug("Shisha-Vorbereitung erfolgreich, löse Server-Event aus...")
TriggerServerEvent('shisha-script:consumeTobacco', selectedShisha.requires)
-- Start smoking after successful preparation
@ -170,7 +159,7 @@ function PrepareAndSmokeShisha(selectedShisha)
end)
end
-- Smoke shisha function
-- Smoke shisha function with animation and prop
function SmokeShisha(selectedShisha)
local ped = PlayerPedId()
local propName = "v_corp_lngestoolfd" -- This model is loaded from the stream folder
@ -182,6 +171,7 @@ function SmokeShisha(selectedShisha)
local animDict = "amb@world_human_aa_smoke@male@idle_a"
local animName = "idle_c"
-- Request model and animation
RequestModel(GetHashKey(propName))
while not HasModelLoaded(GetHashKey(propName)) do
Wait(0)
@ -192,23 +182,30 @@ function SmokeShisha(selectedShisha)
Wait(0)
end
-- Create and attach prop
local prop = CreateObject(GetHashKey(propName), 0.0, 0.0, 0.0, true, true, true)
AttachEntityToEntity(prop, ped, GetPedBoneIndex(ped, propBone), propCoords.x, propCoords.y, propCoords.z, propRotation.x, propRotation.y, propRotation.z, true, true, false, true, 1, true)
-- Play animation
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
-- Progress bar for smoking
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", Config.SmokeTime or 30000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Success
-- Clean up animation and prop
ClearPedTasks(ped)
DeleteObject(prop)
-- Apply effects after smoking is complete
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() -- Cancelled
-- Clean up if cancelled
ClearPedTasks(ped)
DeleteObject(prop)
end)