Array out of bounds - wth?
#1

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?
Reply
#2

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
Reply
#3

Thanks, it's working now. :]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)