Ellie
11-14-2014, 12:33
I'm trying to do a small plugin that will run a server command on map start. However, I'd like it to only run if there is at least 1 human player connected and in game. I don't want it to run if there are no players connected at all.
I had this below, which seem to work some of the time, but I see in console it that is also sometimes runs it even before human players join.
public OnMapStart()
{
ServerCommand("wait 1000; exec waitforit.cfg");
}Then I tried this but it doesn't quite work.
public OnMapStart()
{
for( new i=1; i <= MaxClients; i++ )
{
if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient( i ) )
{
ServerCommand("wait 1000; exec waitforit.cfg");
}
}
}Any suggestion on a better way to do this?
I had this below, which seem to work some of the time, but I see in console it that is also sometimes runs it even before human players join.
public OnMapStart()
{
ServerCommand("wait 1000; exec waitforit.cfg");
}Then I tried this but it doesn't quite work.
public OnMapStart()
{
for( new i=1; i <= MaxClients; i++ )
{
if(IsClientConnected(i) && IsClientInGame(i) && !IsFakeClient( i ) )
{
ServerCommand("wait 1000; exec waitforit.cfg");
}
}
}Any suggestion on a better way to do this?