Player & Ped CPR
A guide to install Ped & Player CPR (Animated) for FiveM
Overview
Section titled “Overview”Perform animated CPR on downed players and injured NPCs. This resource provides ERS-style synced CPR animations, framework revive integration, eligibility checks, and configurable permissions — with optional Coma & Down System support.
Key Features
Section titled “Key Features”- Synced player CPR — ERS-style staged animations (
missheistfbi3b_ig8_2) with server-authoritative sync - Framework integration — Auto-detect or manual ESX, QBCore, Qbox, and standalone revive handling
- Failed CPR restore — Victims return to their downed death animation without restarting bleedout timers (ESX Legacy compatible)
- Eligibility checks — CPR only on incapacitated players/NPCs (health, death state, framework metadata)
- Framework permissions — Night Discord API (multi-guild), ACE, ESX job/group, QBCore/Qbox job/permission
- NPC & player targets — Configurable: both, NPC only, or player only
- Control lock — Movement disabled instantly when CPR starts to prevent animation drift
- Version checker — Resource and config version check on startup (Nights version sheet)
- Coma & Down System integration — Optional integration with medical systems
- Server exports — Downed checks, permission checks, and manual downed restore for other resources
Important Pre-Installation Notes
Section titled “Important Pre-Installation Notes”System Requirements & Compatibility
Section titled “System Requirements & Compatibility”Framework Compatibility
Section titled “Framework Compatibility”- Standalone — Built-in revive/respawn when no framework is detected
- ESX —
esx_ambulancejob:reviveintegration; failed CPR restores downed death animation - QBCore —
hospital:client:Revive/hospital:client:RespawnAtHospital - Qbox —
qbx_medicalrevive export with configurable respawn callback
Set Config.Integrations.Framework to "auto" (default), "esx", "qbcore", "qbox", or "standalone".
OneSync Compatibility
Section titled “OneSync Compatibility”- OneSync Legacy: Fully tested and compatible
- OneSync Infinity: Fully tested and compatible
Integration Support
Section titled “Integration Support”- Coma & Down System — Optional revive/respawn via
night_coma_down_systemexports - night_discordapi — Multi-guild Discord role permissions (same model as ERS)
- ACE permissions — Principal-based CPR access via
Config.Permissions.CPRRolesOrGroups
Installation Process
Section titled “Installation Process”Step 1: Download Resource
Section titled “Step 1: Download Resource”Download this resource via CFX Portal Assets after purchasing.
Step 2: Install Resource
Section titled “Step 2: Install Resource”- Extract the ZIP package to your local machine
- Transfer files using binary FTP mode to your server’s resources folder
- Ensure the folder is named
night_ped_cpr(do not rename)
Step 3: Server Configuration
Section titled “Step 3: Server Configuration”Add the resource to your server.cfg:
ensure night_ped_cprStep 4: Configure Settings
Section titled “Step 4: Configure Settings”- Open
/config/config.luain your preferred editor - Configure all settings to your liking
- Test the resource functionality
Configuration Setup
Section titled “Configuration Setup”Required Tools
Section titled “Required Tools”Configuration Files
Section titled “Configuration Files”| File | Purpose |
|---|---|
night_ped_cpr/config/config.lua |
Main settings, permissions, framework integration, animations |
night_ped_cpr/client/c_functions.lua |
Revive, respawn, and downed-state restore handlers |
night_ped_cpr/server/s_functions.lua |
Permissions, downed checks, and server exports |
Configuration Process
Section titled “Configuration Process”- Open VS Code and navigate to the config files
- Read thoroughly - each line has explanatory comments
- Configure settings - customize cooldowns, duration, and survival rates
- Test frequently - use F8 console for error checking
How It Works
Section titled “How It Works”Command
Section titled “Command”- Default command:
/cpr(configurable viaConfig.Commands.CPR) - Stand within 2 metres of a downed player or eligible NPC
- Player CPR requires the victim to be incapacitated; the server confirms eligibility before sync starts
CPR Performance
Section titled “CPR Performance”- Player CPR — Staged sync: setup → loop → outro, relayed through the server to both clients
- NPC CPR — Local session on the performer client with the same animation set
- Survival roll — Server rolls against
Config.Settings.PercentageOfSurvivalwhen CPR completes - Successful CPR — Framework revive (or Coma & Down / standalone revive)
- Failed CPR — Victim stays in death mode; downed death animation is restored in place (no hospital teleport on ESX)
Configuration Options
Section titled “Configuration Options”| Setting | Description |
|---|---|
AllowCPROnPedOrPlayer |
1 = both, 2 = NPC only, 3 = player only |
DurationOfCPR |
Loop stage length in seconds |
OutroAnimationDuration |
Finish animation length in seconds |
PercentageOfSurvival |
Chance of successful revival (0–100) |
CPRCooldown |
Cooldown messaging while a session is active |
Positioning |
Victim/paramedic offsets (matched to ERS CPR defaults) |
Permissions
Section titled “Permissions”Configure Config.Permissions the same way as ERS:
EveryoneHasPermission = true— Anyone can use/cprEnable_Night_DiscordApi_Permissions— Requiresnight_discordapiEnable_Ace_Permissions— Match principals inCPRRolesOrGroupsEnable_ESX_Permissions— Job and/or group checksEnable_QBCore_Permissions— Job and/or permission checks (also used for Qbox via qb-core bridge)
See ACE Permissions and Discord API for setup guides.
ESX failed CPR note
Section titled “ESX failed CPR note”ESX Legacy does not expose an instant hospital respawn client event. After failed CPR, the resource restores the victim’s downed animation using Config.Integrations.ESX.DeathAnim (default: misslamar1dead_body / dead_idle). Match these values to your esx_ambulancejob Config.DeathAnim if you use custom death animations.
Optional hook: set Config.Integrations.ESX.RestoreDownedClientEvent to re-enter a custom ambulance death script after failed CPR.
Export Functions
Section titled “Export Functions”Server-Side Exports (night_ped_cpr/server/s_functions.lua)
Section titled “Server-Side Exports (night_ped_cpr/server/s_functions.lua)”Use these exports from other server-side scripts:
-- Returns true if the player is downed/dead (state bags + ESX/QBCore metadata fallback)local isDowned = exports['night_ped_cpr']:IsPlayerDownedOnServer(targetSource)
-- Returns true if the player is allowed to perform CPR (same rules as /cpr)local canCpr = exports['night_ped_cpr']:HasCprPermission(source)
-- Manually restore a victim's downed/death animation and framework metadata-- (same path used automatically after failed player CPR)exports['night_ped_cpr']:RestorePlayerDownedFramework(targetSource)| Export | Returns | Description |
|---|---|---|
IsPlayerDownedOnServer(playerSrc) |
boolean |
Checks player state bags and ESX/QBCore death metadata |
HasCprPermission(source) |
boolean |
Server-authoritative CPR permission check |
RestorePlayerDownedFramework(targetSrc) |
— | Restores downed animation after interrupted/failed CPR; updates ESX/QBCore metadata |
Server Events (revive / respawn triggers)
Section titled “Server Events (revive / respawn triggers)”Trigger these from server-side scripts to force framework revive or hospital respawn outside of a CPR session:
-- Framework-aware revive (ESX / QBCore / Qbox / Coma & Down / standalone)TriggerEvent('night_ped_cpr_export:revive', targetSource)
-- Framework-aware hospital respawnTriggerEvent('night_ped_cpr_export:respawn', targetSource)Integration & Compatibility
Section titled “Integration & Compatibility”Framework Support
Section titled “Framework Support”| Framework | Revive | Failed CPR |
|---|---|---|
| ESX | Config.Integrations.ESX.ReviveClientEvent |
Restores downed death animation in place |
| QBCore | Config.Integrations.QBCore.ReviveClientEvent |
Restores downed state via client restore |
| Qbox | qbx_medical:Revive export or configured client event |
Restores downed state via client restore |
| Standalone | Built-in client revive handler | Built-in downed animation restore |
| Coma & Down | night_coma_down_system exports |
Client :restoreDownedState when enabled |
Medical System Integration
Section titled “Medical System Integration”- Coma & Down System — Set
Config.Integrations.Enable_Coma_and_Down_System = truefor revive/respawn via Coma & Down System - ERS — Uses the same CPR animation set and positioning offsets as ERS ped CPR
- Discord API — Role-based CPR permissions via night_discordapi
Server Integration
Section titled “Server Integration”- Universal Compatibility — Works with OneSync Legacy and Infinity
- Performance Optimized — No idle resmon; control lock only runs during active CPR
- Version checker — Compares resource and config version against the Nights Google Sheet on start
Troubleshooting
Section titled “Troubleshooting”Common Issues
Section titled “Common Issues”Debugging Tips
Section titled “Debugging Tips”- Check F8 Console - Look for any error messages
- Test CPR on Different Targets - Try both players and NPCs
- Verify Configuration - Check all config settings are correct
- Check Integration - Ensure Coma & Down System is properly configured if using
Best Practices
Section titled “Best Practices”Medical Configuration
Section titled “Medical Configuration”- Cooldown Settings - Set appropriate cooldowns for server balance
- Survival Rates - Configure realistic survival percentages
- Target Selection - Choose appropriate targets for your server
- Duration Settings - Set realistic CPR performance times
Performance Optimization
Section titled “Performance Optimization”- Animation Optimization - Ensure animations run smoothly
- Target Limits - Configure appropriate target restrictions
- Cooldown Management - Balance gameplay with realistic mechanics
- Regular Testing - Test CPR functionality regularly
User Experience
Section titled “User Experience”- Clear Instructions - Provide users with CPR usage guidelines
- Medical Training - Offer guidance on proper CPR procedures
- Roleplay Enhancement - Encourage realistic medical roleplay
- Emergency Procedures - Integrate with other medical systems
Support
Section titled “Support”Read through the instructions again if you have not managed to install the resource. Can’t get it to work still? Create a ticket through our dedicated support system in Discord: