Raised This Month: $319 Target: $400
 79%   Almost there!

[L4D2] Starting Health

Post New Thread Reply   
Thread Tools Display Modes
Author Message
SourceMod Donor
Join Date: Aug 2010
Old 02-27-2011 , 07:30   [L4D2] Starting Health
Reply With Quote #1

How can I set the Survivorīs HP when starting maps (safe room) and when they are spawning in a COOP server?

Itīs pretty easy do that with respawn (after death), climbed and revived:
sm_cvar z_survivor_respawn_health
sm_cvar survivor_ledge_grab_health
sm_cvar survivor_revive_health

but I donīt know how to do this with starting health in the spawn (reconnect), and/or in the safe.

Can anybody help?
Zbeer is offline
Join Date: Jul 2021
Old 10-12-2021 , 06:14   Re: [L4D2] Starting Health
Reply With Quote #2

Bumping since i need to know this too.
Hawkins is offline
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-13-2021 , 03:52   Re: [L4D2] Starting Health
Reply With Quote #3

This suppose to work when player spawn at start of map or safe room.
cvar: survivor_start_health
- 150 is default value, edit code or add cvar in config file.

PHP Code:
bool IsInCheckpoint[10];

ConVar survivor_start_health;

void OnPluginStart()
//HookEvent("player_entered_start_area", area);
survivor_start_health CreateConVar("survivor_start_health""150"" - health amount when map start"_true1.0true9999.0);

void spawn(Event event, const char[] namebool dontBroadcast)
int client GetClientOfUserId(event.GetInt("userid"));
GetClientTeam(client) != 2) return;
GetEntProp(clientProp_Send"m_isInMissionStartArea") || IsInCheckpoint[client])
//SetEntityHealth(client, 999);

CreateTimer(1.0delayevent.GetInt("userid"), TIMER_FLAG_NO_MAPCHANGE);

Action delay(Handle timerany data)
int client GetClientOfUserId(data);
client || !IsClientInGame(client)) return;


void area(Event event, const char[] namebool dontBroadcast)

void checkpoint(Event event, const char[] namebool dontBroadcast)
int client GetClientOfUserId(event.GetInt("userid"));
client) return;

IsInCheckpoint[client] = true;
IsInCheckpoint[client] = false;

Do not Private Message @me
Bacardi is offline
Senior Member
Join Date: Oct 2005
Old 10-16-2021 , 03:47   Re: [L4D2] Starting Health
Reply With Quote #4

Originally Posted by Hawkins View Post
Bumping since i need to know this too.
This plugin will do what you are looking for.
It sets the health of every survivor when the map starts and when they spawn in the safe room.

You can boost the health or reduce the health by setting the one cvar.
Just make sure you use only integer values like:

abs_l4d2_StartingHealth 150
abs_l4d2_StartingHealth 65

This is a modification of a plugin I wrote that when a player spawns in the safe room,
if their health is less then 50% boost them to 50%.
So you will notice when the health is set I also

Reset the incap count
Turn off the is going to die
Turn off the third strike
Reset their temp health
Turn off the heartbeat sound if they were B+W

The only strange thing about this plugin is the health is also set when you take over a bot.
I guess the engine is “spawning” you as the bot and thus player_spawn is called for that too.

Anyone know how I can tell if player_spawn is being called for a bot take over instead of a map start or safe room spawn?
Attached Files
File Type: sp Get Plugin or Get Source (L4D2_HealthSet.sp - 8 views - 2.0 KB)

Last edited by Austin; 10-16-2021 at 05:17.
Austin is offline
Join Date: Jul 2021
Old Yesterday , 13:58   Re: [L4D2] Starting Health
Reply With Quote #5

Ye thats the issue, i dont want survivors to re-fill their HP everytime someone ragequits / joins and takes over a survivor bot.

I need to set it at the start for all survivors and thats it.
Similar to RayMans Admin System chat command: !max_health all 200
Hawkins is offline

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -4. The time now is 19:28.

Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.
Theme made by Freecode