Array index out of bounds
#4

Quote:
Originally Posted by itsCody
Посмотреть сообщение
Is there away to even fix that, it just outputs "unknown command". Or is there another way to get a players zone and output it. As of now I'm clueless.
It is normal to get the "unknown command" message, after all, that's what you get when you are trying to use an index that is out of bounds on a command.

The fix is pretty obvious, use a value that is inferior to the size of "zones".

For example, you are doing this:
pawn Код:
enum eZones
{
    Float:zones_max_x,
    Float:zones_max_y,
    Float:zones_max_z,
    Float:zones_min_x,
    Float:zones_min_y,
    Float:zones_min_z
};

static const aZones[][eZones] =
{
    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0},
    {0.0, 0.0, 0.0, 0.0, 0.0, 0.0}
};
pawn Код:
aZones[8][zones_max_x]
The array "aZones" can only use the values between 0 and 4, and you are trying to use the value of "zones_max_x" on the 8th row, which isn't possible.
Reply


Messages In This Thread
Array index out of bounds - by itsCody - 13.12.2015, 04:07
Re: Array index out of bounds - by SickAttack - 13.12.2015, 04:21
Re: Array index out of bounds - by itsCody - 13.12.2015, 04:25
Re: Array index out of bounds - by SickAttack - 13.12.2015, 05:10
Re: Array index out of bounds - by itsCody - 13.12.2015, 05:21

Forum Jump:


Users browsing this thread: 1 Guest(s)