can i use new variable[MAX_PLAYERS char]; - 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: can i use new variable[MAX_PLAYERS char]; (
/showthread.php?tid=572523)
can i use new variable[MAX_PLAYERS char]; -
RaeF - 29.04.2015
So, i'm new in using char tag, can i use char inside MAX_PLAYERS?
Example:
http://pastebin.com/yi2WccPT
Re: can i use new variable[MAX_PLAYERS char]; -
LegendOfScripts - 29.04.2015
Don't think so but that's just me, Try it and see.
Re: can i use new variable[MAX_PLAYERS char]; -
Niko_boy - 29.04.2015
afaik it only work with 1D array.
Read here:
https://sampforum.blast.hk/showthread.php?tid=216730
Note: " ....... When you know you don't need negative values and won't ever exceed 255 ......."
Re: can i use new variable[MAX_PLAYERS char]; -
Evocator - 29.04.2015
Yes you can char arrays as long as its value doesnt exceed 255 or go negative. Moreover you can pack strings, which is alot more efficient, here an include for a safe formatting and using, i suggest using.
https://sampforum.blast.hk/showthread.php?tid=481257
Re: can i use new variable[MAX_PLAYERS char]; -
Konstantinos - 29.04.2015
I had tried in the past as I was curious myself and it did not work using {} on the playerid index. I did a test just a minute ago and it seems to be working good with [].
But.. change:
pawn Код:
g_lib_function_FPN_[playerid] = !'\0';
to:
pawn Код:
g_lib_function_FPN_[playerid]{0} = '\0';
Quote:
Originally Posted by Niko_boy
afaik it only work with 1D array.
|
No, it does work with 2D and 3D arrays.
Re: can i use new variable[MAX_PLAYERS char]; -
Jefff - 29.04.2015
You can use 2D BUT, if MAX_PLAYERS is for example 200 - max index is 50 (MAX_PLAYERS/4) in [ ] so if you got more than 50 players online - fail
Re: can i use new variable[MAX_PLAYERS char]; -
RaeF - 29.04.2015
Ok, thanks for help i understand now!