Raised This Month: $51 Target: $400
 12% 

MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xkp
Member
Join Date: Jan 2015
Location: AlliedLand
Old 04-03-2015 , 15:34   MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.
Reply With Quote #1

Can i use MaxClients in functions like this ?
Code:
stock get_realplayersnum() {     new players[MAX_PLAYERS], playerCnt;     get_players(players, playerCnt, "ch");     return playerCnt; }
-->
Code:
stock get_realplayersnum() {     new playerCnt;     get_players(MaxClients, playerCnt, "ch");     return playerCnt; }

~~ And another question about MAX_NAME_LENGTH
Code:
#define MAX_NAME_LENGTH 32 * The maximum buffer size required to store a clients name.
Can i use it for something like this
Code:
#define STRLEN_NAME 32 new g_szModNames[MODS_MAX][STRLEN_NAME]
-->
Code:
new g_szModNames[MODS_MAX][MAX_NAME_LENGTH]
__________________

Last edited by xkp; 04-03-2015 at 15:44.
xkp is offline
Send a message via Skype™ to xkp
Decak
Senior Member
Join Date: Sep 2012
Old 04-03-2015 , 18:00   Re: MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.
Reply With Quote #2

2.) Yes, you can, because the difference is only in name - the result is same.

Last edited by Decak; 04-04-2015 at 07:44.
Decak is offline
~Ice*shOt
Veteran Member
Join Date: Mar 2009
Location: Lithuania
Old 04-03-2015 , 18:04   Re: MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.
Reply With Quote #3

1. what MaxClients stands for?

Last edited by ~Ice*shOt; 04-03-2015 at 18:04.
~Ice*shOt is offline
Send a message via Skype™ to ~Ice*shOt
Decak
Senior Member
Join Date: Sep 2012
Old 04-03-2015 , 18:15   Re: MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.
Reply With Quote #4

Number of server slots.
Decak is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-03-2015 , 19:46   Re: MaxClients and get_players(func) | MAX_NAME_LENGTH and 32 definitions.
Reply With Quote #5

Quote:
Originally Posted by xkp View Post
Can i use MaxClients in functions like this ?
Code:
stock get_realplayersnum() {     new players[MAX_PLAYERS], playerCnt;     get_players(players, playerCnt, "ch");     return playerCnt; }
-->
Code:
stock get_realplayersnum() {     new playerCnt;     get_players(MaxClients, playerCnt, "ch");     return playerCnt; }
Absolutely not. The get_players() function requires an array for its first argument. MaxClients (I'm assuming this is from the dev version of AMX Mod X) is just a number.

Quote:
Originally Posted by xkp View Post
~~ And another question about MAX_NAME_LENGTH
Code:
#define MAX_NAME_LENGTH 32 * The maximum buffer size required to store a clients name.
Can i use it for something like this
Code:
#define STRLEN_NAME 32 new g_szModNames[MODS_MAX][STRLEN_NAME]
-->
Code:
new g_szModNames[MODS_MAX][MAX_NAME_LENGTH]
I would not do that. That value is clearly very specific to a "player" name and exists because there is a limitation in length of a player's name (in the actual game code). It does not dictate how long your "mod" name in your code can be.
__________________

Last edited by fysiks; 04-03-2015 at 19:49.
fysiks 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 11:46.


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