[SOLVED] Need help with some strings..
#1

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

Try this:

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

error 018: initialization data exceeds declared size
Reply
#4

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

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

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

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

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

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

Thanks guys
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)