Fastest and best INI files Registration system
#5

The best method is to just use the raw functions, making sure to save all variables at once.
example:
pawn Код:
stock save(playerid)
{
  new pname[24];
  GetPlayerName(playerid,pname,24);
  new File:file=fopen(pname,io_write);
  new string[128];
  format(string,128,"Score=%d\nCash=%d",GetPlayerScore(playerid,GetPlayerMoney(playerid));
  fwrite(file,string);
}
and NOT like this
pawn Код:
stock save(playerid)
{
  new pname[24];
  GetPlayerName(playerid,pname,24);
  new File:file=fopen(pname,io_write);
  new string[128];
  format(string,128,"Score=%d\n",GetPlayerScore(playerid));
  fwrite(file,string);
  format(string,128,"Cash=%d",GetPlayerMoney(playerid));
  fwrite(file,string);
}
Because the second method uses 'format' and 'fwrite' per variable, it has to run far more functions (assuming you have more than 2 variables to save)
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)