SA-MP Forums Archive
[SOLVED] Need help with some strings.. - 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: [SOLVED] Need help with some strings.. (/showthread.php?tid=90781)



[SOLVED] Need help with some strings.. - SiJ - 10.08.2009

Hey,
I want to do this:

pawn Код:
new GangNames[] = {
    {"Gang Name 1"},
    {"Gang Name 2"}
};
But it shows me an error
error 008: must be a constant expression; assumed zero


Re: Need help with some strings.. - Ben147 - 10.08.2009

Try this:

new GangNames[2][1] = {
{"Gang Name 1"},
{"Gang Name 2"}
};


Re: Need help with some strings.. - SiJ - 10.08.2009

error 018: initialization data exceeds declared size


Re: Need help with some strings.. - WrathOfGenesis - 10.08.2009

pawn Код:
new GangNames [ 2 ] [ 11 ] =
{
  "Gang Name 1",
  "Gang Name 2"
};



Re: Need help with some strings.. - Kodman262 - 10.08.2009

Change the [1] to a [2] because of two gangs, like so.

pawn Код:
new GangNames[2][2] = {
{"Gang Name 1"},
{"Gang Name 2"}
};



Re: Need help with some strings.. - SiJ - 10.08.2009

Quote:
Originally Posted by Kodman262
Change the [1] to a [2] because of two gangs, like so.

pawn Код:
new GangNames[2][2] = {
{"Gang Name 1"},
{"Gang Name 2"}
};
Same error...


Quote:
Originally Posted by WrathOfGenesis
pawn Код:
new GangNames [ 2 ] [ 11 ] =
{
  "Gang Name 1",
  "Gang Name 2"
};
Thanks, it works..
I did it like this
pawn Код:
new GangNames [ 2 ] [ 20 ] =
{
  "Gang Name 1",//This gang name is 15 chars length
  "Gang Name 2"//This gang name is 18chars length
};
But could you explain me what those numbers [2] and [20] means?



Re: Need help with some strings.. - Dark_Kostas - 10.08.2009

20 is the maximum letters number and 2 the amount of your gangs. So if you put 3gangs you should make it [3] [20]


Re: Need help with some strings.. - WrathOfGenesis - 10.08.2009

Or if one of the gang names is more than 20 charicters, then change the number 20


Re: Need help with some strings.. - SiJ - 10.08.2009

Thanks guys