1
0
Fork 0
forked from Simnation/Main

Update client.lua

This commit is contained in:
Nordi98 2025-06-25 04:31:46 +02:00
parent c22911109a
commit 99c6378780

View file

@ -163,44 +163,43 @@ end
function StartShishaSmoking(selectedShisha)
local ped = PlayerPedId()
local smokeTime = Config.SmokeTime or 30000
local animDict = "amb@world_human_smoking@male@male_a@enter"
local animName = "enter"
local particleDictionary = "core"
local particleName = "exp_grd_bzgas_smoke"
local animLoopDict = "amb@world_human_smoking@male@male_a@idle_a"
local animLoopName = "idle_a"
local animDict = "amb@world_human_aa_smoke@male@idle_a"
local animName = "idle_a"
-- Request animation dictionaries
-- Request animation dictionary
RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do
Wait(10)
end
RequestAnimDict(animLoopDict)
while not HasAnimDictLoaded(animLoopDict) do
Wait(10)
-- Create a separate thread to keep the animation playing
local smokingActive = true
local smokeThread = CreateThread(function()
-- Play animation and keep it playing
while smokingActive do
if not IsEntityPlayingAnim(ped, animDict, animName, 3) then
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
end
-- Request particle dictionary
RequestNamedPtfxAsset(particleDictionary)
while not HasNamedPtfxAssetLoaded(particleDictionary) do
Wait(10)
Wait(500)
end
-- Start the smoking process
Debug("Starte Rauch-Animation...")
-- Play initial animation
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 0, 0, false, false, false)
Wait(1000) -- Wait for animation to start properly
-- Switch to loop animation
TaskPlayAnim(ped, animLoopDict, animLoopName, 8.0, -8.0, -1, 1, 0, false, false, false)
end)
-- Create smoke effect
SetPtfxAssetNextCall(particleDictionary)
local smoke = StartParticleFxLoopedOnEntityBone(particleName, ped, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetPedBoneIndex(ped, 20279), 0.1, false, false, false)
SetParticleFxLoopedAlpha(smoke, 0.8)
local smokeEffect = nil
CreateThread(function()
RequestNamedPtfxAsset("core")
while not HasNamedPtfxAssetLoaded("core") do
Wait(10)
end
while smokingActive do
UseParticleFxAssetNextCall("core")
SetParticleFxNonLoopedColour(1.0, 1.0, 1.0)
SetParticleFxNonLoopedAlpha(0.7)
StartParticleFxNonLoopedOnPedBone("exp_grd_bzgas_smoke", ped, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetPedBoneIndex(ped, 20279), 0.5, false, false, false)
Wait(2000) -- Emit smoke every 2 seconds
end
end)
-- Progress bar for smoking
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", smokeTime, false, true, {
@ -209,8 +208,8 @@ function StartShishaSmoking(selectedShisha)
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Success
-- Clean up animation and smoke effect
StopParticleFxLooped(smoke, 0)
-- Stop the animation and smoke effect
smokingActive = false
ClearPedTasks(ped)
-- NOW apply effects and show message AFTER smoking is complete
@ -220,7 +219,7 @@ function StartShishaSmoking(selectedShisha)
Debug("Rauchen abgeschlossen, Entspannungseffekte angewendet")
end, function() -- Cancelled
-- Clean up if cancelled
StopParticleFxLooped(smoke, 0)
smokingActive = false
ClearPedTasks(ped)
Debug("Rauchen abgebrochen")
end)