Quote:
Originally Posted by ZackNAttack
Is there a way to, with input being an integer, create the green text that appears from touching a health kit?
|
Here's a
GiveHealth stock I use that recreates the green health text. If you only need the green text part, check the Event lines.
Unfortunately, recent updates to TF2 have disabled the green text now.
In the past, this stock's green text worked. Sorry for not having found this earlier.
PHP Code:
void GiveHealth(int client, int total_Heal = 0, bool overheal = false, bool event = true)
{
if (total_Heal <= 0) return;
int HP = GetClientHealth(client);
int max_HP = GetResourceProperty(client, "m_iMaxHealth");
if (overheal)
{ max_HP = max_HP+(max_HP/2); }
/*if (total_Heal+HP >= max_HP)
{ SetEntityHealth(client, max_HP); }
else
{ SetEntityHealth(client, total_Heal+HP); }*/
if (HP < max_HP)
{
if (total_Heal+HP >= max_HP)
{ SetEntityHealth(client, max_HP); }
else
{ SetEntityHealth(client, total_Heal+HP); }
}
if (event)
{
Event player_healonhit = CreateEvent("player_healonhit", true);
SetEventInt(player_healonhit, "amount", total_Heal);
SetEventInt(player_healonhit, "entindex", EntRefToEntIndex(client));
FireEvent(player_healonhit);
}
}
int GetResourceProperty(int client, const char[] str)
{
int ply_manager = GetPlayerResourceEntity();
if (RealValidEntity(ply_manager))
{
return GetEntProp(ply_manager, Prop_Send, str, _, client);
}
return -1;
}
__________________