SA-MP Forums Archive
command to save 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: command to save a file? (/showthread.php?tid=85057)



command to save a file? - anumaz - 05.07.2009

Hey, I would like to know how to do a command 'eg : /saveaccount' and this command will save the .ini file of his name?

Exemple

John_Anumaz types : /saveaccount
It saves john_anumaz.ini's file


Re: command to save a file? - James_Alex - 05.07.2009

easy
pawn Код:
if(strcmp(cmdtext, "/saveaccount", true) == 0)
    {
      new plname[MAX_PLAYER_NAME];
      GetPlayerName(playerid, plname, sizeof(plname));
      new File:sFile;
      new str[256]; format(str, sizeof(str), "%s.ini", plname);
      sFile = fopen(str, io_append);
      fwrite(sFile, "what to write into the file");
      fclose(sFile);
      return 1;
    }
this should be useful for you



Re: command to save a file? - anumaz - 05.07.2009

Thanks, I'll try it out tomorrow


Re: command to save a file? - anumaz - 05.07.2009

No, I didn't said to write something in a file, I said to save it


Re: command to save a file? - Correlli - 05.07.2009

Quote:
Originally Posted by anumaz
No, I didn't said to write something in a file, I said to save it
You'll save the file, but you should write something to .ini or you're going to leave it blank?


Re: command to save a file? - anumaz - 05.07.2009

Quote:
Originally Posted by Don Correlli
Quote:
Originally Posted by anumaz
No, I didn't said to write something in a file, I said to save it
You'll save the file, but you should write something to .ini or you're going to leave it blank?
There's already something writen in the file