PDA

View Full Version : Run time error 4: "Array index out of bounds"


AnoTek
19/04/2017, 12:53 PM
I add some cars and when i open my server it shows some errors in the console
http://imgur.com/NleWq0L

These are the cars:

LVCopcar[1] = AddStaticVehicleEx(427,2299.1641,2431.5496,3.4053, 358.7615,0,152,900); // car1
LVCopcar[2] = AddStaticVehicleEx(427,2294.4866,2431.6890,3.3666, 0.2314,0,152,900); // car2
LVCopcar[3] = AddStaticVehicleEx(428,2278.9985,2444.4702,3.4698, 270.3594,4,75,900); // car3
LVCopcar[4] = AddStaticVehicleEx(598,2287.2385,2444.5559,3.1411, 270.7334,0,152,900); // car4
LVCopcar[5] = AddStaticVehicleEx(598,2271.0911,2444.5242,3.1388, 270.4846,0,152,900); // car5
LVCopcar[6] = AddStaticVehicleEx(599,2250.9202,2431.1172,3.3960, 0.1199,0,152,900); // car6
LVCopcar[7] = AddStaticVehicleEx(599,2255.2395,2431.0569,3.4630, 359.4257,0,152,900); // car7
LVCopcar[8] = AddStaticVehicleEx(599,2259.4314,2430.9846,3.4628, 359.3576,0,152,900); // car8
LVCopcar[9] = AddStaticVehicleEx(601,2240.7043,2431.1597,3.0321, 323.8604,1,1,900); // car9
LVCopcar[10] = AddStaticVehicleEx(523,2290.2332,2431.2856,2.8420, 0.4089,0,0,900); // car10
LVCopcar[11] = AddStaticVehicleEx(523,2285.8242,2431.3442,2.8138, 0.4845,0,0,900); // car11
LVCopcar[12] = AddStaticVehicleEx(523,2257.7844,2463.4009,3.0708, 129.7768,0,0,900); // car12
LVCopcar[13] = AddStaticVehicleEx(523,2257.9563,2460.3589,3.1037, 127.1879,0,0,900); // car13
LVCopcar[14] = AddStaticVehicleEx(523,2258.0198,2457.2139,3.1018, 123.8488,0,0,900); // car14
LVCopcar[15] = AddStaticVehicleEx(523,2258.1677,2453.8035,3.1006, 121.8633,0,0,900); // car15
LVCopcar[16] = AddStaticVehicleEx(523,2258.1711,2450.4875,3.1010, 120.4141,0,0,900); // car16


LVCopcar[17] = AddStaticVehicleEx(411,2277.1301,2430.8760,2.9762, 359.0606,116,1,900); // car17
object17 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object17, LVCopcar[17], 0.00794, -0.07739, 0.67816, 0.00000, 0.00000, 0.00000);
new policecar7 = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
SetObjectMaterialText(policecar7, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
AttachObjectToVehicle(policecar7, LVCopcar[17], 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);


LVCopcar[18] = AddStaticVehicleEx(411,2272.7944,2430.8979,3.0005, 358.9573,112,1,900); // car18
object18 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object18, LVCopcar[18], 0.00794, -0.07739, 0.67816, 0.00000, 0.00000, 0.00000);
new policecar8 = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
SetObjectMaterialText(policecar8, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
AttachObjectToVehicle(policecar8, LVCopcar[18], 0.0, -1.9, 0.3, 270.0, 0.0, 0.0);


LVCopcar[19] = AddStaticVehicleEx(560,2268.4341,2430.8291,2.9787, 0.2199,17,1,900); // car19
object19 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object19, LVCopcar[19], 0.00927, -0.24643, 0.79763, 0.00000, 0.00000, 0.00000);
new policecar9 = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
SetObjectMaterialText(policecar9, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
AttachObjectToVehicle(policecar9, LVCopcar[19], 0.00360, -1.99280, 0.38977, -87.00000, 0.00000, 0.00000);


LVCopcar[20] = AddStaticVehicleEx(560,2263.9250,2430.8145,2.9788, 0.7875,21,1,900); // car20
object20 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object20, LVCopcar[20], 0.00927, -0.24643, 0.79763, 0.00000, 0.00000, 0.00000);
new policecar10 = CreateObject(19327, 1534.2373, -1643.2886, 5.9373, -87.6999, 90.4001, -87.1805);
SetObjectMaterialText(policecar10, "POLICE", 0, 50, "Arial", 25, 1, -16777216, 0, 1);
AttachObjectToVehicle(policecar10, LVCopcar[20], 0.00360, -1.99280, 0.38977, -87.00000, 0.00000, 0.00000);

