Problem with an Array -
silvan - 07.01.2011
Hi, i'm trying to use an array and for some reason it gives me alot of warning ( tag mismatch warning ) and i belive that it won't work well with that type of warning. So here it is maybe you guys could help me out to fix it.
The Array is there to hold the:
Vehicle Model ID, X-Axis, Y-Axis, Z-Axis, Price ( 2 Integers and 3 Float Numbers. )
Code:
new Float:CarDetails[20][] = {
{555, 1774.9325, -1301.9487, 27.3634, 5000}, // Windsor
{518, 1799.7560, -1309.3458, 27.3395, 5000}, // Buccaneer
{405, 1823.3174, -1316.5240, 27.5490, 5000}, // Sentinel
{480, 1832.6963, -1308.8218, 27.4456, 5000}, // Comet
{587, 1832.4768, -1299.5599, 27.3908, 5000}, // Euros
{475, 1832.3497, -1291.2659, 27.4760, 5000}, // Sabre
{603, 1832.5886, -1281.8744, 27.5160, 5000}, // Phoenix
{542, 1826.5474, -1273.6226, 27.4154, 5000}, // Clover
{551, 1814.2037, -1285.7472, 27.4648, 5000}, // Merit
{404, 1806.6544, -1293.3103, 27.4056, 5000}, // Perennial
// Floor 3
{585, 1775.4705, -1302.4955, 32.7190, 5000}, // Emperor
{550, 1806.7802, -1292.7355, 32.9444, 5000}, // Sunrise
{517, 1814.0498, -1284.5409, 32.9813, 5000}, // Majestic
{546, 1825.2871, -1273.1779, 32.8514, 5000}, // Intruder
{516, 1831.7583, -1279.5569, 32.9605, 5000}, // Nebula
{445, 1832.6484, -1287.7122, 33.0036, 5000}, // Admiral
{492, 1832.8518, -1296.7134, 32.9103, 5000}, // Greenwood
{566, 1832.8337, -1307.9435, 32.9053, 5000}, // Tahoma
{589, 1821.0784, -1316.5474, 32.7849, 5000}, // Club
{491, 1798.1735, -1309.9948, 33.1128, 5000} // Virgo
};
And here is where i use it.
Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 5)
{
PlayerInfo[playerid][vmodel] = CarDetails[listitem][0];
}
}
Re: Problem with an Array -
veyron - 07.01.2011
u must use enum because all of them arent same type (there are ints and floats)
Re: Problem with an Array -
silvan - 07.01.2011
can you give me an example? i mean how to fix it
Re: Problem with an Array -
veyron - 07.01.2011
pawn Code:
enum VehicleData
{
VehModel,
Float:VehX,
Float:VehY,
Float:VehZ,
respawndelay,
}
new CarDetails[20][VehicleData] = {
{555, 1774.9325, -1301.9487, 27.3634, 5000}, // Windsor
{518, 1799.7560, -1309.3458, 27.3395, 5000}, // Buccaneer
{405, 1823.3174, -1316.5240, 27.5490, 5000}, // Sentinel
{480, 1832.6963, -1308.8218, 27.4456, 5000}, // Comet
{587, 1832.4768, -1299.5599, 27.3908, 5000}, // Euros
{475, 1832.3497, -1291.2659, 27.4760, 5000}, // Sabre
{603, 1832.5886, -1281.8744, 27.5160, 5000}, // Phoenix
{542, 1826.5474, -1273.6226, 27.4154, 5000}, // Clover
{551, 1814.2037, -1285.7472, 27.4648, 5000}, // Merit
{404, 1806.6544, -1293.3103, 27.4056, 5000}, // Perennial
// Floor 3
{585, 1775.4705, -1302.4955, 32.7190, 5000}, // Emperor
{550, 1806.7802, -1292.7355, 32.9444, 5000}, // Sunrise
{517, 1814.0498, -1284.5409, 32.9813, 5000}, // Majestic
{546, 1825.2871, -1273.1779, 32.8514, 5000}, // Intruder
{516, 1831.7583, -1279.5569, 32.9605, 5000}, // Nebula
{445, 1832.6484, -1287.7122, 33.0036, 5000}, // Admiral
{492, 1832.8518, -1296.7134, 32.9103, 5000}, // Greenwood
{566, 1832.8337, -1307.9435, 32.9053, 5000}, // Tahoma
{589, 1821.0784, -1316.5474, 32.7849, 5000}, // Club
{491, 1798.1735, -1309.9948, 33.1128, 5000} // Virgo
};
should work
Re: Problem with an Array -
silvan - 07.01.2011
and in order to get info from it? what should i use? and btw that enum thing works, tnx for it now i'm getting warnings on getting details from it
Re: Problem with an Array -
veyron - 07.01.2011
example
CarDetails[1][VehX]
Re: Problem with an Array -
silvan - 07.01.2011
ok thanks, this works thanks alot m8