Skip to content

Commit

Permalink
refactor(client): release anims
Browse files Browse the repository at this point in the history
  • Loading branch information
solareon authored Jun 24, 2024
1 parent 7ce2001 commit b8d6090
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
7 changes: 3 additions & 4 deletions client/hospital.lua
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ local function setBedCam()
Wait(500)
FreezeEntityPosition(cache.ped, true)

lib.requestAnimDict(InBedDict)

TaskPlayAnim(cache.ped, InBedDict, InBedAnim, 8.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, InBedDict, InBedAnim, 8.0, 1.0, -1, 1, 0, false, false, false)
SetEntityHeading(cache.ped, bedOccupyingData.coords.w)

cam = CreateCam('DEFAULT_SCRIPTED_CAMERA', true)
Expand Down Expand Up @@ -246,11 +244,12 @@ end

---Plays animation to get out of bed and resets variables
local function leaveBed()
lib.requestAnimDict('switch@franklin@bed')
lib.requestAnimDict('switch@franklin@bed', 10000)
FreezeEntityPosition(cache.ped, false)
SetEntityInvincible(cache.ped, false)
SetEntityHeading(cache.ped, bedOccupyingData.coords.w + 90)
TaskPlayAnim(cache.ped, 'switch@franklin@bed', 'sleep_getup_rubeyes', 100.0, 1.0, -1, 8, -1, false, false, false)
RemoveAnimDict('switch@franklin@bed')
Wait(4000)
ClearPedTasks(cache.ped)
TriggerServerEvent('qbx_ambulancejob:server:playerLeftBed', hospitalOccupying, bedIndexOccupying)
Expand Down
3 changes: 1 addition & 2 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ end)
---Intended to be called from client or server.
RegisterNetEvent('hospital:client:Revive', function()
if IsInHospitalBed then
lib.requestAnimDict(InBedDict)
TaskPlayAnim(cache.ped, InBedDict, InBedAnim, 8.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(cache.ped, InBedDict, InBedAnim, 8.0, 1.0, -1, 1, 0, false, false, false)
TriggerEvent('qbx_medical:client:playerRevived')
CanLeaveBed = true
end
Expand Down
3 changes: 1 addition & 2 deletions client/setdownedstate.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ end
local function playDeadAnimation(ped)
if IsInHospitalBed then
if not IsEntityPlayingAnim(ped, InBedDict, InBedAnim, 3) then
lib.requestAnimDict(InBedDict)
TaskPlayAnim(ped, InBedDict, InBedAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
lib.playAnim(ped, InBedDict, InBedAnim, 1.0, 1.0, -1, 1, 0, false, false, false)
end
else
exports.qbx_medical:PlayDeadAnimation()
Expand Down

0 comments on commit b8d6090

Please sign in to comment.