loading vehicles from loop - 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)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: loading vehicles from loop (
/showthread.php?tid=188645)
loading vehicles from loop -
Ribber - 08.11.2010
I like to load vehicles with a loop, ingame it works, but i got too much warnings..
over main (didn't post all vehicles, too much xD):
pawn Код:
new Float:VehiclePositions[2][7] =
{
{520,-181.9419,2666.8167,64.2911,89.6785,0,0}, // hydra ::: LINE 881
{425,-308.6411,2681.2947,63.8339,270.5902,43,0}, // hunter ::: LINE 882
};
ongamemodeinit:
pawn Код:
for(new id; id < sizeof(VehiclePositions); id++)
{
AddStaticVehicle(VehiclePositions[id][0],VehiclePositions[id][1],VehiclePositions[id][2],VehiclePositions[id][3],VehiclePositions[id][4],VehiclePositions[id][5],VehiclePositions[id][6]);
}
warnings:
(881) : warning 213: tag mismatch
(881) : warning 213: tag mismatch
(881) : warning 213: tag mismatch
(882) : warning 213: tag mismatch
(882) : warning 213: tag mismatch
(882) : warning 213: tag mismatch
Re: loading vehicles from loop -
RyDeR` - 08.11.2010
Because you are using integers in a Float variable. (the colors of the vehicle)
See this way, it should work:
pawn Код:
enum vehicleInfo
{
vModel,
Float: vPosX,
Float: vPosY,
Float: vPosZ,
Float: vAngle,
vColor1,
vColor2
}
new Float: VehiclePositions[][vehicleInfo] =
{
{520,-181.9419,2666.8167,64.2911,89.6785,0,0}, // hydra ::: LINE 881
{425,-308.6411,2681.2947,63.8339,270.5902,43,0} // hunter ::: LINE 882
};
pawn Код:
for(new i; i < sizeof(VehiclePositions); i++)
{
AddStaticVehicle(VehiclePositions[i][vModel], VehiclePositions[i][vPosX], VehiclePositions[i][vPosY], VehiclePositions[i][vPosZ], VehiclePositions[i][vAngle], VehiclePositions[i][vColor1], VehiclePositions[i][vColor2]);
}
AW: loading vehicles from loop -
Ribber - 08.11.2010
teşekkьrler kardeşim (thanks my brother)