Who can help me and complete the perfect get out of bed?
Sit = function(civiereObject)
local closestPlayer, closestPlayerDist = GetClosestPlayer()
if closestPlayer ~= nil and closestPlayerDist <= 1.5 then
if IsEntityPlayingAnim(GetPlayerPed(closestPlayer), 'anim@gangops@morgue@table@', 'ko_front', 3) then
ShowNotification("已經有人躺在病床上了!")
return
end
end
LoadAnim("anim@gangops@morgue@table@")
AttachEntityToEntity(PlayerPedId(), civiereObject, 0, 0, 0.0, 2.0, 0.0, 0.0, 180.0, 0.0, false, false, false, false, 2, true)
local heading = GetEntityHeading(civiereObject)
while IsEntityAttachedToEntity(PlayerPedId(), civiereObject) do
Citizen.Wait(5)
if IsPedDeadOrDying(PlayerPedId()) then
DetachEntity(PlayerPedId(), true, true)
end
if not IsEntityPlayingAnim(PlayerPedId(), 'anim@gangops@morgue@table@', 'ko_front', 1) then
TaskPlayAnim(PlayerPedId(), 'anim@gangops@morgue@table@', 'ko_front' ,8.0, -8.0, -1, 1, 0, false, false, false )
end
if IsControlJustPressed(0, 73) then
TaskPlayAnim(PlayerPedId(), 'switch@franklin@bed', 'sleep_getup_rubeyes' ,1.0, 1.0, -1, 1, 0, false, false, false )
Citizen.Wait(5000)
DetachEntity(PlayerPedId(), false, false)
local x, y, z = table.unpack(GetEntityCoords(civiereObject) + GetEntityForwardVector(civiereObject) * - 1.4)
SetEntityCoords(PlayerPedId(), x,y,z)
end
end
end