Saving file. - 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: Saving file. (
/showthread.php?tid=96598)
Saving file. -
Justsmile - 09.09.2009
Hi guys,
I need your help.
I want to save all cars, when the player exits the car (OnPlayerExitVehicle) to a file, so that at OnGameModeInit, after a restart, they spaawn the last exit Pos. Pls help me.
Re: Saving file. -
Correlli - 09.09.2009
Use dini, if you don't know how to do it then ask in the script request topic.
Re: Saving file. -
Justsmile - 09.09.2009
I tried it with .cfg, but the Server gets crashed.
Re: Saving file. -
Correlli - 09.09.2009
Dini is a lot easier.
Re: Saving file. -
Justsmile - 09.09.2009
Ok, where can i find a tutorial, or a thread?
Re: Saving file. -
Correlli - 09.09.2009
http://forum.sa-mp.com/index.php?topic=71935.0
Re: Saving file. -
Justsmile - 09.09.2009
pawn Код:
new Float:X, Float:Y, Float:Z;
GetVehiclePos(vehicleid, X, Y, Z);
dini_FloatSet("/scriptfiles/car.ini", "F_X", X);
dini_FloatSet("/scriptfiles/car.ini", "F_Y", Y);
dini_FloatSet("/scriptfiles/car.ini", "F_Z", Z);
So,ok, and for every car an extra file, or what?
Re: Saving file. -
Correlli - 09.09.2009
This is just an example:
pawn Код:
new Float:x_pos, Float:y_pos, Float:z_pos, string[128];
for(new v = 0; v < _YOUR_MAX_VEHICLES_DEFINE_; v++)
{
format(string, sizeof(string), "car%d.ini", v);
if(!dini_Exists(string))
{
GetVehiclePos(v, x_pos, y_pos, z_pos);
dini_Create(string);
dini_FloatSet(string, "vehX", x_pos);
dini_FloatSet(string, "vehY", y_pos);
dini_FloatSet(string, "vehZ", z_pos);
}
else
{
GetVehiclePos(v, x_pos, y_pos, z_pos);
dini_FloatSet(string, "vehX", x_pos);
dini_FloatSet(string, "vehY", y_pos);
dini_FloatSet(string, "vehZ", z_pos);
}
}
Re: Saving file. -
Justsmile - 09.09.2009
Ok, thanks, and how can i set this float to OnGameModeinit to spawn?
Re: Saving file. -
Correlli - 09.09.2009
Get the float value with the dini_Float function and give it to the vehicle you want to create. Again, check the link i gave you.