SA-MP Forums Archive
Problem with multiple random - 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: Problem with multiple random (/showthread.php?tid=170332)



Problem with multiple random - Jochemd - 22.08.2010

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


Re: Problem with multiple random - DeadAhead - 22.08.2010

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


Re: Problem with multiple random - WackoX - 22.08.2010

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


Re: Problem with multiple random - Jochemd - 22.08.2010

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


Re: Problem with multiple random - Jochemd - 22.08.2010

How can I use an enum in this?


Re: Problem with multiple random - iggy1 - 22.08.2010

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.


Re: Problem with multiple random - Jochemd - 22.08.2010

I did. Without any results :/


Re: Problem with multiple random - Jochemd - 22.08.2010

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


Re: Problem with multiple random - Mauzen - 22.08.2010

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]


Re: Problem with multiple random - Jochemd - 24.08.2010

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