Raised This Month: $213 Target: $400
 53% 

[l4d2]What is the different between MaxClients and MAXPLAYERS?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
chu1720
Senior Member
Join Date: Mar 2010
Location: Hong Kong
Old 07-20-2010 , 07:47   [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #1

Thanks for helping~~~
chu1720 is offline
Send a message via MSN to chu1720
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 07-20-2010 , 08:30   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #2

MaxClients changes per game - after compilation. For l4d2 it's 8, for css 32? or something like that.
MAXPLAYERS is a definition, its value is specified somewhere in the sourcemod includes and the compiler translates it to 64 i guess. always, doesnt matter which game, its not even sure which game the plugin will be running on.

There are a lot more cases in which you'll need MaxClients rather than MAXPLAYERS.
__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 07-20-2010 , 08:43   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #3

MaxClients will equal whatever the server's maxplayers var is set to with the exception that it is 0 before the first map start. It's great for loops on players.

As Thrawn said, MAXPLAYERS is just a hardcoded define of 64, the highest that any source game goes. This allows multigame plugins to declare global player arrays large enough to hold however many players the server may be started with.
psychonic is offline
chu1720
Senior Member
Join Date: Mar 2010
Location: Hong Kong
Old 07-20-2010 , 09:11   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #4

if i want to get all the common infected id using a for loop, e.g. for(new i = 0 ; i <= "Something", i++), does this "something" exist?
chu1720 is offline
Send a message via MSN to chu1720
Master53
Veteran Member
Join Date: Dec 2009
Old 07-20-2010 , 09:50   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #5

em what about GetMaxClients()??
__________________
Master(d)



Master53 is offline
Thrawn2
Veteran Member
Join Date: Apr 2009
Old 07-20-2010 , 10:04   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #6

Quote:
Originally Posted by Master53 View Post
em what about GetMaxClients()??
deprecated, use MaxClients instead. Contains the same value.

Quote:
does this "something" exist?
GetMaxEntities() is the one you are looking for. Not sure if there is a MaxEntities var.
__________________
einmal mit profis arbeiten. einmal.
Thrawn2 is offline
Damizean
SourceMod Donor
Join Date: Mar 2009
Old 07-21-2010 , 09:38   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #7

Quote:
Originally Posted by chu1720 View Post
if i want to get all the common infected id using a for loop, e.g. for(new i = 0 ; i <= "Something", i++), does this "something" exist?
PHP Code:
DoStuffToInfected()
{
    new 
iMaxEntities GetMaxEntities();
    for (new 
iEntity MaxClients 1iEntity iMaxEntitiesiEntity++)
    {
        if (
IsCommonInfected(iEntity))
        {
            
// Do stuff here...
        
}
    }
}

stock bool:IsCommonInfected(iEntity)
{
    if (
iEntity && IsValidEntity(iEntity)
    {
        
decl String:strClassName[64];
        
GetEdictClassName(iEntitystrClassNamesizeof(strClassName));
        return 
StrEqual(strClassName"infected");
    }
    return 
false;

__________________
Dat annoying guy
Damizean is offline
Send a message via AIM to Damizean Send a message via MSN to Damizean
chu1720
Senior Member
Join Date: Mar 2010
Location: Hong Kong
Old 07-21-2010 , 11:08   Re: [l4d2]What is the different between MaxClients and MAXPLAYERS?
Reply With Quote #8

Quote:
Originally Posted by Damizean View Post
PHP Code:
DoStuffToInfected()
{
    new 
iMaxEntities GetMaxEntities();
    for (new 
iEntity MaxClients 1iEntity iMaxEntitiesiEntity++)
    {
        if (
IsCommonInfected(iEntity))
        {
            
// Do stuff here...
        
}
    }
}

stock bool:IsCommonInfected(iEntity)
{
    if (
iEntity && IsValidEntity(iEntity)
    {
        
decl String:strClassName[64];
        
GetEdictClassName(iEntitystrClassNamesizeof(strClassName));
        return 
StrEqual(strClassName"infected");
    }
    return 
false;

Thanks very much~~~
chu1720 is offline
Send a message via MSN to chu1720
Reply


Thread Tools
Display Modes

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 01:41.


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