26.12.2011, 09:04
The reason it's tag mismatching is because the last two variables (for the cars colour) are untagged integers, and the array is defined as an array of elements with the float tag. To fix this, you'd have to assign an enum (because there are mixed tags within the array), and refer to the elements accordingly. Replace your code for creating the array with this:
To assign stuff to the newly defined array, you'd can use the enums variables.. it just looks neater I guess.
So this would mean your function for spawning elegies might look something like this:
pawn Код:
//Enumeration for spawn data for elegies.
enum ELEGY_SPAWN_DATA
{
/* Float tagged variables */
Float:X,
Float:Y,
Float:Z,
Float:ZRot,
/* Untagged variables */
_:Col1,
_:Col2,
}
//Create a new array, infinite amount of elements and with the ELEGY_SPAWN_DATA enum, to define what types we have in there.
new elegies[ ][ ELEGY_SPAWN_DATA ] =
{
{-1614.635131, 1007.885314, 6.847799, 250.569107, 17, 1 }
//...
};
pawn Код:
elegies[ i ][ Col1 ] = 1;
//.. is the same as ..
elegies[ i ][ 5 ] = 1;
pawn Код:
public Spawnelegies()
{
for(new i=0; i<20; i++)
{
elegy[i] = AddStaticVehicle(562,elegies[i][X],elegies[i][Y],elegies[i][Z],elegies[i][ZRot],elegies[i][Col1],elegies[i][Col2]);
SetVehicleVirtualWorld(elegy[i],0);
}
return 1;
}