Hi guys,
I'm wanting to check to see how many people are in the game at the start of each round. But also allow all functions to have access to this variable at any time.
Code:
stock GetRealClientCount( bool:inGameOnly = true ) {
new clients = 0;
for( new i = 1; i <= GetMaxClients(); i++ ) {
if( ( ( inGameOnly ) ? IsClientInGame( i ) : IsClientConnected( i ) ) && !IsFakeClient( i ) ) {
clients++;
}
}
return clients;
}
I know how to call this once at round start, but I'm not sure how to allow all the following functions access to it. Eg.
Code:
roundStart()
{
pCount = GetRealClientCount();
}
anotherFunction()
{
blah blah blah
doSometingWithpCount(pCount);
}