Yes thats true as it is now. Its an entity in the entity list immediately after world which is entity 0. Slot #1 would be entity #1.
CTFBOT mod uses this QC to determine how many player slots there are in a running server, which I modified a little bit to also track active / live clients:
As it stands now I have it only being called in Worldspawn() but if its called in ClientConnect () it might actually better update actual players in a live game...and also perhaps a variation in ClientDisconnect() as well...but thats the general idea.
CTFBOT mod uses this QC to determine how many player slots there are in a running server, which I modified a little bit to also track active / live clients:
Code:
void () clientInitMaxClients =
{
local entity ent;
ent = nextent (world);
while ((ent.classname != "worldspawn"))
{
fMaxClients = (fMaxClients + 1);
if (ent.netname != "")
total_clients = total_clients + 1;
ent = nextent (ent);
}
//localcmd ("echo clientInitMaxClients() \n");
localcmd ("echo Maxclients: ");
localcmd (ftos(fMaxClients));
localcmd ("\n");
localcmd ("echo Active clients: ");
localcmd (ftos(total_clients));
localcmd ("\n");
};
Originally posted by slackhead
View Post

Comment