AFAIK, u suppose to lose 1 health per sec when u r ledge hanging
I don't know if there is a native to adjust the post hanged health
but you could store client pre health before ledge hanging and then restore it after being revived
something like this
PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <left4dhooks>
int g_iPermHealth_Pre[MAXPLAYERS+1];
int g_iTempHealth_Pre[MAXPLAYERS+1];
int g_iPermHealth_Post[MAXPLAYERS+1];
int g_iTempHealth_Post[MAXPLAYERS+1];
public void OnPluginStart()
{
HookEvent("revive_success", Event_ReviveSuccess, EventHookMode_Post);
}
public Action OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon)
{
if (!client || !IsClientInGame(client) || GetClientTeam(client) != 2 || !IsPlayerAlive(client) || GetEntProp(client, Prop_Send, "m_isHangingFromLedge") == 0) return Plugin_Handled;
g_iPermHealth_Pre[client] = GetClientHealth(client);
g_iTempHealth_Pre[client] = RoundToFloor(L4D_GetTempHealth(client));
return Plugin_Continue;
}
void Event_ReviveSuccess(Event event, const char[] name, bool dontBroadcast)
{
if (!event.GetBool("ledge_hang")) return;
int client = GetClientOfUserId (event.GetInt("subject"));
if (!client || !IsClientInGame(client)) return;
g_iPermHealth_Post[client] = g_iPermHealth_Pre[client];
g_iTempHealth_Post[client] = g_iTempHealth_Pre[client];
CreateTimer(0.1, Timer_RestoreClientHealth, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}
Action Timer_RestoreClientHealth(Handle timer, int userid)
{
int client = GetClientOfUserId(userid);
if(client == 0 || !IsClientInGame(client)) return Plugin_Stop;
SetEntProp(client, Prop_Send, "m_iHealth", g_iPermHealth_Post[client], 1);
L4D_SetTempHealth(client, float(g_iTempHealth_Post[client]));
return Plugin_Handled;
}
__________________