vehicle saving coordinates - 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: vehicle saving coordinates (
/showthread.php?tid=382852)
vehicle saving coordinates -
Why - 05.10.2012
Hello, I am creating a vehicle saving system, however I can't find a good way to save vehicle pos.
The way I currently use is
Vehicle1PosX =
Vehicle1PosY =
Vehicle1PosZ =
Vehicle2PosX =
Vehicle2PosY =
Vehicle2PosZ =
Vehicle3PosX =
Vehicle3PosY =
Vehicle3PosZ =
Vehicle4PosX =
Vehicle4PosY =
Vehicle4PosZ =
Vehicle5PosX =
Vehicle5PosY =
Vehicle5PosZ =
etc, but id like it to be on one line so it'd be like
Vehicle1Pos = 2305.32 -1543.63 13.37
Vehicle2Pos = 1241.42 -1211.42 16.44
etc..
Any tips on how I can do that?
I am using Y_INI by the way.
Re: vehicle saving coordinates -
Roel - 05.10.2012
you can do it like this:
pawn Code:
new vehiclepos[3][64];
format(vehiclepos[0],64,"%fx%fx%fx",posx,posy,posz);
format(vehiclepos[1],64,"%fx%fx%fx",posx,posy,posz);
format(vehiclepos[2],64,"%fx%fx%fx",posx,posy,posz);
then you save those three strings.
Then at load,
you just use split with the character 'x' , and you use floatstr(); with the 3 results from the split for each vehicle.+
Re: vehicle saving coordinates -
Why - 05.10.2012
How do I split it? I'd like to use it in
INI_WriteString
and
INI_String