Raised This Month: $32 Target: $400
 8% 

How to get Max Clients on server


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 02-21-2021 , 08:44   How to get Max Clients on server
Reply With Quote #1

I am editing a plugin and I need to get the Max Players that Server can handle! On my Case is 10, but How can I do that?

I saw in some topic to use MaxClients, but they say that this var will be "MaxClients will equal whatever the server's maxplayers var", but if I dont have the maxplayers var? They talk about server.cfg?

How can I get the max number of players?

Thread were I saw this: https://forums.alliedmods.net/showthread.php?t=132926
__________________
FreezerPT is offline
TomL.
Veteran Member
Join Date: Oct 2017
Location: Germany
Old 02-21-2021 , 09:02   Re: How to get Max Clients on server
Reply With Quote #2

MaxClients is the maximum number of players currently allowed to connect to the server.
MAXPLAYERS is the theoretical maximum number of clients allowed by the engine.
EDIT: My bad I meant to say to use neither of them but GetMaxHumanPlayers.

Last edited by TomL.; 02-22-2021 at 11:22.
TomL. is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 02-21-2021 , 09:07   Re: How to get Max Clients on server
Reply With Quote #3

Quote:
Originally Posted by TomL. View Post
MaxClients is the maximum number of players currently allowed to connect to the server.
MAXPLAYERS is the theoretical maximum number of clients allowed by the engine.
So you want to use MaxClients.
Ok, but If I dont set any maxplayers on my gamemodes_server.txt.example, what will be the value of MaxClients?

So I had tested the plugin and Printing to the console and the result of MaxClients is 64, but My server only has 10
__________________

Last edited by FreezerPT; 02-21-2021 at 09:25.
FreezerPT is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-21-2021 , 11:02   Re: How to get Max Clients on server
Reply With Quote #4

Because game is CSGO, it will be 64 slot.
To get Max human players - GetMaxHumanPlayers

PHP Code:

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    
PrintToServer("GetMaxHumanPlayers %i / MaxClients %i / MAXPLAYERS %i"GetMaxHumanPlayers(), MaxClientsMAXPLAYERS);

    return 
Plugin_Handled;

*Note
If server have launched with -maxplayers_override 32, gamemodes txt file can't change max player size any more. (It will be 32 slot all the time. )

Last edited by Bacardi; 02-21-2021 at 11:04.
Bacardi is offline
FreezerPT
Senior Member
Join Date: Mar 2017
Location: 127.0.0.1
Old 02-21-2021 , 14:05   Re: How to get Max Clients on server
Reply With Quote #5

Quote:
Originally Posted by Bacardi View Post
Because game is CSGO, it will be 64 slot.
To get Max human players - GetMaxHumanPlayers

PHP Code:

public void OnPluginStart()
{
    
RegConsoleCmd("sm_test"test);
}

public 
Action test(int clientint args)
{
    
PrintToServer("GetMaxHumanPlayers %i / MaxClients %i / MAXPLAYERS %i"GetMaxHumanPlayers(), MaxClientsMAXPLAYERS);

    return 
Plugin_Handled;

*Note
If server have launched with -maxplayers_override 32, gamemodes txt file can't change max player size any more. (It will be 32 slot all the time. )
Worked! Thanks for the solution
__________________
FreezerPT 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 17:33.


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