View Single Post
Iciaria
Member
Join Date: Aug 2022
Old 03-26-2023 , 11:11   Re: [L4D2] About "IsClientInGame()"
Reply With Quote #6

that should be right
PHP Code:
public void OnPluginStart()
{
#if DEBUG
        
HookEvent("weapon_fire"Event_Weapon_Fire);            
#endif
}
void Event_Weapon_Fire(Event event, const char[] namebool dontBroadcast)
{
        
int client GetClientOfUserId(event.GetInt("userid"));
        if(!
IsFakeClient(client))
        {
                
CheckStatus();
        }
}
void CheckStatus()
{
        for(
int i =1i<=MaxClientsi++)
        {
                if(!
IsClientInGame(i) )
                        continue;
                if(
GetClientTeam(i) == 2)
                {       
                        
char name[64];
                        
GetClientName(inamesizeof(name) );
                        
int health GetEntProp(iProp_Send"m_iHealth");
                        
float buffer GetTempHealth(i);
                        
int count GetEntProp(iProp_Send"m_currentReviveCount");
                        
PrintToChatAll("%s#HP:%d, TEMP:%f, REV:%d,"namehealthbuffercount);
                        
PrintToServer("%s#HP:%d, TEMP:%f, REV:%d,"namehealthbuffercount);
                }
        }


Code:
L 03/24/2023 - 19:59:23: [SM] Blaming: test.smx
L 03/24/2023 - 19:59:23: [SM] Call stack trace:
L 03/24/2023 - 19:59:23: [SM]   [0] Event.GetInt
L 03/24/2023 - 19:59:23: [SM]   [1] Line 90, test.sp::Event_Weapon_Fire
Sorry I seem to have forgotten to paste a lot of important stuff
, the problem is only because of "return;"
Anyway thanks.
__________________
Sorry,my english not good
Iciaria is offline