Raised This Month: $ Target: $400
 0% 

get slot count


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 03-28-2013 , 19:12   get slot count
Reply With Quote #1

ugh maybe i just overlooked but i cant seem to find a native to get slot count, nor a cvar that would contain it, maxplayers is a command, not a cvar, getmaxclients / MaxClients is always 64 (65 with sourcetv)

edit: im testing on a 12 slot csgo server
edit2: MaxClients does contain the slot count in css, seems like its reporting 64 everytime in csgo tho
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 03-28-2013 at 19:30.
Zephyrus is offline
Sreaper
髪を用心
Join Date: Nov 2009
Old 03-28-2013 , 19:40   Re: get slot count
Reply With Quote #2

This page might help you out.
http://wiki.alliedmods.net/CSGO_Quirks#Max_Players.2C_Clients

Last edited by Sreaper; 03-28-2013 at 19:43.
Sreaper is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 03-28-2013 , 19:46   Re: get slot count
Reply With Quote #3

Quote:
Originally Posted by Sreaper View Post
"This is the number known as gpGlobals->maxClients in SM extensions or MM:S plugins and MaxClients in SourcePawn. "

but it returns the absolute maximum, as i said in op, i rather not parse all the possible txt files for the value, actually this method is the fastest one in the least lines:

PHP Code:
g_iSlots = -1;

public 
GetSlots()
{
        
SetConVarInt(FindConVar("bot_join_after_player"), 0);
        
SetConVarInt(FindConVar("bot_difficulty"), 0);
        
SetConVarInt(FindConVar("bot_quota"), MaxClients);
        
SetConVarInt(FindConVar("bot_difficulty"), 1);
        
SetConVarInt(FindConVar("bot_quota"), MaxClients+1);
        
SetConVarInt(FindConVar("bot_difficulty"), 2);
        
SetConVarInt(FindConVar("bot_quota"), MaxClients+2);
        
SetConVarInt(FindConVar("bot_difficulty"), 3);
        
SetConVarInt(FindConVar("bot_quota"), MaxClients+3);

        
CreateTimer(1.0GetSlotCount);
}

public 
Action:GetSlotCount(Handle:timerany:data)
{
    
SetConVarInt(FindConVar("bot_quota"), 0);
    
g_iSlots GetClientCount(false);
    return 
Plugin_Stop;

basically it fills the server with bots for a second then checks the number of clients ingame
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 03-28-2013 at 19:47.
Zephyrus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-28-2013 , 20:20   Re: get slot count
Reply With Quote #4

Quote:
Originally Posted by Zephyrus View Post
ugh maybe i just overlooked but i cant seem to find a native to get slot count, nor a cvar that would contain it, maxplayers is a command, not a cvar, getmaxclients / MaxClients is always 64 (65 with sourcetv)

edit: im testing on a 12 slot csgo server
edit2: MaxClients does contain the slot count in css, seems like its reporting 64 everytime in csgo tho
maxplayers isn't anything, not a command. I think that you're thinking of the -maxplayers command-line option.

MaxClients is the same as whatever gpGlobals->maxClients is after ServerActivate processes. This would be the same as the maxClients passed to ServerActivate, but with the addition of any new slot for SourceTV/Replay if applicable.

This is the maximum number of clients that will be able to join until the next ServerActivate (map change).

On CS:GO, lacking the -maxplayers option, it would be whatever GetPlayerLimits says is the default.
psychonic is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 03-28-2013 , 20:34   Re: get slot count
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
maxplayers isn't anything, not a command. I think that you're thinking of the -maxplayers command-line option.

MaxClients is the same as whatever gpGlobals->maxClients is after ServerActivate processes. This would be the same as the maxClients passed to ServerActivate, but with the addition of any new slot for SourceTV/Replay if applicable.

This is the maximum number of clients that will be able to join until the next ServerActivate (map change).

On CS:GO, lacking the -maxplayers option, it would be whatever GetPlayerLimits says is the default.
actually maxplayers does exist as a command, in css:

PHP Code:
maxplayers
"maxplayers" is "32" 
in csgo:

PHP Code:
maxplayers
Maxplayers is deprecated
set it in gamemodes_server.txt.example or use -maxplayers_override instead
also, ive tried in csgo, even on a 12 slot server you can use CreateFakeClient to create 64 clients, altho no more than 12 players/bots can join the game

i would suggest adding a CSGO_GetSlotCount function to the cstrike extension, i will submit a patch tomorrow in the bugtracker
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 03-28-2013 at 20:35.
Zephyrus is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 03-28-2013 , 21:16   Re: get slot count
Reply With Quote #6

https://bugs.alliedmods.net/show_bug.cgi?id=5689

Tested and works.
__________________
Taking private C++/PHP/SourcePawn requests, PM me.

Last edited by Zephyrus; 03-28-2013 at 21:16.
Zephyrus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-28-2013 , 21:26   Re: get slot count
Reply With Quote #7

That is max human clients, not max clients. It's like in L4D where only a max of 8 people can join in versus, but there are still 18 valid slots to account for bot joins.

A native for it also already exists in SM.
psychonic is offline
Zephyrus
Cool Pig B)
Join Date: Jun 2010
Location: Hungary
Old 03-28-2013 , 21:29   Re: get slot count
Reply With Quote #8

Quote:
Originally Posted by psychonic View Post
That is max human clients, not max clients. It's like in L4D where only a max of 8 people can join in versus, but there are still 18 valid slots to account for bot joins.

A native for it also already exists in SM.
for what its worth the name of the topic is get slot count, which is the number of playable clients, anyway that 1.5.0 is really due now... recommended sm versions for diff games is really getting out of hands right now
__________________
Taking private C++/PHP/SourcePawn requests, PM me.
Zephyrus is offline
psychonic

BAFFLED
Join Date: May 2008
Old 03-28-2013 , 21:32   Re: get slot count
Reply With Quote #9

Quote:
Originally Posted by Zephyrus View Post
recommended sm versions for diff games is really getting out of hands right now
Getting 1.5.0 sooner would not solve that as those kind of constant changes are already what is keeping it delayed.
psychonic 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 04:21.


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