SA-MP Forums Archive
error 032: array index out of bounds (variable "Positions") - 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)
+--- Thread: error 032: array index out of bounds (variable "Positions") (/showthread.php?tid=477104)



error 032: array index out of bounds (variable "Positions") - Drago987 - 22.11.2013

Can anyone help me with these errors please ?
Код:
E:\Server\gamemodes\VGRP.pwn(35975) : error 032: array index out of bounds (variable "Positions")
E:\Server\gamemodes\VGRP.pwn(36095) : error 032: array index out of bounds (variable "Positions")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


2 Errors.
Positions Define
pawn Код:
new Float:Positions[16][3];
Line "35975"
pawn Код:
GetDynamicObjectPos(LSFDGate, Positions[16][0], Positions[16][1], Positions[16][2]);
Line "36095"
pawn Код:
else if(GetDistance( Positions[0][0], Positions[0][1], Positions[0][2], Positions[16][0], Positions[16][1], Positions[16][2]) < 17.0 ) {
+REP


Re: error 032: array index out of bounds (variable "Positions") - newbie scripter - 22.11.2013

Use enum
pawn Код:
enum Float:Postions [] []
{
 // ur Locs in {x, y, z), // remove the ',' in the last one
};

new Pos [] [Postions]; // change Pos to the one u want
and Delete ur New and change all things with new to Pos [] []


Re: error 032: array index out of bounds (variable "Positions") - Konstantinos - 22.11.2013

You declare Positions as 16. That means 0-15 indexes (in total 16).

So the last index (valid index) you can use is 15, not 16.


Re: error 032: array index out of bounds (variable "Positions") - Drago987 - 22.11.2013

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
You declare Positions as 16. That means 0-15 indexes (in total 16).

So the last index (valid index) you can use is 15, not 16.
Thanks man its working now