Raised This Month: $ Target: $400
 0% 

Update few plugins to use MAX_PLAYERS(1.8.3)


Post New Thread Reply   
 
Thread Tools Display Modes
Fr33m@n
Veteran Member
Join Date: May 2008
Location: France Marne
Old 02-01-2015 , 08:35   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #11

Quote:
Originally Posted by hleV View Post
It should be 32. Now it can't be used like this:
PHP Code:
new players[MAX_PLAYERS], num;
get_players(playersnum); 
Personally I've always used MAX_PLAYERS + 1 for player ID arrays.

Anyway, regarding the topic, the easiest way to remove the warning would be to undefine MAX_PLAYERS before it is defined in the plugin source file.
It was never supposed to be used like this for this kind of array, it have been removed in amxmodx dev because it's a bad usage.

33 is fine imo.

Maybe we should do a poll...

Last edited by Fr33m@n; 02-01-2015 at 08:38.
Fr33m@n is offline
OvidiuS
Chillaxin'
Join Date: Dec 2009
Location: Serbia
Old 02-01-2015 , 12:05   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #12

Quote:
Originally Posted by Fr33m@n View Post
It was never supposed to be used like this for this kind of array, it have been removed in amxmodx dev because it's a bad usage.

33 is fine imo.

Maybe we should do a poll...
I agree, we should have a poll
OvidiuS is offline
Send a message via Skype™ to OvidiuS
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2015 , 12:16   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #13

Don't think a poll is necessary. It has been always a define of 32, sometimes 33 for convenience. If we officially define the max players, it should be the technical limit as '32' can be used for others places than defining a player's array. It has been always this way, I'm not sure disturbing this habit is a smart move. Adding +1 is not necessary an issue, and it gives an explicit meaning.

Having 33 is not wrong too, that's said, but for AMXX/HL1 context probably more appropriate to keep 32.

I guess i will change that again.
__________________

Last edited by Arkshine; 02-01-2015 at 12:17.
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-01-2015 , 13:33   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #14

I don't think MAXPLAYERS sole use is for sizing an array, it can be used for other things and having it incorrectly set to 33 is wrong. Plugins have been scripted for years now with it at 32, why change it now to 33? My opinion is to keep it at 32, if people have a problem with using '+ 1' in their arrays then maybe create a separate constant for array sizing purposes?

Something like this would be ok:
PHP Code:
const MAXPLAYERS 32
const MAXPLAYERS_ARRAY MAXPLAYERS 
__________________
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2015 , 13:37   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #15

https://github.com/alliedmodders/amxmodx/pull/192

I hope people won't change mind after that.
__________________
Arkshine is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 02-01-2015 , 13:41   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #16

Defininig MAX_PLAYERS as 33 is 100% wrong! This is not subjective. MAX_PLAYERS should be defined based on fact which is 32. If people have a problem with adding 1 to get an over-sized array that makes it more convenient for their plugin then that is not AMX Mod X's problem. They can either learn to do it or start subtracting 1 from every player ID. We all know which one is better.
__________________

Last edited by fysiks; 02-01-2015 at 13:46.
fysiks is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2015 , 15:06   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #17

Don't be that mad, you are going to make me cry. 33 was not necessary wrong, but in the context was not the best to do.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 02-01-2015 , 15:12   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #18

I'm with fysiks on this, it's 100% wrong at 33. It's only correct when used to size an array, for every other purpose the value is wrong. The constant was created to hold the max number of players that the server can handle (hence the name MAXPLAYERS), it was not created for the sole purpose of sizing an array containing player ids.
__________________
Bugsy is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 02-01-2015 , 15:33   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #19

Please kill Nextra then, I have proof:

Quote:
[19:51:41] Nextra ツ: and sourcemod defines maxplayers as 66
[19:51:42] Nextra ツ: 65*
[19:52:10] Arkshine: And?
[19:52:18] Nextra ツ: it would have to be 33 for us then
[19:52:19] Nextra ツ: not 32
[19:52:51] Arkshine: Sounds weird to do that
[19:53:50] Nextra ツ: yo mom is weird
[19:54:08] Nextra ツ: you can just do new arr[MAXPLAYERS]
[19:54:13] Nextra ツ: instead of MAXPLAYERS + 1


But he confused, SM actually still does +1 ; I guess 64 -> 65 has been changed to consider 0 (sourceTV), at least something like that.
__________________

Last edited by Arkshine; 02-02-2015 at 03:40.
Arkshine is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 02-01-2015 , 19:46   Re: Update few plugins to use MAX_PLAYERS(1.8.3)
Reply With Quote #20

I may be wrong, but I believe there's an extra slot for SourceTV.
__________________
hleV 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:51.


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