View Single Post
Author Message
gilmon
Senior Member
Join Date: Feb 2011
Location: China
Old 08-20-2014 , 09:31   [L4D2]Get/set player health?
Reply With Quote #1

I know there's a simple way like this but sometime dont't work.

PHP Code:
public AutoFixHealth()
{
    
CreateTimer(60.0Fixhealth_TIMER_REPEAT);
}

public 
Action:Fixhealth(Handle:timer)
{
      for (new 
1<= MaxClientsi++)
      {
         if (
IsClientInGame(i) && (GetClientTeam(i) == 2) && !IsFakeClient(i))
         {
                      if(
GetEntProp(targetProp_Data"m_iHealth") > 100)
                  {
                          
SetEntProp(targetProp_Send"m_iHealth"100);
                      }
             }
      }

And this will not work right when player incapacitated,will also set to 100.any help about it? if always check player is stand/incapacitated there will a lot of code.
gilmon is offline
Send a message via MSN to gilmon