I was playing around with the values and found out a method to get the exact amount of health a survivor has, including the temporal health too. Here's the stock, but i also added explanation in case anybody wanted to know.
Note: I dunno if this has been done yet, but i just want to share it with you.
PHP Code:
/**
* @brief Will return a survivors health, including also the temporal health.
*
* @client Client index to retrieve the health from.
*
* @return Returns the client's health as an integer.
* @error Will return -1 if there was any problem.
*/
stock GetClientRealHealth(client)
{
//First filter -> Must be a valid client, successfully in-game and not an spectator (The dont have health).
if(!client
|| !IsValidEntity(client)
|| !IsClientInGame(client)
|| !IsPlayerAlive(client)
|| IsClientObserver(client))
{
return -1;
}
//If the client is not on the survivors team, then just return the normal client health.
if(GetClientTeam(client) != 2)
{
return GetClientHealth(client);
}
//First, we get the amount of temporal health the client has
new Float:buffer = GetEntPropFloat(client, Prop_Send, "m_healthBuffer");
//We declare the permanent and temporal health variables
new Float:TempHealth;
new PermHealth = GetClientHealth(client);
//In case the buffer is 0 or less, we set the temporal health as 0, because the client has not used any pills or adrenaline yet
if(buffer <= 0.0)
{
TempHealth = 0.0;
}
//In case it is higher than 0, we proceed to calculate the temporl health
else
{
//This is the difference between the time we used the temporal item, and the current time
new Float:difference = GetGameTime() - GetEntPropFloat(client, Prop_Send, "m_healthBufferTime");
//We get the decay rate from this convar (Note: Adrenaline uses this value)
new Float:decay = GetConVarFloat(FindConVar("pain_pills_decay_rate"));
//This is a constant we create to determine the amount of health. This is the amount of time it has to pass
//before 1 Temporal HP is consumed.
new Float:constant = 1.0/decay;
//Then we do the calcs
TempHealth = buffer - (difference / constant);
}
//If the temporal health resulted less than 0, then it is just 0.
if(TempHealth < 0.0)
{
TempHealth = 0.0;
}
//Return the value
return RoundToFloor(PermHealth + TempHealth);
}