mirror of
https://github.com/jimathy/jim-consumables.git
synced 2026-08-19 07:26:04 +01:00
More specific model removal
This commit is contained in:
@@ -14,7 +14,7 @@ function AlienEffect()
|
|||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
RequestAnimSet("MOVE_M@DRUNK@VERYDRUNK")
|
RequestAnimSet("MOVE_M@DRUNK@VERYDRUNK")
|
||||||
while not HasAnimSetLoaded("MOVE_M@DRUNK@VERYDRUNK") do
|
while not HasAnimSetLoaded("MOVE_M@DRUNK@VERYDRUNK") do
|
||||||
Citizen.Wait(0)
|
Citizen.Wait(0)
|
||||||
end
|
end
|
||||||
SetPedCanRagdoll( ped, true )
|
SetPedCanRagdoll( ped, true )
|
||||||
ShakeGameplayCam('DRUNK_SHAKE', 2.80)
|
ShakeGameplayCam('DRUNK_SHAKE', 2.80)
|
||||||
@@ -220,18 +220,28 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
|||||||
--Load and Start animation
|
--Load and Start animation
|
||||||
loadAnimDict(animDict)
|
loadAnimDict(animDict)
|
||||||
TaskPlayAnim(Player, animDict, anim, 1.0, 1.0, -1, MovementType, 0, 0, 0, 0)
|
TaskPlayAnim(Player, animDict, anim, 1.0, 1.0, -1, MovementType, 0, 0, 0, 0)
|
||||||
|
|
||||||
--Prop Spawning
|
|
||||||
if model then
|
|
||||||
RequestModel(GetHashKey(model))
|
|
||||||
while not HasModelLoaded(GetHashKey(model)) do Citizen.Wait(1) end
|
|
||||||
local attachProp = CreateObject(GetHashKey(model), 1.0, 1.0, 1.0, 1, 1, 0)
|
|
||||||
AttachEntityToEntity(attachProp, PlayerPedId(), bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
TriggerEvent("QBCore:Notify", string..QBCore.Shared.Items[itemName].label.."..", "success", (time + 1000))
|
TriggerEvent("QBCore:Notify", string..QBCore.Shared.Items[itemName].label.."..", "success", (time + 1000))
|
||||||
consuming = true
|
consuming = true
|
||||||
|
|
||||||
|
CreateThread(function()
|
||||||
|
--Prop Spawning
|
||||||
|
if model then
|
||||||
|
RequestModel(GetHashKey(model))
|
||||||
|
while not HasModelLoaded(GetHashKey(model)) do Citizen.Wait(1) end
|
||||||
|
local attachProp = CreateObject(GetHashKey(model), 1.0, 1.0, 1.0, 1, 1, 0)
|
||||||
|
AttachEntityToEntity(attachProp, PlayerPedId(), bone, P1, P2, P3, P4, P5, P6, true, true, false, true, 1, true)
|
||||||
|
while consuming do
|
||||||
|
Wait(10)
|
||||||
|
end
|
||||||
|
DeleteObject(attachProp)
|
||||||
|
DetachEntity(attachProp, 0, 0)
|
||||||
|
SetEntityAsMissionEntity(attachProp, true, true)
|
||||||
|
Wait(100)
|
||||||
|
DeleteEntity(attachProp)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
while consuming do
|
while consuming do
|
||||||
if time <= 0 then consuming = false end
|
if time <= 0 then consuming = false end
|
||||||
if IsControlJustPressed(0, 21) then
|
if IsControlJustPressed(0, 21) then
|
||||||
@@ -244,7 +254,6 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
StopEntityAnim(Player, anim, animDict, 1.0)
|
StopEntityAnim(Player, anim, animDict, 1.0)
|
||||||
DeleteEntity(attachProp)
|
|
||||||
|
|
||||||
if not cancelled then
|
if not cancelled then
|
||||||
TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[itemName], "remove", 1)
|
TriggerEvent("inventory:client:ItemBox", QBCore.Shared.Items[itemName], "remove", 1)
|
||||||
@@ -320,7 +329,8 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
|||||||
end
|
end
|
||||||
cancelled = false
|
cancelled = false
|
||||||
consuming = false
|
consuming = false
|
||||||
for k, v in pairs(GetGamePool('CObject')) do
|
|
||||||
|
--[[for k, v in pairs(GetGamePool('CObject')) do
|
||||||
if IsEntityAttachedToEntity(PlayerPedId(), v) then
|
if IsEntityAttachedToEntity(PlayerPedId(), v) then
|
||||||
DeleteObject(v)
|
DeleteObject(v)
|
||||||
DetachEntity(v, 0, 0)
|
DetachEntity(v, 0, 0)
|
||||||
@@ -328,7 +338,8 @@ RegisterNetEvent('jim-consumables:Consume', function(itemName)
|
|||||||
Wait(100)
|
Wait(100)
|
||||||
DeleteEntity(v)
|
DeleteEntity(v)
|
||||||
end
|
end
|
||||||
end
|
end]]
|
||||||
|
|
||||||
LocalPlayer.state:set("inv_busy", false, true)
|
LocalPlayer.state:set("inv_busy", false, true)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user