I'm having some problems writing a plugin.
The code snippet looks like this
public void OnPluginStart()
HookEvent("weapon_fire", Event_Weapon_Fire, EventHookMode_PostNoCopy);
for(int i =1; i<=MaxClients; i++)
// if(!IsValidEntity(i) )
// if(!IsClientConnected(i) )
// if(!IsValiClient(i) )
if(GetClientTeam(i) == 2)
GetClientName(i, name, sizeof(name) );
int health = GetEntProp(i, Prop_Send, "m_iHealth");
float buffer = GetTempHealth(i);
//GetEntPropFloat(i, Prop_Send, "m_healthBuffer");
int count = GetEntProp(i, Prop_Send, "m_currentReviveCount");
PrintToChatAll("%s#HP:%d， TEMP:%f， REV:%d,", name, health, buffer, count);
PrintToServer("%s#HP:%d， TEMP:%f， REV:%d,", name, health, buffer, count);
I run many tests on my multiple servers.
"IsClientInGame()" sometimes thinks the client is not in the game.
The following situations have occurred in the test:
1.Only the first player to join is considered "in game".
2.Following the first point, when a second player joins the server, the fake client will be considered "Not in game", and . The second player is also sometimes considered "Not in game".
3.All players, fake clients or not, are correctly considered "in game"
4.Only real players are considered "in game"
I also tested in pure server and the result is still the same
Initially, it throws
03/24/2023 - 19:59:23: [SM] Call stack trace:
L 03/24/2023 - 19:59:23: [SM]  Event.GetInt
L 03/24/2023 - 19:59:23: [SM]  Line 90, test.sp::Event_Weapon_Fire
After I removed "EventHookMode_PostNoCopy", the error in the log above disappeared. However, the problem is still happening..
I also tried changing the cvars "sv_lan" and "sv_cheats", but, the miracle didn't happen.
Can anyone tell me what exactly is going on?
I'm very confused.......