Skip to content

feat(esx_ambulancejob): add persistent death state and Medal.tv clip support#114

Merged
N0tNvll merged 6 commits into
mainfrom
1.14.0
Jul 17, 2026
Merged

feat(esx_ambulancejob): add persistent death state and Medal.tv clip support#114
N0tNvll merged 6 commits into
mainfrom
1.14.0

Conversation

@N0tNvll

@N0tNvll N0tNvll commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Description

This PR improves esx_ambulancejob death handling by making player death states persistent across reconnects and adding automatic Medal.tv clip saving on player death.

The changes introduce:

  • Persistent death timestamps using player metadata.
  • Automatic restoration of the death state after reconnecting.
  • Improved handling of death, revive, respawn and admin revive commands.
  • Optional Medal.tv integration to automatically save death clips.

Motivation

Previously, a player's death state was only tracked during the current session. If a player disconnected while dead and reconnected later, the death state could be lost and timers would not resume correctly.

This update ensures that:

  • Players who reconnect while dead continue their existing death timer.
  • Death information is stored reliably in the database and player metadata.
  • Duplicate death events are prevented.
  • Admin and automated revive flows correctly clean up persisted death data.

The Medal.tv integration provides players with automatic clips of important death events without requiring manual recording.


Implementation Details

  • Added persistent death handling through a new persistDeathStatus server function:

    • Updates the users.is_dead database field.
    • Stores the death timestamp in player metadata.
    • Clears the metadata when the player is revived.
  • Added a new esx_ambulancejob:requestDeathRestore event:

    • Checks if the player was dead before disconnecting.
    • Restores the death state after spawning.
    • Calculates elapsed time since death and resumes the correct timers.
  • Updated client death flow:

    • OnPlayerDeath and StartDeathTimer now support elapsed death time.
    • Prevents duplicate death initialization.
    • Removes redundant death status updates from client-side revive and respawn logic.
  • Added Medal.tv integration:

    • Added a new configurable Config.Medal section.
    • Sends death events through Medal's local Events API.
    • Added NUI bridge files for communication with the Medal desktop application.
    • Enabled by default but can be disabled through configuration.
  • Improved revive handling:

    • Admin revive commands now properly clear persisted death states.
    • txAdmin healing events also restore the correct state.
    • Dead player tracking is cleaned up consistently.

PR Checklist

  • My commit messages and PR title follow the Conventional Commits standard.
  • My changes have been tested locally and function as expected.
  • My PR does not introduce any breaking changes.
  • I have provided a clear explanation of what my PR does, including the reasoning behind the changes and any relevant context.

players who disconnected while dead now stay dead on reconnect, with the
bleedout timer resuming from where it left off instead of resetting.
centralizes is_dead persistence through a server-side path.
…ms it

guards esx:onPlayerDeath so the death state is persisted only when the
player's health reflects an actual death.
death now persists health = 0; the restore only re-enters the death flow
when the persisted health matches the death state, instead of trusting
is_dead alone.
@N0tNvll
N0tNvll requested a review from FBFezz July 17, 2026 05:32
@N0tNvll N0tNvll self-assigned this Jul 17, 2026
@N0tNvll N0tNvll added the enhancement New feature or request label Jul 17, 2026

@FBFezz FBFezz left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@N0tNvll
N0tNvll merged commit a5dace2 into main Jul 17, 2026
1 of 2 checks passed
@N0tNvll
N0tNvll deleted the 1.14.0 branch July 18, 2026 22:13
@N0tNvll
N0tNvll restored the 1.14.0 branch July 18, 2026 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants