save car problem +REP - 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)
+--- Thread: save car problem +REP (
/showthread.php?tid=349337)
save car problem +REP -
peterory - 08.06.2012
i want when i shutdown the server
then the server will get all cars pos and write it into cars.cfg
can some one learn me ?
Re: save car problem +REP -
Jefff - 08.06.2012
pawn Код:
stock SaveAllCars()
{
new
File:F,
str[128],
Float:P[4],
Model;
F = fopen("cars.cfg", io_write);
for(new d = 1; d < MAX_VEHICLES; d++)
{
if((Model = GetVehicleModel(d)))
{
GetVehiclePos(d,P[0],P[1],P[2]);
GetVehicleZAngle(d,P[3]);
format(str,128,"%d,%.4f,%.4f,%.4f,%.4f\r\n",Model,P[0],P[1],P[2],P[3]);
fwrite(F,str);
}
}
fclose(F);
return print("All Vehicles saved !");
}
In OnGameModeExit
Re: save car problem +REP -
peterory - 09.06.2012
Quote:
Originally Posted by Jefff
pawn Код:
stock SaveAllCars() { new File:F, str[128], Float:P[4], Model;
F = fopen("cars.cfg", io_write); for(new d = 1; d < MAX_VEHICLES; d++) { if((Model = GetVehicleModel(d))) { GetVehiclePos(d,P[0],P[1],P[2]); GetVehicleZAngle(d,P[3]); format(str,128,"%d,%.4f,%.4f,%.4f,%.4f\r\n",Model,P[0],P[1],P[2],P[3]); fwrite(F,str); } } fclose(F); return print("All Vehicles saved !"); }
In OnGameModeExit
|
very thanks ! it work ! the REP i your
but i have another question
if when the car have DestroyVehicle
it will be write in to the cars.cfg?
Re: save car problem +REP -
JaKe Elite - 09.06.2012
No it will not write in cars.cfg you have to made It yourself
Re: save car problem +REP -
peterory - 09.06.2012
Quote:
Originally Posted by Romel
No it will not write in cars.cfg you have to made It yourself
|
thanks