1
0
Fork 0
forked from Simnation/Main

Update client.lua

This commit is contained in:
Nordi98 2025-06-25 04:18:27 +02:00
parent dc8db27d8f
commit cd34e56497

View file

@ -159,49 +159,23 @@ function PrepareShisha(selectedShisha)
end) end)
end end
-- Smoke shisha function with animation and prop -- Smoke shisha function with only animation (no prop)
function SmokeShisha(selectedShisha) function SmokeShisha(selectedShisha)
local ped = PlayerPedId() local ped = PlayerPedId()
local propName = "v_corp_lngestoolfd" -- Dieses Modell wird von irgendwo auf dem Server geladen
local propBone = 18905 -- Rechte Hand
-- Angepasste Position und Rotation für bessere Platzierung -- Rauch-Animation ohne Prop
local propCoords = vector3(0.10, 0.03, 0.05) local animDict = "amb@world_human_aa_smoke@male@idle_a"
local propRotation = vector3(100.0, 0.0, 40.0) local animName = "idle_c"
-- Bessere Rauch-Animation
local animDict = "timetable@gardener@smoking_joint"
local animName = "smoke_idle"
-- Request model and animation
RequestModel(GetHashKey(propName))
while not HasModelLoaded(GetHashKey(propName)) do
Wait(0)
end
-- Request animation
RequestAnimDict(animDict) RequestAnimDict(animDict)
while not HasAnimDictLoaded(animDict) do while not HasAnimDictLoaded(animDict) do
Wait(0) Wait(0)
end 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 -- Play animation
TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false) TaskPlayAnim(ped, animDict, animName, 8.0, -8.0, -1, 49, 0, false, false, false)
-- Füge Raucheffekt hinzu
local smokeParticle = "exp_grd_bzgas_smoke"
RequestNamedPtfxAsset("core")
while not HasNamedPtfxAssetLoaded("core") do
Wait(0)
end
UseParticleFxAssetNextCall("core")
local smoke = StartParticleFxLoopedOnEntityBone(smokeParticle, prop, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, GetEntityBoneIndexByName(prop, "ATTACH_POINT"), 0.05, false, false, false)
SetParticleFxLoopedAlpha(smoke, 0.3)
-- 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...", Config.SmokeTime or 30000, false, true, {
disableMovement = false, disableMovement = false,
@ -209,10 +183,8 @@ function SmokeShisha(selectedShisha)
disableMouse = false, disableMouse = false,
disableCombat = true, disableCombat = true,
}, {}, {}, {}, function() -- Success }, {}, {}, {}, function() -- Success
-- Clean up animation and prop -- Clean up animation
ClearPedTasks(ped) ClearPedTasks(ped)
DeleteObject(prop)
StopParticleFxLooped(smoke, 0)
-- Apply effects after smoking is complete -- Apply effects after smoking is complete
TriggerEvent("evidence:client:SetStatus", "weedsmell", 300) TriggerEvent("evidence:client:SetStatus", "weedsmell", 300)
@ -221,12 +193,9 @@ function SmokeShisha(selectedShisha)
end, function() -- Cancelled end, function() -- Cancelled
-- Clean up if cancelled -- Clean up if cancelled
ClearPedTasks(ped) ClearPedTasks(ped)
DeleteObject(prop)
StopParticleFxLooped(smoke, 0)
end) end)
end end
-- Debug Event -- Debug Event
RegisterNetEvent('shisha-script:debug') RegisterNetEvent('shisha-script:debug')
AddEventHandler('shisha-script:debug', function(msg) AddEventHandler('shisha-script:debug', function(msg)