Quote:
Originally Posted by Dragokas
OMG, so difficult. My mind refuses to understand what is happening there.
Code:
int fakebot = FindBotToTakeOver(); //search fake bot again
Can you, please, show what is that?
|
PHP Code:
int FindBotToTakeOver()
{
for (int i = 1; i <= MaxClients; i++)
{
if(IsClientInGame(i))
{
if (IsFakeClient(i) && GetClientTeam(i)==TEAM_SURVIVORS && !HasIdlePlayer(i) && IsPlayerAlive(i))
return i;
}
}
return 0;
}
bool HasIdlePlayer(int bot)
{
if(HasEntProp(bot, Prop_Send, "m_humanSpectatorUserID"))
{
int client = GetClientOfUserId(GetEntProp(bot, Prop_Send, "m_humanSpectatorUserID"));
if(client > 0 && client <= MaxClients && IsClientInGame(client) && !IsFakeClient(client) && IsClientObserver(client))
{
return true;
}
}
return false;
}
__________________