SA-MP Forums Archive
What does 'char' in an array? - 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: What does 'char' in an array? (/showthread.php?tid=404329)



What does 'char' in an array? - [DOG]irinel1996 - 02.01.2013

Hello,
I saw many scripts using that when arrays are declared.
pawn Код:
new array[MAX_PLAYERS char];
What does it do, how does it work?

Thank you.


Re: What does 'char' in an array? - Konstantinos - 02.01.2013

char. I do use it to lower the array size.


AW: What does 'char' in an array? - IPrototypeI - 02.01.2013

Yes, char lower your memory. But you have to know that you can only save values from
0 until 255.

and if you want you can also use it like


PHP код:
array{playerid} = 1
but there is no different of using

PHP код:
array[playerid



Re: What does 'char' in an array? - Vince - 02.01.2013

There IS a big difference actually, since every cell now saves the data of four players instead of one. Using the square braces will overwrite anything that's saved there, from those four players.