SA-MP Forums Archive
array index out of bounds - 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 index out of bounds (/showthread.php?tid=273735)



array index out of bounds - ZmaXy - 03.08.2011

Код:
SetPlayerPos(playerid, RandomSpawn[rand3][0], RandomSpawn[rand3][1],RandomSpawn[rand3][2],RandomSpawn[rand3][3],RandomSpawn[rand3][4],RandomSpawn[rand3][5],RandomSpawn[rand3][6]);
error: array index out of bounds


Re: array index out of bounds - Dr - 03.08.2011

You used the function in a way it is not suppose to be used:
pawn Код:
SetPlayerPos(playerid, x, y, z);
You can't add more things into it, its only suppose to be a X, a Y, and a Z... There are tutorials in which you use switch cases and so on to get the player to randomly spawn somewhere, just search for one.


Re: array index out of bounds - =WoR=Varth - 03.08.2011

@Dr Yes he can make it like that.

The wrong thing is you put too many argument. It's supposed to be 4 arguments. So basically like this:
pawn Код:
SetPlayerPos(playerid,RandomSpawn[rand3][0],RandomSpawn[rand3][1],RandomSpawn[rand3][2]);
if you still get the error please show us your "RandomSpawn" code.