SA-MP Forums Archive
3D Array Question - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: 3D Array Question (/showthread.php?tid=513689)



3D Array Question - jeffleung2 - 17.05.2014

new const Float:checkpoint13[][][] = {
{{1364.8833,-933.6073,33.9164},
{1465.0887,-867.3798,55.0282},
{1516.8230,-800.1524,73.1352},
{1455.9711,-718.4130,91.5759},
{1307.8579,-708.4246,92.5416},
{1123.4037,-767.7938,108.9386},
{998.6163,-787.9131,100.2280},
{945.6994,-765.3364,108.0152},
{822.1436,-792.1811,70.9138},
{630.1104,-903.6326,62.6993},
{515.4560,-937.5678,77.3647},
{358.4541,-1018.5303,93.1454},
{254.0392,-1136.0115,75.0336},
{155.3783,-1210.8406,46.9039},
{142.9434,-1372.4728,49.6549},
{94.4881,-1519.3193,5.6096},
{39.2769,-1522.6760,4.9319},
{-109.8263,-1483.6631,2.4242},
{-129.5442,-1307.7927,2.4626},
{-89.7246,-1399.5834,11.9397},
{-252.1446,-1588.5498,15.5826},
{-311.4229,-1672.6821,16.2252},
{-419.0160,-1687.1803,13.5916},
{-538.9479,-1612.7992,10.3067},
{-665.4949,-1618.5121,25.6246},
{-717.4487,-1694.9985,48.5130},
{-714.8230,-1395.6200,60.5876},
{-755.4938,-1284.2719,71.4651},
{-758.5912,-1543.3604,92.8019},
{-810.3814,-1788.0168,91.7410},
{-891.3491,-1892.0520,85.0320},
{-1075.5022,-1904.7405,76.6145},
{-1200.4746,-1807.9320,53.2719},
{-1404.8641,-1642.3928,44.8105},
{-1544.5839,-1583.1759,37.4576},
{-1674.1675,-1499.4039,34.9593},
{-1915.6636,-1371.2762,39.9090},
{-2109.0002,-1095.9388,29.8778},
{-2220.8271,-944.6955,39.9927},
{-2194.5237,-779.8154,61.3595},
{-2247.7971,-750.2704,70.4858},
{-2325.6736,-788.4303,92.0648},
{-2357.9119,-744.8742,99.2880},
{-2357.6306,-662.2579,120.0673},
{-2406.6096,-627.1713,132.0006},
{-2459.7009,-619.9286,132.2891},
{-2500.1294,-614.6198,132.2896}},
//
{{1540.881835,73.724075,28.190008},
{1483.780273,-205.924087,11.560971},
{1305.627441,-184.968063,22.867033},
{1207.349243,-98.954788,39.945163},
{1008.642822,-76.790992,22.344846},
{828.743713,-109.802986,25.226121},
{712.899780,-182.620773,20.697778},
{520.415161,-216.917465,15.922632},
{362.830871,-330.298217,13.623749},
{203.523361,-349.953430,3.702650},
{-134.876739,-388.184570,1.437509},
{-310.946502,-137.319747,1.429119},
{-335.801147,167.241821,6.832223},
{-592.780517,234.564376,19.808509},
{-738.178039,34.770622,32.959987},
{-807.000671,-31.400785,45.823768},
{-836.364074,-127.104118,62.465015},
{-564.679931,-189.339019,78.761077},
{-445.079711,-184.562698,76.205131},
{-396.363891,22.711507,35.666877},
{-296.559600,188.515975,6.573985},
{-184.446456,199.643753,11.852598},
{-36.402111,142.250366,3.469428},
{134.100570,-211.226409,1.785144},
{330.193115,-208.820114,1.280084},
{524.032043,-140.221649,38.212017},
{537.569458,-18.529214,28.197378},
{690.714965,-23.354015,26.504442},
{767.039672,-53.865055,39.522087},
{896.734558,-43.715003,63.672298},
{1028.042358,-37.026363,88.366241},
{1143.008422,21.851469,55.485588},
{1231.257812,71.694175,22.878068},
{1246.480346,-137.388519,39.407920},
{1412.230590,-213.592010,7.046447},
{1553.869140,-124.273406,18.746904},
{1557.727416,21.854566,24.498531}}
};
error 052: multi-dimensional arrays must be fully initialized
how to deal with it?


Re: 3D Array Question - Vince - 17.05.2014

Each set of checkpoints must have the same number of checkpoints (if that makes sense). The first set has 47 checkpoints while the second set only has 37. You could pad the second set with zeros until you reach 47, but it'd probably be better to put the sets in separate variables.


Re: 3D Array Question - jeffleung2 - 18.05.2014

Quote:
Originally Posted by Vince
Посмотреть сообщение
Each set of checkpoints must have the same number of checkpoints (if that makes sense). The first set has 47 checkpoints while the second set only has 37. You could pad the second set with zeros until you reach 47, but it'd probably be better to put the sets in separate variables.
for convenience, i really want to use 3D array.
can i solve it with using ...?

like that
if a set of checkpoint cannot reach 47 checkpoints
{0.0, 0.0, 0.0}, ...
error 029: invalid expression, assumed zero
it seems work, but how to solve this error?