Advertisement
Guest User

Untitled

a guest
Oct 2nd, 2010
710
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.23 KB | None | 0 0
  1. forward SaveAllHouses();
  2. public SaveAllHouses()
  3. {
  4.     new i;
  5.     new File;
  6.     while(i < MAX_HOUSES)
  7.     {
  8.         new string[288];
  9.         format(string, sizeof(string), "%d,%f,%f,%f,%f,%f,%f,%d,%d,%d,%s,%s,%d\r\n",
  10.             HouseInfo[i][hID],
  11.             HouseInfo[i][hEntrancePosX],
  12.             HouseInfo[i][hEntrancePosY],
  13.             HouseInfo[i][hEntrancePosZ],
  14.             HouseInfo[i][hExitPosX],
  15.             HouseInfo[i][hExitPosY],
  16.             HouseInfo[i][hExitPosZ],
  17.             HouseInfo[i][hInterior],
  18.             HouseInfo[i][hVirtualWorld],
  19.             HouseInfo[i][hOwned],
  20.             HouseInfo[i][hOwner],
  21.             HouseInfo[i][hDescription],
  22.             HouseInfo[i][hPrice]);
  23.         if(i == 0)
  24.         {
  25.             File = iniOpen("Houses.cfg");
  26.         }
  27.         else
  28.         {
  29.             File = iniOpen("Houses.cfg");
  30.         }
  31.         iniSet(File,"Houses.cfg", string);
  32.         i++;
  33.         iniClose(File);
  34.     }
  35.     i = 0;
  36.     return 1;
  37. }
  38. forward ReloadAllHouses();
  39. public ReloadAllHouses()
  40. {
  41.     new string[288];
  42.     new arrCoords[13][46];
  43.     new File = iniOpen("Houses.cfg");
  44.     new i;
  45.     if(File)
  46.     {
  47.         while(i < MAX_HOUSES)
  48.         {
  49.             iniOpen("Houses.cfg");
  50.             split(string, arrCoords, ',');
  51.             HouseInfo[i][hID] = strval(arrCoords[0]);
  52.             HouseInfo[i][hEntrancePosX] = floatstr(arrCoords[1]);
  53.             HouseInfo[i][hEntrancePosY] = floatstr(arrCoords[2]);
  54.             HouseInfo[i][hEntrancePosZ] = floatstr(arrCoords[3]);
  55.             HouseInfo[i][hExitPosX] = floatstr(arrCoords[4]);
  56.             HouseInfo[i][hExitPosY] = floatstr(arrCoords[5]);
  57.             HouseInfo[i][hExitPosZ] = floatstr(arrCoords[6]);
  58.             HouseInfo[i][hInterior] = strval(arrCoords[7]);
  59.             HouseInfo[i][hVirtualWorld] = strval(arrCoords[8]);
  60.             HouseInfo[i][hOwned] = strval(arrCoords[9]);
  61.             strmid(HouseInfo[i][hOwner], arrCoords[10], false, strlen(arrCoords[10]), MAX_PLAYER_NAME+1);
  62.             strmid(HouseInfo[i][hDescription], arrCoords[11], false, strlen(arrCoords[1]), 35+1);
  63.             HouseInfo[i][hPrice] = strval(arrCoords[12]);
  64.             i++;
  65.         }
  66.     }
  67.     iniClose(File);
  68.     return 1;
  69. }
  70. //sk47 xD
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement