Error, help me please ++REP
#1

Hey,

I have got this error:
Код:
C:\Documents and Settings\Jordy van camp\Bureaublad\Raven's Roleplay 0.3d R2 door fixed\gamemodes\larp.pwn(26431) : warning 219: local variable "idcar" shadows a variable at a preceding level
C:\Documents and Settings\Jordy van camp\Bureaublad\Raven's Roleplay 0.3d R2 door fixed\gamemodes\larp.pwn(77234 -- 77241) : error 032: array index out of bounds (variable "vehTrunk")
C:\Documents and Settings\Jordy van camp\Bureaublad\Raven's Roleplay 0.3d R2 door fixed\gamemodes\larp.pwn(77278) : error 032: array index out of bounds (variable "vehTrunk")
C:\Documents and Settings\Jordy van camp\Bureaublad\Raven's Roleplay 0.3d R2 door fixed\gamemodes\larp.pwn(77279) : error 032: array index out of bounds (variable "vehTrunkAmmo")
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Errors.
This is the code:

Код:
new idx = 184;
		while (idx < sizeof(CarInfo))
		{
		    fread(file, strFromFile2);
		    split(strFromFile2, arrCoords, ',');
		    vehTrunk[idx][1] = strval(arrCoords[0]);
		    vehTrunkAmmo[idx][1] = strval(arrCoords[1]);
		    vehTrunk[idx][2] = strval(arrCoords[2]);
		    vehTrunkAmmo[idx][2] = strval(arrCoords[3]);
		    vehTrunk[idx][3] = strval(arrCoords[4]);
		    vehTrunkAmmo[idx][3] = strval(arrCoords[5]);
		    vehTrunk[idx][4] = strval(arrCoords[6]);
		    vehTrunkAmmo[idx][4] = strval(arrCoords[7]);
		    vehTrunkCounter[idx] = strval(arrCoords[8]);
		    vehTrunkArmour[idx] = floatstr(arrCoords[9]);
		    idx++;
		}
Can someone help me please?
+REP

Regards,
Jordyvc
Reply
#2

vehTrunk[idx][0] = strval(arrCoords[0]);
vehTrunkAmmo[idx][0] = strval(arrCoords[1]);
vehTrunk[idx][1] = strval(arrCoords[2]);
vehTrunkAmmo[idx][1] = strval(arrCoords[3]);
vehTrunk[idx][2] = strval(arrCoords[4]);
vehTrunkAmmo[idx][2] = strval(arrCoords[5]);
vehTrunk[idx][3] = strval(arrCoords[6]);
vehTrunkAmmo[idx][3] = strval(arrCoords[7]);

Starts from 0 not 1...

Unless you're supposed to have 5 then the array is wrong.
new vehTrunk[][]; <- show the numbers.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)