arrey out of bounds
#1

Hello, i have some errors, And i don't know how to fix it:
Код:
(10732) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10732) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10733) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10733) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10734) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10734) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10735) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10735) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10736) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10736) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
(10737) : error 032: array index out of bounds (variable "TrainJobCheckpoints")
This are the lines with the errors:

Код:
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[1][1], TrainJobCheckpoints[1][2], TrainJobCheckpoints[1][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[2][1], TrainJobCheckpoints[2][2], TrainJobCheckpoints[2][3], 8);}
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[2][1], TrainJobCheckpoints[2][2], TrainJobCheckpoints[2][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[3][1], TrainJobCheckpoints[3][2], TrainJobCheckpoints[3][3], 8);}
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[3][1], TrainJobCheckpoints[3][2], TrainJobCheckpoints[3][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[4][1], TrainJobCheckpoints[4][2], TrainJobCheckpoints[4][3], 8);}
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[4][1], TrainJobCheckpoints[4][2], TrainJobCheckpoints[4][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[5][1], TrainJobCheckpoints[5][2], TrainJobCheckpoints[5][3], 8);}
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[5][1], TrainJobCheckpoints[5][2], TrainJobCheckpoints[5][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[6][1], TrainJobCheckpoints[6][2], TrainJobCheckpoints[6][3], 8);}
		if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[6][1], TrainJobCheckpoints[6][2], TrainJobCheckpoints[6][3])){DestroyVehicle(TrainJob[playerid]); AddCashToPaycheck(playerid, JOB_TRAIN_MONEY);}
And this is the TrainJobCheckpoints:

Код:
new Float:TrainJobCheckpoints[6][3] = {
{2864.5220, 1293.3594, 10.5262},
{1717.5511, -1953.9233, 13.2477},
{816.1088, -1367.2324, -1.9657},
{-1943.1951, 159.7611, 25.4679},
{578.2359, 1271.0232, 11.5856},
{1444.2245, 2632.4370, 10.5277}
};
Does anyone know it?
Please help me

Greetingz
Gforce
Reply
#2

pawn Код:
new Float:TrainJobCheckpoints[7][4] =
Reply
#3

Array start with 0, not 1.
So change:
pawn Код:
if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[1][1], TrainJobCheckpoints[1][2], TrainJobCheckpoints[1][3])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[2][1], TrainJobCheckpoints[2][2], TrainJobCheckpoints[2][3], 8);}
to

pawn Код:
if (IsPlayerInRangeOfPoint(playerid, 1.0, TrainJobCheckpoints[0][0], TrainJobCheckpoints[0][1], TrainJobCheckpoints[0][2])){SetPlayerCheckpoint(playerid, TrainJobCheckpoints[1][0], TrainJobCheckpoints[1][1], TrainJobCheckpoints[1][2], 8);}
Etc.
Reply
#4

Ofcourse, Thanks for your help!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)