forked from Simnation/Main
Update client.lua
This commit is contained in:
parent
e5a5cdd799
commit
c6ac3afcd2
1 changed files with 14 additions and 17 deletions
|
@ -120,7 +120,7 @@ function OpenShishaMenu()
|
||||||
onSelect = function()
|
onSelect = function()
|
||||||
local canMake, missingItems = CheckIngredients(shisha.requires)
|
local canMake, missingItems = CheckIngredients(shisha.requires)
|
||||||
if canMake then
|
if canMake then
|
||||||
PrepareAndSmokeShisha(shisha)
|
PrepareShisha(shisha)
|
||||||
else
|
else
|
||||||
ShowMissingIngredientsWarning(missingItems)
|
ShowMissingIngredientsWarning(missingItems)
|
||||||
end
|
end
|
||||||
|
@ -138,28 +138,17 @@ function OpenShishaMenu()
|
||||||
lib.showContext('shisha_menu')
|
lib.showContext('shisha_menu')
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Prepare and smoke shisha
|
-- Prepare shisha function (without animation)
|
||||||
function PrepareAndSmokeShisha(selectedShisha)
|
function PrepareShisha(selectedShisha)
|
||||||
Debug("Starte Shisha-Vorbereitung...")
|
Debug("Starte Shisha-Vorbereitung...")
|
||||||
local player = PlayerPedId()
|
|
||||||
local animDict = "anim@heists@humane_labs@finale@keycards"
|
|
||||||
local anim = "ped_a_enter_loop"
|
|
||||||
|
|
||||||
RequestAnimDict(animDict)
|
-- Simple preparation without animation
|
||||||
while not HasAnimDictLoaded(animDict) do
|
|
||||||
Wait(0)
|
|
||||||
end
|
|
||||||
|
|
||||||
QBCore.Functions.Progressbar("prepare_shisha", selectedShisha.label.." wird vorbereitet...", Config.PrepareTime or 5000, false, true, {
|
QBCore.Functions.Progressbar("prepare_shisha", selectedShisha.label.." wird vorbereitet...", Config.PrepareTime or 5000, false, true, {
|
||||||
disableMovement = true,
|
disableMovement = true,
|
||||||
disableCarMovement = true,
|
disableCarMovement = true,
|
||||||
disableMouse = false,
|
disableMouse = false,
|
||||||
disableCombat = true,
|
disableCombat = true,
|
||||||
}, {
|
}, {}, {}, {}, function() -- Success
|
||||||
animDict = animDict,
|
|
||||||
anim = anim,
|
|
||||||
flags = 49,
|
|
||||||
}, {}, {}, function() -- Success
|
|
||||||
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
|
||||||
|
@ -170,7 +159,7 @@ function PrepareAndSmokeShisha(selectedShisha)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Smoke shisha function
|
-- Smoke shisha function with animation and prop
|
||||||
function SmokeShisha(selectedShisha)
|
function SmokeShisha(selectedShisha)
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
local propName = "v_corp_lngestoolfd" -- This model is loaded from the stream folder
|
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 animDict = "amb@world_human_aa_smoke@male@idle_a"
|
||||||
local animName = "idle_c"
|
local animName = "idle_c"
|
||||||
|
|
||||||
|
-- Request model and animation
|
||||||
RequestModel(GetHashKey(propName))
|
RequestModel(GetHashKey(propName))
|
||||||
while not HasModelLoaded(GetHashKey(propName)) do
|
while not HasModelLoaded(GetHashKey(propName)) do
|
||||||
Wait(0)
|
Wait(0)
|
||||||
|
@ -192,23 +182,30 @@ function SmokeShisha(selectedShisha)
|
||||||
Wait(0)
|
Wait(0)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Create and attach prop
|
||||||
local prop = CreateObject(GetHashKey(propName), 0.0, 0.0, 0.0, true, true, true)
|
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)
|
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)
|
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, {
|
QBCore.Functions.Progressbar("smoke_shisha", selectedShisha.label.." rauchen...", Config.SmokeTime or 30000, 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 and prop
|
||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
DeleteObject(prop)
|
DeleteObject(prop)
|
||||||
|
|
||||||
|
-- Apply effects 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")
|
||||||
end, function() -- Cancelled
|
end, function() -- Cancelled
|
||||||
|
-- Clean up if cancelled
|
||||||
ClearPedTasks(ped)
|
ClearPedTasks(ped)
|
||||||
DeleteObject(prop)
|
DeleteObject(prop)
|
||||||
end)
|
end)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue