Guest User

Sef problem

a guest
Aug 2nd, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 0.92 KB | None | 0 0
  1. forward LoadSef();
  2. public LoadSef()
  3. {
  4.     new arrCoords[2][64];
  5.     new strFromFile2[256];
  6.     new File: file = fopen("cfg/sefovi.cfg", io_read);
  7.     if (file)
  8.     {
  9.         new idx;
  10.         while (idx < sizeof(SefInfo))
  11.         {
  12.             fread(file, strFromFile2);
  13.             split(strFromFile2, arrCoords, '|');
  14.             SefInfo[idx][sDroga] = strval(arrCoords[0]);
  15.             SefInfo[idx][sMoney] = strval(arrCoords[1]);
  16.             printf("SefInfo:%d Droga:%d Money:%d.\n",
  17.             idx,
  18.             SefInfo[idx][sDroga],
  19.             SefInfo[idx][sMoney]);
  20.             idx++;
  21.         }
  22.         fclose(file);
  23.     }
  24.     return 1;
  25. }
  26.  
  27. ////////////////////////////////////////////////////////
  28. forward SaveSef();
  29. public SaveSef()
  30. {
  31.     new idx;
  32.     while (idx < sizeof(SefInfo))
  33.     {
  34.     new coordsstring[256];
  35.     format(coordsstring, sizeof(coordsstring), "%d %d", SefInfo[idx][sDroga], SefInfo[idx][sMoney] );
  36.     new File: file2 = fopen("cfg/sefovi.cfg", io_write);
  37.     fwrite(file2, coordsstring);
  38.     fclose(file2);
  39.     }
  40.     return 1;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment