[Tutorial] GetMaxPlayers() > MAX_PLAYERS ?
#5

Looping with GetMaxPlayers is slower than MAX_PLAYERS. Also, you can't declare arrays with dynamic sizes.

https://sampforum.blast.hk/showthread.php?tid=65567

Edit:
There is one way you can use GetMaxPlayers, however.

pawn Код:
for ( new i = 0, l = GetMaxPlayers( ); i < l; i++ )
{
    if ( IsPlayerConnected( i ) )
    {
        // ...
    }
}
Or you could make a new global variable called g_MaxPlayers and set it to GetMaxPlayers( ) in OnGameModeInit then use that for looping.
However, I would sugget simply re-defining MAX_PLAYERS:
pawn Код:
#undef MAX_PLAYERS
#define MAX_PLAYERS (20)
Reply


Messages In This Thread
GetMaxPlayers() > MAX_PLAYERS ? - by Desert - 30.09.2010, 07:34
Re: GetMaxPlayers() > MAX_PLAYERS ? - by willsuckformoney - 30.09.2010, 07:36
Re: GetMaxPlayers() > MAX_PLAYERS ? - by [HiC]TheKiller - 30.09.2010, 07:40
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Desert - 30.09.2010, 07:44
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Slice - 30.09.2010, 08:22
Re: GetMaxPlayers() > MAX_PLAYERS ? - by [XST]O_x - 30.09.2010, 09:23
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Slice - 30.09.2010, 09:25
Re: GetMaxPlayers() > MAX_PLAYERS ? - by [XST]O_x - 30.09.2010, 09:29
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Slice - 30.09.2010, 09:30
Re: GetMaxPlayers() > MAX_PLAYERS ? - by LarzI - 30.09.2010, 09:46
Re: GetMaxPlayers() > MAX_PLAYERS ? - by legodude - 30.09.2010, 10:01
Re: GetMaxPlayers() > MAX_PLAYERS ? - by [XST]O_x - 30.09.2010, 10:10
Re: GetMaxPlayers() > MAX_PLAYERS ? - by wups - 30.09.2010, 14:34
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Claude - 30.09.2010, 15:06
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Calgon - 30.09.2010, 15:09
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Kyosaur - 30.09.2010, 15:23
Re: GetMaxPlayers() > MAX_PLAYERS ? - by ipsBruno - 01.10.2010, 17:01
Re: GetMaxPlayers() > MAX_PLAYERS ? - by The_Moddler - 01.10.2010, 17:15
Re: GetMaxPlayers() > MAX_PLAYERS ? - by LarzI - 01.10.2010, 17:44
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Claude - 01.10.2010, 18:21
Re: GetMaxPlayers() > MAX_PLAYERS ? - by LarzI - 01.10.2010, 19:31
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Calgon - 01.10.2010, 20:15
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Claude - 02.10.2010, 13:38
Re: GetMaxPlayers() > MAX_PLAYERS ? - by The_Moddler - 03.10.2010, 09:06
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Calgon - 03.10.2010, 09:26
Re: GetMaxPlayers() > MAX_PLAYERS ? - by LarzI - 03.10.2010, 10:41
Re: GetMaxPlayers() > MAX_PLAYERS ? - by ZecKo - 03.10.2010, 11:22
Re: GetMaxPlayers() > MAX_PLAYERS ? - by Mike_Peterson - 03.10.2010, 12:12
Re: GetMaxPlayers() > MAX_PLAYERS ? - by ZecKo - 03.10.2010, 12:28
Re: GetMaxPlayers() > MAX_PLAYERS ? - by MrDeath537 - 06.01.2011, 22:51
Re: GetMaxPlayers() > MAX_PLAYERS ? - by aco_SRBIJA - 22.03.2012, 10:12

Forum Jump:


Users browsing this thread: 1 Guest(s)