Problem with multiple random
#1

Hello,

My pawno compiler gives this error: error 018: initialization data exceeds declared size

And this is the code

pawn Код:
new Float:RandomFish[][2] =
{
    {"* You caught a 2 kilogramm Carper.", 2 },
    {"* You caught a 3 kilogramm Carper.", 3 },
    {"* You caught a 4 kilogramm Carper.", 4 },
    {"* You caught a 5 kilogramm Carper.", 5 },
    {"* You caught a 2 kilogramm Driftfish.", 2 },
    {"* You caught a 3 kilogramm Driftfish.", 3 },
    {"* You caught a 4 kilogramm Driftfish.", 4 },
    {"* You caught a 5 kilogramm Driftfish.", 5 },
    {"* You caught a 6 kilogramm Driftfish.", 6 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
    {"* You didn't catch a fish, sorry.", 0 },
};
Does anyone know what is wrong with it?

Regards, Jochem
Reply
#2

Question one: Float? how can it be a float O_O
Question two: There is no question two. Just remove the Float:
Reply
#3

You need to use enum, because you use an int an varchar at same time.
Reply
#4

It doesnґt work. Well, it does partly. All the Tag Mismatch errors are fixed but the Error 18 is still there.
Reply
#5

How can I use an enum in this?
Reply
#6

Have you tryed deleting '2' in new Float:RandomFish[][2] to make it new Float:RandomFish[][]. I think the compiler will calculate the size of it.
Reply
#7

I did. Without any results :/
Reply
#8

Don't wanna advertise, but now it is bugging in a way I can't explain. PM me if you want the server IP.
Reply
#9

Do it like this:

pawn Код:
enum FishEnum {
    Message[40],
    Value
}

new RandomFish[][FishEnum] = {
    //All the data...
}
An enum allows to use different datatypes in one array. To get the data, you need to use the fieldnames in the enum:

RandomFish[...][Message] to get the message and
RandomFish[...][Value]
Reply
#10

I don't really understand that. There need to be more messages and values, how can I do it then?
Reply


Forum Jump:


Users browsing this thread: