This is a fork of original work from panxiaohai. Published by request.
My previous public version was 1.0.5. See the changelog for news.
Description:
When some one die, there are two ways to bring him back to life in this plugin:
1. Using First Aid Kit:
- Going close to blinking light, select medkit and press Crouch+Use for several seconds befor blinking light disappear, after revive, the medkit will disappear.
2. Using CPR:
- Going close to blinking light, press Crouch+Use for several seconds as quick as possible, the dead one will be revived and go to black and white.
Settings (ConVars):
Can be found in cfg/sourcemod/l4d_revive&cpr.cfg
PHP Code:
// Enable ability to revive a dead player? (0 - No, 1 - Yes)
l4d_revive_enable "1"
// How long does revive with medkit take?
l4d_revive_duration "10"
// Revive with medkit health
l4d_revive_health "50"
// Dead bodys can be revived with medkit up to x seconds, 0:disable revive
l4d_revive_maxtime "300"
// Enable ability to CPR a dead player? (0 - No, 1 - Yes)
l4d_CPR_enable "1"
// Dead bodys can be CPR within x seconds, 0:disable artificial respiration
l4d_CPR_maxtime "15"
// How long does CPR take
l4d_CPR_duration "6"
// Incaps count set after somebody CPR you (set -1 to use default game black/white incap count)
l4d_CPR_incap_count "-1"
// Y Offset from the floor of spawned particle light effect
l4d_CPR_floor_offset "0"
Particle Light types:
There 3 types, which can be selected by checging value of "LIGHT_TYPE" in file l4d_revivecpr.sp and recompilation:
PHP Code:
// (default) - to use little red light
#define LIGHT_TYPE 1
// (default) - to use little green light
#define LIGHT_TYPE 2
// (default) - to use bright red light (attention: performance issues are noticed when I used this particle!)
#define LIGHT_TYPE 3
Commands:
Nothing.
Natives & Forwards: (for developers)
Spoiler
PHP Code:
/**
* Restrict opportunity to revive player (until round end).
*
* @param iTarget If specified, control ability to revive this player.
* @param iInitiator If specified, control ability of initiator to revive somebody.
* @param bLock true - to block ability, false - allow.
* @param fTimeout If specified, revert changes after this amount of seconds.
*
* @error Wrong number of arguments.
* @noreturn
*/
native int RC_ReviveLock(int iTarget = 0, int iInitiator = 0, bool bLock = true, float fTimeout = 0.0);
/**
* Called when somebody finished CPR you.
*
* @param client Client index who did CPR.
* @param subject Client index been revived.
* @param bUseMedkit true - if medkit used.
*/
forward void OnClientCPR(int client, int subject, bool bUseMedkit);
Compatibility:
- L4D1
- L4D2
ChangeLog:
Spoiler
Quote:
1.0.11 (29-Jan-2022) Dragokas
- Fixed formula for calculation Y position of particle light.
- Added ConVar l4d_CPR_floor_offset - Y Offset from the floor of spawned particle light effect.
- Included Spanish translation and small changes to English (thanks to @Ernecio).
- Updated "Heartbeat" plugin detection method.
- Added LIGHT_TYPE define to be able to change particle name (allowed values: 1 - little red, 2 - little green, 3 - bright red (can cause performance issues)).
- Config file is renamed to l4d_revive&cpr.cfg.
- Fixed compilation warnings on SM 1.11.
1.0.10 (Dragokas)
- Removing particle when player go !afk.
- Player respawned in sitting state.
1.0.9 (Dragokas)
- Prevented rare case with double-revive.
1.0.8 (Dragokas)
- Code speed optimization.
- Code is beautified.
- Passing entities by reference and other safe checks.
- Fixed medkit entities leak.
- Added compatibility with "Heartbeat (Revive Fix - Post Revive Options)" plugin (thanks to Silvers for helping testing)
- Added ConVar "l4d_CPR_incap_count" - def.: -1 - Incaps count set after somebody CPR you (set -1 to use default game incap count of black/white)
- Added ConVar "l4d_revive_enable" - def.: 1 - Enable ability to revive a dead player? (0 - No, 1 - Yes)
- Added ConVar "l4d_CPR_enable" - def.: 1 - Enable ability to CPR a dead player? (0 - No, 1 - Yes)
- Changed ConVars flags to notify.
- Improved code for preventing statistics reset on respawn.
1.0.7 (Dragokas)
- Added native RC_ReviveLock.
- Little optimizations.
1.0.6 (Dragokas)
- Appended gamedata to support L4D2
1.0.5 (Dragokas)
- signal light is replaced by more bright ligth (thanks to Sunyata)
- added particle precaching.
- RemoveEdict is replaced by AcceptEntityInput.
- added the sound when you successfully revived the player and when you began to revive.
1.0.4 (Dragokas)
- Created global forward: void OnClientCPR(int client, int subject, bool bUseMedkit)
1.0.3 (Dragokas)
- Fixed the case when player died in the air so you unable to help him.
1.0.2 (Dragokas)
- Added translation into Russian (with coloring support)
- Translated to new syntax and methodmaps
1.0.1 (Dragokas)
- Added restoring player statictics
Donate
Donates are very appreciated and welcomed for further inspiration, make me happy, and make next updates came out more often:
- Patreon (Paypal)
- BitCoin
- Ю.Money
Update Simplified Chinese and Traditional Chinese support。
Modify Simplified Chinese and Traditional Chinese texts, the origin english and the other versions texts are not accurate.
更新了简体中文和繁体中文支持。
修改了简体中文和繁体中文描述,默认文本不准确。