LVCopcar[21] = AddStaticVehicleEx(598,2240.1653,2442.2346,3.0192, 270.0172,0,152,900); // car21
LVCopcar[22] = AddStaticVehicleEx(598,2240.1274,2447.1553,2.9778, 270.4796,0,152,900); // car22
LVCopcar[23] = AddStaticVehicleEx(598,2240.1479,2451.9509,3.0198, 270.0879,0,152,900); // car23
LVCopcar[24] = AddStaticVehicleEx(598,2240.1621,2456.7961,3.0191, 270.6472,0,152,900); // car24
LVCopcar[25] = AddStaticVehicleEx(598,2240.1367,2461.5149,3.0190, 270.5502,0,152,900); // car25
LVCopcar[26] = AddStaticVehicleEx(598,2240.1462,2466.3032,3.0194, 270.1276,0,152,900); // car26
LVCopcar[27] = AddStaticVehicleEx(598,2240.1416,2471.2417,3.0191, 270.6508,0,152,900); // car27
LVCopcar[28] = AddStaticVehicleEx(598,2240.1309,2476.0190,3.0194, 270.9770,0,152,900); // car28
LVCopcar[29] = AddStaticVehicleEx(497,2316.5059,2472.6099,38.7879 ,180.0316,0,152,900); // car29(elicopter
LVCopcar[30] = AddStaticVehicleEx(497,2331.7788,2472.6140,38.7878 ,180.2125,0,152,900); // car30(elicopter


LVCopcar[31] = AddStaticVehicleEx(541,2282.2451,2459.7969,10.4453 ,359.7111,152,152,900); // car31
object21 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object21, SFCopcar[31], 0.02446, -0.42279, 0.58337, 0.00000, 0.00000, 0.00000);


LVCopcar[32] = AddStaticVehicleEx(541,2277.7859,2459.8379,10.4161 ,179.9178,152,152,900); // car32
object22 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object22, SFCopcar[32], 0.02446, -0.42279, 0.58337, 0.00000, 0.00000, 0.00000);


LVCopcar[33] = AddStaticVehicleEx(451,2282.2407,2477.4333,10.5028 ,179.7896,152,152,900); // car33
object23 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object23, LVCopcar[33], 0.01008, -0.57168, 0.58337, 0.00000, 0.00000, 0.00000);

LVCopcar[34] = AddStaticVehicleEx(451,2277.9248,2477.3423,10.5263 ,180.0136,152,152,900); // car34
object24 = CreateObject(19420,0.0000, 0.0000, 0.0000, 0.0000, 0.0000, 0.0000);
AttachObjectToVehicle(object24, LVCopcar[34], 0.01008, -0.57168, 0.58337, 0.00000, 0.00000, 0.00000);


LVCopcar[35] = AddStaticVehicleEx(522,2269.2944,2443.2302,10.3914 ,1.7478,1,1,900); // car34
LVCopcar[36] = AddStaticVehicleEx(522,2273.5586,2443.1980,10.3949 ,358.8544,1,1,900); // car35
LVCopcar[37] = AddStaticVehicleEx(522,2277.8091,2443.1746,10.3952 ,0.1074,1,1,900); // car36
LVCopcar[38] = AddStaticVehicleEx(427,2282.0874,2443.1001,10.9134 ,359.4068,0,152,900); // car37
LVCopcar[39] = AddStaticVehicleEx(598,2273.3625,2459.7893,10.5246 ,0.0000,0,152,900); // car38
LVCopcar[40] = AddStaticVehicleEx(598,2269.3735,2459.1182,10.5662 ,180.1296,0,152,900); // car39
LVCopcar[41] = AddStaticVehicleEx(598,2273.5283,2477.3745,10.5676 ,179.6889,0,152,900); // car40
LVCopcar[42] = AddStaticVehicleEx(598,2269.0483,2477.4292,10.5666 ,179.2235,0,152,900); // car41
LVCopcar[43] = AddStaticVehicleEx(523,2294.7761,2462.1672,10.3607 ,126.6612,0,152,900); // car42
LVCopcar[44] = AddStaticVehicleEx(523,2294.9771,2457.4321,10.3920 ,50.7505,0,152,900); // car43

Were is the problem?

StrikerZ
19/04/2017, 01:22 PM
Show the line where you defined LVCopcar

Antenastyle
19/04/2017, 01:29 PM
Probably LVCopcar isn't indexed or is bad indexed, we need the line where you defined LVCopcar

AnoTek
19/04/2017, 01:36 PM
Show the line where you defined LVCopcar

LVCopcar[45];

Antenastyle
19/04/2017, 01:44 PM
LVCopcar[0] doesn't exists, I think there is the problem

Marricio
19/04/2017, 01:51 PM
You're looking in the wrong place, the problem isn't there. LVCopcar is fine, the runtime error is being caused by an array with a size of 200.

From what I saw, there are few indicators:
- Array[200] or MAX_something with 200
- It might be related to a "zone" code
- If you can't address it you need to use crashdetect and compile with -d3.