SA-MP Forums Archive
Saving JUST coordinates to a 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 JUST coordinates to a file (/showthread.php?tid=77630)



Saving JUST coordinates to a file - Enzo_Ferrari_V12 - 13.05.2009

Anyone know how to make a cmd like /getpos

and make it save just the X, Y, and Z coordinates to a file?

say I want the file to be called savedcoordinates.txt

how do I make it to where it won't overwrite what's already on there? I know /save exists but I need a /getpos for other reasons.


Re: Saving JUST coordinates to a file - Backwardsman97 - 13.05.2009

pawn Code:
if(!strcmp(cmdtext,"/save2",true))
{
    new Float:x,Float:y,Float:z,Stringy[128];
    GetPlayerPos(playerid,x,y,z);
    new File:Saves = fopen("savedcoordinates.txt", io_append);
    format(Stringy,128,"%f , %f , %f,\r\n",x,y,z);
    fwrite(Saves,Stringy);
    fclose(Saves);
}