Array Color[4][2] don't work.
#1

I'm trying to make an fs which consists of an array.

This array holds in it several colors and comments of the color.... such as
0xffffff00 <- Color
White <- Comment

Here is the array:
Код:
new Color[Max_Number_Of_Colors][2] =
{
  {"0xffffff00","White"},
  {"0xdddddd00","Grey1"},
  {"0xcccccc00","Grey2"},
  {"0xbbbbbb00","Grey3"}
};
and on the use i'm using this to check which color might be suitable for the factions and stuff.... then i should be able to output the comment to know which color code it is....

And its giving me this error:
Код:
C:\Documents and Settings\Legend\Desktop\Color_Checker.pwn(16) : error 018: initialization data exceeds declared size
Line 16 is the array itself.
Reply
#2

try: new Color[MAX_SOMETHING][20][2] or new Color[MAX_SOMETHING][2][20] I don't know now.. try it
Reply
#3

They are strings, not arrays. Use what Adas said.
Reply
#4

And 0xffffff00 doesn't need to be a string. If you're planing to use it in functions, then store it as an integer
Reply
#5

anyway it will be better to create 2 arrays to avoid extra memory using. colour's hex isn't a string.

pawn Код:
#define max 4

new color[max] =
{
  0xffffff00,
  0xdddddd00,
  0xcccccc00,
  0xbbbbbb00
};

new colornames[max][10] =
{
  "White",
  "Grey1",
  "Grey2",
  "Grey3"
};
Reply
#6

i'll try that then. thanks for helping
Reply
#7

the array is fixed now its giving me a problem the function to change player color
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)