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

get_maxplayers()


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Yusochan
Member
Join Date: Sep 2021
Location: Algeria
Old 11-25-2021 , 17:03   get_maxplayers()
Reply With Quote #1

Hello !

I wanna understand something.. what does mean this fonction and what do we do with ?
Please make a little code to understand it

Best regards !
__________________
<b>IP : <font color=Red>93.115.53.168:27017</font></b>
<b>Founder : <font color=Cyan>YusoChan-</font></b>
Yusochan is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-25-2021 , 19:41   Re: get_maxplayers()
Reply With Quote #2

It returns the maximum numbers of players that your server currently supports, between 1 and 32. In HLDS, this is set on the main screen in the 'Max. players' field.

I personally rarely, if ever, use it.
  • For sizing arrays to store player data, always use MAX_PLAYERS + 1
  • When looping through players on the server, use the count value returned by-ref in get_players()/get_players_ex()

Bookmark this, it gives you info on all of the natives:
http://www.amxmodx.org/api/amxmodx/get_maxplayers
__________________

Last edited by Bugsy; 11-25-2021 at 19:41.
Bugsy is offline
thEsp
BANNED
Join Date: Aug 2017
Old 11-26-2021 , 11:24   Re: get_maxplayers()
Reply With Quote #3

Quote:
I wanna understand something.. what does mean this fonction and what do we do with ?
You hack The Pentagon with it.
thEsp is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 11-26-2021 , 11:36   Re: get_maxplayers()
Reply With Quote #4

Quote:
Originally Posted by thEsp View Post
You hack The Pentagon with it.
Your post set off alarms at the CIA.
__________________
Bugsy is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-26-2021 , 11:46   Re: get_maxplayers()
Reply With Quote #5

Sadly you can never create arrays using get_maxplayers because that function return a non constant value so it won't be trusted by the compiler
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 11-26-2021 , 14:02   Re: get_maxplayers()
Reply With Quote #6

Quote:
Originally Posted by Natsheh View Post
Sadly you can never create arrays using get_maxplayers because that function return a non constant value so it won't be trusted by the compiler
It'a not about trust. The compiler needs to know the size of the array at compile time, but the function return value is only known at run time.
__________________
HamletEagle is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-26-2021 , 15:50   Re: get_maxplayers()
Reply With Quote #7

Quote:
Originally Posted by HamletEagle View Post
It'a not about trust. The compiler needs to know the size of the array at compile time, but the function return value is only known at run time.
Yeah that's what i had in mind.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
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 07:59.


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