can i use new variable[MAX_PLAYERS char];
#1

So, i'm new in using char tag, can i use char inside MAX_PLAYERS?

Example:
http://pastebin.com/yi2WccPT
Reply
#2

Don't think so but that's just me, Try it and see.
Reply
#3

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 ......."
Reply
#4

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
Reply
#5

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.
Reply
#6

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
Reply
#7

Ok, thanks for help i understand now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)