Vas bien, pero hay algunos notas. No es necesario hacer un loop para asignar una variable como el ID de un vehнculo y cuando vayas a retornar un valor en un loop, parra el loop primero con "break;", y luego retorna el valor.
pawn Код:
new vhTruckCount;
public OnGameModeInit()
{
CreateTruck(414, 1052.8551, 1917.7247, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1060.3757, 1917.9557, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1067.8254, 1917.8627, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1076.5006, 1917.8225, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1082.6708, 1917.7721, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1091.2550, 1917.8107, 10.8981, 0.0000, -1, -1, 100);
CreateTruck(414, 1106.0496, 1920.0028, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1106.0044, 1925.8887, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1106.0172, 1934.7740, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1106.0516, 1911.2572, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1106.1534, 1903.8564, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1106.1299, 1896.6113, 10.8981, 90.0000, -1, -1, 100);
CreateTruck(414, 1091.7219, 1889.2329, 10.8981, 180.0000, -1, -1, 100);
CreateTruck(414, 1082.8315, 1889.2240, 10.8981, 180.0000, -1, -1, 100);
CreateTruck(414, 1076.6324, 1889.3217, 10.8981, 180.0000, -1, -1, 100);
return 1;
}
stock CreateTruck(model, Float:x, Float:y, Float:z, Float:angle, color1, color2, respawn_delay, addsiren = 0)
{
InformacionCam[vhTruckCount][CAM_ID] = CreateVehicle(model, x, y, z, angle, color1, color2, respawn_delay, addsiren);
vhTruckCount ++;
}
stock GetTruckID(vehicleid)
{
new truckid = -1;
for(new i = 0; i < MAX_CAMIONES; i ++)
{
if(InformacionCam[i][CAM_ID] == vehicleid)
{
truckid = i;
break;
}
}
return truckid;
}