PDA

View Full Version : can i use new variable[MAX_PLAYERS char];


RaeF
29/04/2015, 10:31 AM
So, i'm new in using char tag, can i use char inside MAX_PLAYERS?

Example:
http://pastebin.com/yi2WccPT

LegendOfScripts
29/04/2015, 11:26 AM
Don't think so but that's just me, Try it and see.

Niko_boy
29/04/2015, 11:30 AM
afaik it only work with 1D array.

Read here: http://forum.sa-mp.com/showthread.php?t=216730
Note: " ....... When you know you don't need negative values and won't ever exceed 255 ......."

Evocator
29/04/2015, 01:20 PM
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. http://forum.sa-mp.com/showthread.php?t=481257

Konstantinos
29/04/2015, 06:55 PM
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:

g_lib_function_FPN_[playerid] = !'\0';

to:

g_lib_function_FPN_[playerid]{0} = '\0';


afaik it only work with 1D array.

No, it does work with 2D and 3D arrays.

Jefff
29/04/2015, 09:50 PM
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

RaeF
29/04/2015, 11:01 PM
Ok, thanks for help i understand now!