Vehicle Data - 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: Vehicle Data (
/showthread.php?tid=245210)
Vehicle Data -
BlueKenny - 30.03.2011
SaveVehId = 1;
SaveVehModel = GetVehicleModel(SaveVehId);
GetVehicleHealth(SaveVehId, SaveVehHealth);
SaveVehFuel = 25;
GetVehiclePos(SaveVehId, SaveVehPosX, SaveVehPosY, SaveVehPosZ);
new string3[32];
format(string3, sizeof(string3), "/Cars/%d.ini", 1);
new File: hFile = fopen(string3, io_write);
if (hFile)
{
new var[128];
format(var, 128, "Model=%d\n", SaveVehModel);fwrite(hFile, var);
format(var, 128, "Health=%d\n", SaveVehHealth);fwrite(hFile, var);
format(var, 128, "Fuel=%d\n", SaveVehFuel);fwrite(hFile, var);
format(var, 128, "X=%d\n", SaveVehPosX);fwrite(hFile, var);
format(var, 128, "Z=%d\n", SaveVehPosZ);fwrite(hFile, var);
format(var, 128, "Y=%d\n", SaveVehPosY);fwrite(hFile, var);
fclose(hFile);
}
Why does it not save this data?
It writes:
Model=481
Health=1148846080
Fuel=1103626240
X=-987528428
Z=1087588625
Y=1152310575
Re: Vehicle Data -
Vince - 30.03.2011
Use
%f as placeholder for floats (health and position).
AW: Vehicle Data -
BlueKenny - 30.03.2011
Yes, I also found out that.