SA-MP Forums Archive
Array Color[4][2] don't work. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Array Color[4][2] don't work. (/showthread.php?tid=122978)



Array Color[4][2] don't work. - silvan - 24.01.2010

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.


Re: Array Color[4][2] don't work. - ¤Adas¤ - 24.01.2010

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


Re: Array Color[4][2] don't work. - [HiC]TheKiller - 24.01.2010

They are strings, not arrays. Use what Adas said.


Re: Array Color[4][2] don't work. - dice7 - 24.01.2010

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


Re: Array Color[4][2] don't work. - [LDT]LuxurY - 24.01.2010

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"
};



Re: Array Color[4][2] don't work. - silvan - 24.01.2010

i'll try that then. thanks for helping


Re: Array Color[4][2] don't work. - silvan - 24.01.2010

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