[00:49:30] No: 0 Mod:411 2716.795898 -1483.210571 30.131399 251.607299 -1 -1 [00:49:30] No: 1 Mod:455 2716.795898 -1483.210571 30.131399 251.607299 -1 -1 [00:49:30] No: 2 Mod:404 1629.891723 -1743.112060 13.287796 141.126098 -1 -1 [00:49:30] Number of vehicle models: 3 [00:49:50] Incoming connection: 127.0.0.1:61153 [00:49:50] [join] oshino_shinobu has joined the server (0:127.0.0.1) [00:49:51] [00:49:51] [00:50:12] No: 1 Mod:455 2716.795898 -1483.210571 30.131399 251.607299 -1 -1 [00:50:15] [part] S_v has left the server (0:1)
forward SaveCarCoords();
public SaveCarCoords()
{
new idx;
idx = GetPlayerVehicleID;
new File: file2;
while (idx <= 2)
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d\n\r",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo]);
if(idx == 0)
{
file2 = fopen("cars.cfg", io_write);
}
else
{
file2 = fopen("cars.cfg", io_append);
}
fwrite(file2, coordsstring);
printf(" 编号: %d 模型:%d %f %f %f %f %d %d ",idx,CarInfo[idx][cModel],CarInfo[idx][cLocationx],CarInfo[idx][cLocationy],CarInfo[idx][cLocationz],CarInfo[idx][cAngle],CarInfo[idx][cColorOne],CarInfo[idx][cColorTwo]);
idx++;
fclose(file2);
}
return 1;
}
idx = GetPlayerVehicleID;
public SaveCarCoords()
{
for (new i = 1; i<MAX_VEHICLES; i++)//set a variable equal to 1 (first vehicle id) and loop it through max vehicles
{
if(GetVehicleModel(i)!=0) //GetVehicleModel returns 0 if the vehicle doesn't exist
{
//save the car to the file
}
}
return 1;
}
|
You will need to loop through all of the vehicles (using a for() loop):
pawn Код:
|