1
0
Fork 0
forked from Simnation/Main

Update client.lua

This commit is contained in:
Nordi98 2025-06-25 04:24:39 +02:00
parent cd34e56497
commit c22911109a

View file

@ -152,47 +152,77 @@ function PrepareShisha(selectedShisha)
Debug("Shisha-Vorbereitung erfolgreich, löse Server-Event aus...") Debug("Shisha-Vorbereitung erfolgreich, löse Server-Event aus...")
TriggerServerEvent('shisha-script:consumeTobacco', selectedShisha.requires) TriggerServerEvent('shisha-script:consumeTobacco', selectedShisha.requires)
-- Start smoking after successful preparation -- Start smoking after successful preparation
SmokeShisha(selectedShisha) StartShishaSmoking(selectedShisha)
end, function() -- Cancelled end, function() -- Cancelled
Debug("Shisha-Vorbereitung abgebrochen") Debug("Shisha-Vorbereitung abgebrochen")
QBCore.Functions.Notify("Vorbereitung abgebrochen", "error") QBCore.Functions.Notify("Vorbereitung abgebrochen", "error")
end) end)
end end
-- Smoke shisha function with only animation (no prop) -- Smoke shisha function with animation and smoke effect
function SmokeShisha(selectedShisha) function StartShishaSmoking(selectedShisha)
local ped = PlayerPedId() 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"
-- Rauch-Animation ohne Prop -- Request animation dictionaries
local animDict = "amb@world_human_aa_smoke@male@idle_a"
local animName = "idle_c"
-- Request animation
RequestAnimDict(animDict) RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do while not HasAnimDictLoaded(animDict) do
Wait(0) Wait(10)
end end
-- Play animation RequestAnimDict(animLoopDict)
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false) while not HasAnimDictLoaded(animLoopDict) do
Wait(10)
end
-- Request particle dictionary
RequestNamedPtfxAsset(particleDictionary)
while not HasNamedPtfxAssetLoaded(particleDictionary) do
Wait(10)
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
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)
-- Progress bar for smoking -- Progress bar for smoking
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", Config.SmokeTime or 30000, false, true, { QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", smokeTime, false, true, {
disableMovement = false, disableMovement = false,
disableCarMovement = false, disableCarMovement = false,
disableMouse = false, disableMouse = false,
disableCombat = true, disableCombat = true,
}, {}, {}, {}, function() -- Success }, {}, {}, {}, function() -- Success
-- Clean up animation -- Clean up animation and smoke effect
StopParticleFxLooped(smoke, 0)
ClearPedTasks(ped) ClearPedTasks(ped)
-- Apply effects after smoking is complete -- NOW apply effects and show message AFTER smoking is complete
TriggerEvent("evidence:client:SetStatus", "weedsmell", 300) TriggerEvent("evidence:client:SetStatus", "weedsmell", 300)
TriggerServerEvent('hud:server:RelieveStress', math.random(15, 25)) TriggerServerEvent('hud:server:RelieveStress', math.random(15, 25))
QBCore.Functions.Notify("Du fühlst dich entspannt...", "success") QBCore.Functions.Notify("Du fühlst dich entspannt...", "success")
Debug("Rauchen abgeschlossen, Entspannungseffekte angewendet")
end, function() -- Cancelled end, function() -- Cancelled
-- Clean up if cancelled -- Clean up if cancelled
StopParticleFxLooped(smoke, 0)
ClearPedTasks(ped) ClearPedTasks(ped)
Debug("Rauchen abgebrochen")
end) end)
end end