Array index of bounds?
#2

If you have entered last checkpoint, this code is executed:
Код:
dmvcheckpointid[playerid] += 1;
Now variable is 35!

And there is a code:
Код:
if(id == 33)
		{
			SetPlayerRaceCheckpoint(playerid,1,DMVCheckPointsurile[34][0],DMVCheckPointsurile[34][1],DMVCheckPointsurile[34][2],
			0,0,0,8);
		}
		else
		{
			SetPlayerRaceCheckpoint(playerid,0,DMVCheckPointsurile[id][0],DMVCheckPointsurile[id][1],DMVCheckPointsurile[id][2],
			DMVCheckPointsurile[id + 1][0],DMVCheckPointsurile[id + 1][1],DMVCheckPointsurile[id + 1][2],8);
		}
Exactly here:
Код:
else // It mean 34, 35, 36, 37... ETC!
		{
			SetPlayerRaceCheckpoint(playerid,0,DMVCheckPointsurile[id][0],DMVCheckPointsurile[id][1],DMVCheckPointsurile[id][2],
			DMVCheckPointsurile[id + 1][0],DMVCheckPointsurile[id + 1][1],DMVCheckPointsurile[id + 1][2],8);
Just change to:
Код:
else if(id < 33)
		{
			SetPlayerRaceCheckpoint(playerid,0,DMVCheckPointsurile[id][0],DMVCheckPointsurile[id][1],DMVCheckPointsurile[id][2],
			DMVCheckPointsurile[id + 1][0],DMVCheckPointsurile[id + 1][1],DMVCheckPointsurile[id + 1][2],8);
		}
Reply


Messages In This Thread
Array index of bounds? - by Metharon - 29.07.2015, 17:06
Re: Array index of bounds? - by Midzi - 29.07.2015, 19:09
Re: Array index of bounds? - by Metharon - 29.07.2015, 19:31

Forum Jump:


Users browsing this thread: 1 Guest(s)