SA-MP Forums Archive
Max Player question. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Max Player question. (/showthread.php?tid=477513)



Max Player question. - zerowhz - 24.11.2013

can anyone explain which difference is between
Code:
[MAX_PLAYERS]
and
Code:
[MAX_PLAYERS char]
. Does it matter if I use only
Code:
[MAX_PLAYERS char]
.


Re: Max Player question. - RenSoprano - 24.11.2013

Code:
[MAX_PLAYERS]
It's equal to 500 ( Maximum Players ) * 4 bytes per cell = 2000 bytes

Code:
[MAX_PLAYERS char]
It's equal to 500 ( Maximum Players ) * 1 bytes per cell = 500 bytes and it will take less memory


Re: Max Player question. - zerowhz - 24.11.2013

Thank you but, does it matter if I use only [MAX_PLAYERS char] ?


Re: Max Player question. - Konstantinos - 24.11.2013

The answer depends on the values you want to use.

Use char only when the values are between 0-255. Any value out of the bounds will be wrapped into bounds.

Also when you use char in the script, you'll need to use { } for the indexes instead of [ ].

See: https://sampforum.blast.hk/showthread.php?tid=216730
-> "Char-arrays"


Re: Max Player question. - zerowhz - 24.11.2013

Quote:
Originally Posted by Konstantinos
View Post
The answer depends on the values you want to use.

Use char only when the values are between 0-255. Any value out of the bounds will be wrapped into bounds.

Also when you use char in the script, you'll need to use { } for the indexes instead of [ ].

See: https://sampforum.blast.hk/showthread.php?tid=216730
-> "Char-arrays"
Thank you