Array index out of bounds
#1

I am having an error ґArray index out of boundsґ. I know what it means, but somehow I can't manage to fix it as I don't see the problem.

I'm using an enum and stuff to load the data.

Here is the code:

pawn Код:
enum HDATA
{
HouseOwner[255],
Float:hx1,
Float:hy1,
Float:hz1,
Float:hx2,
Float:hy2,
Float:hz2
}

#define MAX_HOUSES 200
new HouseData[MAX_HOUSES][HDATA];
Whenever I use HouseData, it'll give the error "Array index out of bounds":

pawn Код:
House1 = CreatePickup(1273, 23, HouseData[i][hx1], HouseData[i][hy1], HouseData[hz1]);
I don't see the problem.
Reply
#2

House1 = CreatePickup isn't needed.
Just add a 'new HousePickup[MAX_HOUSES] = (-1);'
Then:

HousePickup[i] = CreatePickup(....)

If you're gonna use mapicons, use Incognito's streamer plugin. You can only have 100 mapicons
Reply
#3

Quote:
Originally Posted by Kwarde
Посмотреть сообщение
House1 = CreatePickup isn't needed.
Just add a 'new HousePickup[MAX_HOUSES] = (-1);'
Then:

HousePickup[i] = CreatePickup(....)

If you're gonna use mapicons, use Incognito's streamer plugin. You can only have 100 mapicons
There are only two House1 and House2, I did this so I could remove and replace these two later. It's just a test phase.

Anyway, this won't solve the error.. :/
Reply
#4

pawn Код:
House1 = CreatePickup(1273, 23, HouseData[i][hx1], HouseData[i][hy1], HouseData[i][hz1]);
Reply
#5

Oh, my goodness.. I didn't add the [i].. Thanks.

Actually, that's pretty stupid of me.
Reply
#6

And stupid of me that I didn't saw it xD
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)