MAX_STRING+1 (why somebody use +1)
#8

If you for example see a code like this:
pawn Код:
new gPlayerRank[ MAX_PLAYERS + 1 ];
That is useless if you have defined MAX_PLAYERS the correct way, because it starts counting from 0 so that + 1 is not needed.

It is useful in some cases, for example:
pawn Код:
#define NUMBER_OF_TEAMS 2

CMD:removemyteam( playerid, params[ ] ) {
    SetPlayerTeam( playerid, NUMBER_OF_TEAMS + playerid + 1 );
    return 1;
}
You can use the NO_TEAM(or something like that) define instead, but I was just giving an example.
Reply


Messages In This Thread
MAX_STRING+1 (why somebody use +1) - by BuLLeT[LTU] - 28.07.2011, 16:15
Re: MAX_STRING+1 (why somebody use +1) - by JaTochNietDan - 28.07.2011, 16:16
Re: MAX_STRING+1 (why somebody use +1) - by BuLLeT[LTU] - 28.07.2011, 16:35
Re: MAX_STRING+1 (why somebody use +1) - by JaTochNietDan - 28.07.2011, 16:39
Re: MAX_STRING+1 (why somebody use +1) - by steki. - 28.07.2011, 16:46
Re: MAX_STRING+1 (why somebody use +1) - by Gamer_Z - 28.07.2011, 16:48
Re: MAX_STRING+1 (why somebody use +1) - by BuLLeT[LTU] - 28.07.2011, 16:57
Re: MAX_STRING+1 (why somebody use +1) - by Mean - 28.07.2011, 17:37

Forum Jump:


Users browsing this thread: 5 Guest(s)