[help] three-dimensional array new Float:RaceCP[2][24][3] = {
#1

Hi, I get an error with this three-dimensional array.
this is technically how it should look like:

new Float:RaceCP[2][24][3] = { { {x,y,z}, {x,y,z}, {x,y,z} }, { {x,y,z}, {x,y,z}, {x,y,z} } }
[2] = 2 races
[24] = max 24 checkpoints
[3] = x,y and z

and this is my array:

Код:
new Float:RaceCP[2][24][3] = {

//BigEar
{
{ -302.418060, 1509.563232, 75.086380 },
{ -305.212005, 1395.265380, 72.043296 },
{ -368.893463, 1463.893188, 62.627506 },
{ -322.453704, 1319.337768, 52.956405 },
{ -424.867858, 1446.353881, 34.138626 },
{ -445.970733, 1621.541015, 35.298206 },
{ -376.569519, 1796.692626, 47.946186 },
{ -405.940673, 1917.435791, 57.645378 },
{ -436.403564, 1761.826660, 71.763092 },
{ -383.595611, 2075.464599, 60.620937 },
{ -707.730712, 2059.905273, 60.007637 },
{ -882.994201, 1968.176025, 59.900981 },
{ -877.661865, 1799.904296, 59.910789 },
{ -1040.491699, 1850.409545, 57.395057 },
{ -1160.210693, 1798.866821, 39.773452 },
{ -1240.804443, 1921.095458, 42.559307 },
{ -1270.470703, 2017.952026, 68.315513 },
{ -1058.034057, 2146.948974, 87.011741 },
{ -1098.744750, 2354.112548, 85.420761 },
{ -1127.080688, 2355.531738, 85.491989 },
{ -1166.284790, 2252.598876, 98.856803 },
{ -1280.873413, 2215.315429, 99.234161 },
{ -1349.952514, 2371.112060, 95.528503 },
{ -1294.761352, 2487.607177, 86.805511 }
},

//UnderWater
{
{ -2759.9348,-986.4890,-10.3255 },
{ -2445.2173,-891.7880,-8.6307 },
{ -2097.2217,-1192.6278,-7.3052 },
{ -1806.1852,-1515.5853,-9.0581 },
{ -1509.1764,-1674.3108,-8.4282 },
{ -1302.2627,-1920.5179,-5.1851 },
{ -1164.7755,-2060.2434,-6.2207 },
{ -1246.8453,-2402.9241,-7.2430 }
}
};
the error:

Код:
\gamemodes\SU.pwn(676) : error 052: multi-dimensional arrays must be fully initialized
Reply
#2

Its like doin

new array[][] =
{
{ 1, 2, 3, 4 },
{ 1, 2 }
};

impossible, all data in a dimension must have same size
Reply
#3

so I'll add empty places at the 2nd race
Reply
#4

U should create 1 array for 1 race, or use a 2d array and som index to know where a race is in that array.
Reply
#5

Quote:
Originally Posted by paytas
U should create 1 array for 1 race, or use a 2d array and som index to know where a race is in that array.
then I need to create this:

if(currentrace == 1)
{
SetRaceCP(Race1CP[...][...])
}
else if(currentrace == 2)
{
SetRaceCP(Race2CP[...][...])
}
else if(currentrace == 3)
{
SetRaceCP(Race3CP[...][...])
}

now I can simply do:
SetRaceCP(RaceCP[currentrace][...][...])
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)