forked from Simnation/Main
Update client.lua
This commit is contained in:
parent
c22911109a
commit
99c6378780
1 changed files with 32 additions and 33 deletions
|
@ -163,44 +163,43 @@ end
|
||||||
function StartShishaSmoking(selectedShisha)
|
function StartShishaSmoking(selectedShisha)
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local smokeTime = Config.SmokeTime or 30000
|
local smokeTime = Config.SmokeTime or 30000
|
||||||
local animDict = "amb@world_human_smoking@male@male_a@enter"
|
local animDict = "amb@world_human_aa_smoke@male@idle_a"
|
||||||
local animName = "enter"
|
local animName = "idle_a"
|
||||||
local particleDictionary = "core"
|
|
||||||
local particleName = "exp_grd_bzgas_smoke"
|
|
||||||
local animLoopDict = "amb@world_human_smoking@male@male_a@idle_a"
|
|
||||||
local animLoopName = "idle_a"
|
|
||||||
|
|
||||||
-- Request animation dictionaries
|
-- Request animation dictionary
|
||||||
RequestAnimDict(animDict)
|
RequestAnimDict(animDict)
|
||||||
while not HasAnimDictLoaded(animDict) do
|
while not HasAnimDictLoaded(animDict) do
|
||||||
Wait(10)
|
Wait(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
RequestAnimDict(animLoopDict)
|
-- Create a separate thread to keep the animation playing
|
||||||
while not HasAnimDictLoaded(animLoopDict) do
|
local smokingActive = true
|
||||||
Wait(10)
|
local smokeThread = CreateThread(function()
|
||||||
end
|
-- Play animation and keep it playing
|
||||||
|
while smokingActive do
|
||||||
-- Request particle dictionary
|
if not IsEntityPlayingAnim(ped, animDict, animName, 3) then
|
||||||
RequestNamedPtfxAsset(particleDictionary)
|
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
|
||||||
while not HasNamedPtfxAssetLoaded(particleDictionary) do
|
end
|
||||||
Wait(10)
|
Wait(500)
|
||||||
end
|
end
|
||||||
|
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)
|
|
||||||
|
|
||||||
-- Create smoke effect
|
-- Create smoke effect
|
||||||
SetPtfxAssetNextCall(particleDictionary)
|
local smokeEffect = nil
|
||||||
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)
|
CreateThread(function()
|
||||||
SetParticleFxLoopedAlpha(smoke, 0.8)
|
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
|
-- Progress bar for smoking
|
||||||
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", smokeTime, false, true, {
|
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", smokeTime, false, true, {
|
||||||
|
@ -209,8 +208,8 @@ function StartShishaSmoking(selectedShisha)
|
||||||
disableMouse = false,
|
disableMouse = false,
|
||||||
disableCombat = true,
|
disableCombat = true,
|
||||||
}, {}, {}, {}, function() -- Success
|
}, {}, {}, {}, function() -- Success
|
||||||
-- Clean up animation and smoke effect
|
-- Stop the animation and smoke effect
|
||||||
StopParticleFxLooped(smoke, 0)
|
smokingActive = false
|
||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
|
|
||||||
-- NOW apply effects and show message AFTER smoking is complete
|
-- NOW apply effects and show message AFTER smoking is complete
|
||||||
|
@ -220,7 +219,7 @@ function StartShishaSmoking(selectedShisha)
|
||||||
Debug("Rauchen abgeschlossen, Entspannungseffekte angewendet")
|
Debug("Rauchen abgeschlossen, Entspannungseffekte angewendet")
|
||||||
end, function() -- Cancelled
|
end, function() -- Cancelled
|
||||||
-- Clean up if cancelled
|
-- Clean up if cancelled
|
||||||
StopParticleFxLooped(smoke, 0)
|
smokingActive = false
|
||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
Debug("Rauchen abgebrochen")
|
Debug("Rauchen abgebrochen")
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue