Raised This Month: $ Target: $400
 0% 

Get num players allowed on server.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
WilliamDG
Junior Member
Join Date: Oct 2016
Location: Italy
Old 12-01-2016 , 09:44   Get num players allowed on server.
Reply With Quote #1

How can i get the max num of players allowed on server?

For example, i have
Code:
-maxplayers_override 14
on my start command.
I try to use
Code:
GetMaxClients();
and it return 64 not 14.

There is a way to get that value? Something like this:
Code:
maxPlayersServer = FindConVar("maxplayers_override");
WilliamDG is offline
headline
SourceMod Moderator
Join Date: Mar 2015
Old 12-01-2016 , 12:48   Re: Get num players allowed on server.
Reply With Quote #2

Quote:
Originally Posted by WilliamDG View Post
How can i get the max num of players allowed on server?

For example, i have
Code:
-maxplayers_override 14
on my start command.
I try to use
Code:
GetMaxClients();
and it return 64 not 14.

There is a way to get that value? Something like this:
Code:
maxPlayersServer = FindConVar("maxplayers_override");
Don't use
PHP Code:
GetMaxClients(); 
Quote:
This function will be deprecated in a future release. Use the MaxClients variable instead. Returns the maximum number of clients allowed on the server. This may return 0 if called before OnMapStart(), and thus should not be called in OnPluginStart(). You should not globally cache the value to GetMaxClients() because it can change from SourceTV or TF2's arena mode. Use the "MaxClients" dynamic variable documented at the top of this file.
Try the dynamic var instead.
PHP Code:
 MaxClients 

Last edited by headline; 12-01-2016 at 12:49.
headline is offline
WilliamDG
Junior Member
Join Date: Oct 2016
Location: Italy
Old 12-02-2016 , 08:20   Re: Get num players allowed on server.
Reply With Quote #3

Ok, thank you, i will try this later
WilliamDG is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 12-02-2016 , 08:32   Re: Get num players allowed on server.
Reply With Quote #4

You're after GetMaxHumanPlayers().
__________________
asherkin is offline
WilliamDG
Junior Member
Join Date: Oct 2016
Location: Italy
Old 12-02-2016 , 12:06   Re: Get num players allowed on server.
Reply With Quote #5

Quote:
Originally Posted by asherkin View Post
You're after GetMaxHumanPlayers().
Thank you, this work for me
WilliamDG 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 15:10.


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