Quote:
Originally Posted by kot4404
Do you think it is possible to use this method in https://forums.alliedmods.net/showthread.php?p=2521418 plugin?
Not sure if i'm adding it wrong or the game just doesn't allow that but my nickname is completly removed from the game setting my nick to unconnected when i'm idle or just stays completly visible
|
I forgot to post this extra check that I use. It checks first if the client is a bot controlled by an idle player before
bIsPlayerIdle is even checked. Feel free to mess around with it to get it working for you.
PHP Code:
bool bHasIdlePlayer(int client)
{
if (bIsSurvivor(client) && IsFakeClient(client))
{
int iIdler = GetClientOfUserId(GetEntProp(client, Prop_Send, "m_humanSpectatorUserID"));
if (iIdler)
{
if(!IsFakeClient(iIdler) && (GetClientTeam(iIdler) == 1))
{
return true;
}
}
}
return false;
}
This is how I applied both of them.
PHP Code:
bool bIsHumanSurvivor(int client)
{
return (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client) && GetClientTeam(client) == 2 && IsPlayerAlive(client) && !IsClientInKickQueue(client) && !IsFakeClient(client) && IsValidEntity(client) && !bHasIdlePlayer(client) && !bIsPlayerIdle(client));
}
PHP Code:
void vMenuViewers()
{
for (int iVoter = 1; iVoter <= MaxClients; iVoter++)
{
if (!bIsHumanSurvivor(iVoter))
{
continue;
}
iHumanSurvivors[iTotalHumans++] = iVoter;
}
}
If you need further help, please make a new thread.
__________________