SA-MP Forums Archive
Array out of bounds - wth? - 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: Array out of bounds - wth? (/showthread.php?tid=256346)



Array out of bounds - wth? - Seven_of_Nine - 20.05.2011

My code:
pawn Код:
new Float:pos1[3],Float:pos2[3];
                GetPlayerPos(Duel1,pos1[1],pos1[2],pos1[3]);
                GetPlayerPos(Duel2,pos2[1],pos2[2],pos2[3]);
My errors:
pawn Код:
C:\Users\hummhumm :D\troll1.pwn(1323) : error 032: array index out of bounds (variable "pos1")
C:\Users\hummhumm :D\troll1.pwn(1324) : error 032: array index out of bounds (variable "pos2")
Can you help me with multidimensional arrays' creation?


Re: Array out of bounds - wth? - LetsOWN[PL] - 20.05.2011

Hm, thypical mistake.

Instead
pawn Код:
new Float:pos1[3],Float:pos2[3];
                GetPlayerPos(Duel1,pos1[1],pos1[2],pos1[3]);
                GetPlayerPos(Duel2,pos2[1],pos2[2],pos2[3]);
place
pawn Код:
new Float:pos1[3],Float:pos2[3];
                GetPlayerPos(Duel1,pos1[0],pos1[1],pos1[2]);
                GetPlayerPos(Duel2,pos2[0],pos2[1],pos2[2]);
NOW it will not return any error

~As always, LetsOWN


Re: Array out of bounds - wth? - Seven_of_Nine - 20.05.2011

Thanks, it's working now. :]