Raised This Month: $51 Target: $400
 12% 

Check only for real clients


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Ellie
Senior Member
Join Date: Apr 2013
Old 11-14-2014 , 12:33   Check only for real clients
Reply With Quote #1

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.

Code:
public OnMapStart()
{
    ServerCommand("wait 1000; exec waitforit.cfg");
}
Then I tried this but it doesn't quite work.

Code:
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?
Ellie is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 11-14-2014 , 17:34   Re: Check only for real clients
Reply With Quote #2

smthing like this
Spoiler
Bacardi is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 11:10.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode