Y_INI big files
#1

Howdy guys, I'm trying to create furniture system for a dynamic houses, each house have it's own file created when creating house, so the problem is:

I'm trying to save many variables with y_ini, and it's taking rly too long. Saving + Loading one house takes about 12 seconds...

I rly don't know where's the problem, so I'd be very grateful if you help me guys Thanks..

/createhouse command:
Код:
YCMD:createkuca(playerid, params[], help)
{
  if(!IsAdmin(playerid, 8)) return 1;
  if(strfind(params, "secure", true) == 0)
  {
  new ff[80], Float:pos[3];
  GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
  new pint = GetPlayerInterior(playerid); new pvw = GetPlayerVirtualWorld(playerid);
  new fid = (total_kuca+1);
  total_kuca++;
  format(ff, 80, KUCA_FILE, fid);
  if(!INI_Exist(ff))
  {
	  new INI:f = INI_Open(ff);
	  INI_WriteString(f, "Vlasnik", "Nema");
      INI_WriteFloat(f, "eX", pos[0]);
	  INI_WriteFloat(f, "eY", pos[1]);
	  INI_WriteFloat(f, "eZ", pos[2]);
	  INI_WriteInt(f, "eInt", pint);
	  INI_WriteInt(f, "eVW", pvw);
	  INI_WriteFloat(f, "iX", 0.00);
	  INI_WriteFloat(f, "iY", 0.00);
	  INI_WriteFloat(f, "iZ", 0.00);
	  INI_WriteInt(f, "iInt", 0);
	  INI_WriteInt(f, "iVW", fid);
	  INI_WriteInt(f, "Novac", 0);
	  INI_WriteInt(f, "Materijali", 0);
	  INI_WriteInt(f, "Cijena", 0);
	  INI_WriteInt(f, "Locked", 1);
	  new string[24];
	  for(new a=0; a<10; a++) { format(string,sizeof(string), "Droga%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Weapons%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Ammo%i", a); INI_WriteInt(f, string, 0);  }
	  INI_WriteInt(f, "WCount", 0);
	  INI_WriteFloat(f, "SPX", 0.00);
	  INI_WriteFloat(f, "SPY", 0.00);
	  INI_WriteFloat(f, "SPZ", 0.00);
	  INI_WriteFloat(f, "SPRX", 0.00);
	  INI_WriteFloat(f, "SPRY", 0.00);
	  INI_WriteFloat(f, "SPRZ", 0.00);
	  INI_WriteInt(f, "SPLocked", 0);
	  INI_WriteInt(f, "SP", 0);
	  INI_WriteInt(f, "Radio0", 0);
	  INI_WriteInt(f, "Radio1", 0);
	  INI_WriteInt(f, "SPLozinka", 0);
	  INI_WriteInt(f, "AlarmLevel", 0);
	  INI_WriteInt(f, "LockLevel", 0);
	  INI_WriteInt(f, "FCount", 0);
 	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FModel%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FObj%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPX%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPY%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPZ%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRX%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRY%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRZ%i", a); INI_WriteFloat(f, string, 0.00);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatIndex%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FModelID%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTXDName%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTName%i", a); INI_WriteInt(f, string, 0);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatColor%i", a); INI_WriteInt(f, string, 0);  }
	  INI_WriteInt(f, "FMatCount", 0);
      INI_Close(f);
      INI_ParseFile(ff, "LoadKuce", .bExtra = true, .extra = fid);
      FirmaPickup[fid] = CreateDynamicPickup(1273, 23, kD[fid][eX], kD[fid][eY], kD[fid][eZ],-1,-1,-1,100.0);
      new strinfo[64];
	  forstring(strinfo, ""#hOrange"[KUCA] | $%d", kD[fid][Cijena]);
	  Kuca3d[fid] = CreateDynamic3DTextLabel(strinfo, -1, kD[fid][eX], kD[fid][eY], kD[fid][eZ]+0.5, 10.0, INVALID_PLAYER_ID, INVALID_VEHICLE_ID, 0, 0, 0, -1);
      new str[128];
      forstring(str, ""#hCrvena"ADMIN::"#hBijela" %s je napravio kucu, id kuce je (%i)", pName(playerid), fid);
      AdminMsg(str);
  }
  } else return ScmEx(playerid, "INFO:: /createkuca [secure]*");
  return 1;
}
Loading system for houses:
Код:
forward LoadKuce(fid, name[], value[]);
public LoadKuce(fid, name[], value[])
{
  INI_String("Vlasnik", kucaData[fid][Vlasnik], 24);
  INI_Float("eX", kucaData[fid][eX]);
  INI_Float("eY", kucaData[fid][eY]);
  INI_Float("eZ", kucaData[fid][eZ]);
  INI_Int("eInt", kucaData[fid][eInt]);
  INI_Int("eVW", kucaData[fid][eVW]);
  INI_Float("iX", kucaData[fid][iX]);
  INI_Float("iY", kucaData[fid][iY]);
  INI_Float("iZ", kucaData[fid][iZ]);
  INI_Int("iInt", kucaData[fid][iInt]);
  INI_Int("iVW", kucaData[fid][iVW]);
  INI_Int("Novac", kucaData[fid][Novac]);
  INI_Int("Materijali", kucaData[fid][Materijali]);
  INI_Int("Cijena", kucaData[fid][Cijena]);
  INI_Int("Locked", kucaData[fid][Locked]);
  new string[24];
  for(new a=0; a<10; a++) { format(string,sizeof(string), "Droga%i", a); INI_Int(string, kucaData[fid][Droga][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "Weapons%i", a); INI_Int(string, kucaData[fid][Weapons][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "Ammo%i", a); INI_Int(string, kucaData[fid][Ammo][a]);  }
  INI_Int("WCount", kucaData[fid][WCount]);
  INI_Float("SPX", kucaData[fid][SPX]);
  INI_Float("SPY", kucaData[fid][SPY]);
  INI_Float("SPZ", kucaData[fid][SPZ]);
  INI_Float("SPRX", kucaData[fid][SPRX]);
  INI_Float("SPRY", kucaData[fid][SPRY]);
  INI_Float("SPRZ", kucaData[fid][SPRZ]);
  INI_Int("SPLocked", kucaData[fid][SPLocked]);
  INI_Int("SP", kucaData[fid][SP]);
  INI_Int("Radio0", kucaData[fid][Radio][0]);
  INI_Int("Radio1", kucaData[fid][Radio][1]);
  INI_Int("SPLozinka", kucaData[fid][SPLozinka]);
  INI_Int("AlarmLevel", kucaData[fid][AlarmLevel]);
  INI_Int("LockLevel", kucaData[fid][LockLevel]);
  INI_Int("FCount", kucaData[fid][FCount]);
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FModel%i", a); INI_Int(string, kucaData[fid][FModel][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FObj%i", a); INI_Int(string, kucaData[fid][FObj][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPX%i", a); INI_Float(string, kucaData[fid][FPX][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPY%i", a); INI_Float(string, kucaData[fid][FPY][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPZ%i", a); INI_Float(string, kucaData[fid][FPZ][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRX%i", a); INI_Float(string, kucaData[fid][FRX][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRY%i", a); INI_Float(string, kucaData[fid][FRY][a]);  }
  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRZ%i", a); INI_Float(string, kucaData[fid][FRZ][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatIndex%i", a); INI_Int(string, kucaData[fid][FMatIndex][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "FModelID%i", a); INI_Int(string, kucaData[fid][FModelID][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTXDName%i", a); INI_Int(string, kucaData[fid][FMatTXDName][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTName%i", a); INI_Int(string, kucaData[fid][FMatTName][a]);  }
  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatColor%i", a); INI_Int(string, kucaData[fid][FMatColor][a]);  }
  INI_Int("FMatCount", kucaData[fid][FMatCount]);
  return 1;
}
Saving system for houses:
Код:
stock SpremiKuce()
{
  for(new rr=1; rr < MAX_KUCA; rr ++)
  {
	new ff[80];
	format(ff,80,KUCA_FILE,rr);
	if(fexist(ff))
	{
      new INI:f = INI_Open(ff);
      INI_WriteString(f, "Vlasnik", kucaData[rr][Vlasnik]);
      INI_WriteFloat(f, "eX", kucaData[rr][eX]);
	  INI_WriteFloat(f, "eY", kucaData[rr][eY]);
	  INI_WriteFloat(f, "eZ", kucaData[rr][eZ]);
	  INI_WriteInt(f, "eInt", kucaData[rr][eInt]);
	  INI_WriteInt(f, "eVW", kucaData[rr][eVW]);
	  INI_WriteFloat(f, "iX", kucaData[rr][iX]);
	  INI_WriteFloat(f, "iY", kucaData[rr][iY]);
	  INI_WriteFloat(f, "iZ", kucaData[rr][iZ]);
	  INI_WriteInt(f, "iInt", kucaData[rr][iInt]);
	  INI_WriteInt(f, "iVW", kucaData[rr][iVW]);
	  INI_WriteInt(f, "Novac", kucaData[rr][Novac]);
	  INI_WriteInt(f, "Materijali", kucaData[rr][Materijali]);
	  INI_WriteInt(f, "Cijena", kucaData[rr][Cijena]);
	  INI_WriteInt(f, "Locked", kucaData[rr][Locked]);
	  new string[24];
	  for(new a=0; a<10; a++) { format(string,sizeof(string), "Droga%i", a); INI_WriteInt(f, string, kucaData[rr][Droga][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Weapons%i", a); INI_WriteInt(f, string, kucaData[rr][Weapons][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Ammo%i", a); INI_WriteInt(f, string, kucaData[rr][Ammo][a]);  }
	  INI_WriteInt(f, "WCount", kucaData[rr][WCount]);
	  INI_WriteFloat(f, "SPX", kucaData[rr][SPX]);
	  INI_WriteFloat(f, "SPY", kucaData[rr][SPY]);
	  INI_WriteFloat(f, "SPZ", kucaData[rr][SPZ]);
	  INI_WriteFloat(f, "SPRX", kucaData[rr][SPRX]);
	  INI_WriteFloat(f, "SPRY", kucaData[rr][SPRY]);
	  INI_WriteFloat(f, "SPRZ", kucaData[rr][SPRZ]);
	  INI_WriteInt(f, "SPLocked", kucaData[rr][SPLocked]);
	  INI_WriteInt(f, "SP", kucaData[rr][SP]);
	  INI_WriteInt(f, "Radio0", kucaData[rr][Radio][0]);
	  INI_WriteInt(f, "Radio1", kucaData[rr][Radio][1]);
	  INI_WriteInt(f, "SPLozinka", kucaData[rr][SPLozinka]);
	  INI_WriteInt(f, "AlarmLevel", kucaData[rr][AlarmLevel]);
	  INI_WriteInt(f, "LockLevel", kucaData[rr][LockLevel]);
	  INI_WriteInt(f, "FCount", kucaData[rr][FCount]);
 	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FModel%i", a); INI_WriteInt(f, string, kucaData[rr][FModel][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FObj%i", a); INI_WriteInt(f, string, kucaData[rr][FObj][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPX%i", a); INI_WriteFloat(f, string, kucaData[rr][FPX][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPY%i", a); INI_WriteFloat(f, string, kucaData[rr][FPY][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPZ%i", a); INI_WriteFloat(f, string, kucaData[rr][FPZ][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRX%i", a); INI_WriteFloat(f, string, kucaData[rr][FRX][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRY%i", a); INI_WriteFloat(f, string, kucaData[rr][FRY][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRZ%i", a); INI_WriteFloat(f, string, kucaData[rr][FRZ][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatIndex%i", a); INI_WriteInt(f, string, kucaData[rr][FMatIndex][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FModelID%i", a); INI_WriteInt(f, string, kucaData[rr][FModelID][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTXDName%i", a); INI_WriteInt(f, string, kucaData[rr][FMatTXDName][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTName%i", a); INI_WriteInt(f, string, kucaData[rr][FMatTName][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatColor%i", a); INI_WriteInt(f, string, kucaData[rr][FMatColor][a]);  }
	  INI_WriteInt(f, "FMatCount", kucaData[rr][FMatCount]);
      INI_Close(f);
	}
  }
}
stock SpremiKucu(rr)
{
	new ff[80];
	format(ff,80,KUCA_FILE,rr);
	if(fexist(ff))
	{
      new INI:f = INI_Open(ff);
      INI_WriteString(f, "Vlasnik", kucaData[rr][Vlasnik]);
      INI_WriteFloat(f, "eX", kucaData[rr][eX]);
	  INI_WriteFloat(f, "eY", kucaData[rr][eY]);
	  INI_WriteFloat(f, "eZ", kucaData[rr][eZ]);
	  INI_WriteInt(f, "eInt", kucaData[rr][eInt]);
	  INI_WriteInt(f, "eVW", kucaData[rr][eVW]);
	  INI_WriteFloat(f, "iX", kucaData[rr][iX]);
	  INI_WriteFloat(f, "iY", kucaData[rr][iY]);
	  INI_WriteFloat(f, "iZ", kucaData[rr][iZ]);
	  INI_WriteInt(f, "iInt", kucaData[rr][iInt]);
	  INI_WriteInt(f, "iVW", kucaData[rr][iVW]);
	  INI_WriteInt(f, "Novac", kucaData[rr][Novac]);
	  INI_WriteInt(f, "Materijali", kucaData[rr][Materijali]);
	  INI_WriteInt(f, "Cijena", kucaData[rr][Cijena]);
	  INI_WriteInt(f, "Locked", kucaData[rr][Locked]);
	  new string[24];
	  for(new a=0; a<10; a++) { format(string,sizeof(string), "Droga%i", a); INI_WriteInt(f, string, kucaData[rr][Droga][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Weapons%i", a); INI_WriteInt(f, string, kucaData[rr][Weapons][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "Ammo%i", a); INI_WriteInt(f, string, kucaData[rr][Ammo][a]);  }
	  INI_WriteInt(f, "WCount", kucaData[rr][WCount]);
	  INI_WriteFloat(f, "SPX", kucaData[rr][SPX]);
	  INI_WriteFloat(f, "SPY", kucaData[rr][SPY]);
	  INI_WriteFloat(f, "SPZ", kucaData[rr][SPZ]);
	  INI_WriteFloat(f, "SPRX", kucaData[rr][SPRX]);
	  INI_WriteFloat(f, "SPRY", kucaData[rr][SPRY]);
	  INI_WriteFloat(f, "SPRZ", kucaData[rr][SPRZ]);
	  INI_WriteInt(f, "SPLocked", kucaData[rr][SPLocked]);
	  INI_WriteInt(f, "SP", kucaData[rr][SP]);
	  INI_WriteInt(f, "Radio0", kucaData[rr][Radio][0]);
	  INI_WriteInt(f, "Radio1", kucaData[rr][Radio][1]);
	  INI_WriteInt(f, "SPLozinka", kucaData[rr][SPLozinka]);
	  INI_WriteInt(f, "AlarmLevel", kucaData[rr][AlarmLevel]);
	  INI_WriteInt(f, "LockLevel", kucaData[rr][LockLevel]);
	  INI_WriteInt(f, "FCount", kucaData[rr][FCount]);
 	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FModel%i", a); INI_WriteInt(f, string, kucaData[rr][FModel][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FObj%i", a); INI_WriteInt(f, string, kucaData[rr][FObj][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPX%i", a); INI_WriteFloat(f, string, kucaData[rr][FPX][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPY%i", a); INI_WriteFloat(f, string, kucaData[rr][FPY][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FPZ%i", a); INI_WriteFloat(f, string, kucaData[rr][FPZ][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRX%i", a); INI_WriteFloat(f, string, kucaData[rr][FRX][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRY%i", a); INI_WriteFloat(f, string, kucaData[rr][FRY][a]);  }
	  for(new a=0; a<500; a++) { format(string,sizeof(string), "FRZ%i", a); INI_WriteFloat(f, string, kucaData[rr][FRZ][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatIndex%i", a); INI_WriteInt(f, string, kucaData[rr][FMatIndex][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FModelID%i", a); INI_WriteInt(f, string, kucaData[rr][FModelID][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTXDName%i", a); INI_WriteInt(f, string, kucaData[rr][FMatTXDName][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatTName%i", a); INI_WriteInt(f, string, kucaData[rr][FMatTName][a]);  }
	  for(new a=0; a<50; a++) { format(string,sizeof(string), "FMatColor%i", a); INI_WriteInt(f, string, kucaData[rr][FMatColor][a]);  }
	  INI_WriteInt(f, "FMatCount", kucaData[rr][FMatCount]);
      INI_Close(f);
	}
}
Any help is appreciated, thanks in advance.
Reply


Messages In This Thread
Y_INI big files - by |gg|Vlado - 04.03.2014, 12:55
Re: Y_INI big files - by |gg|Vlado - 04.03.2014, 18:30
Re: Y_INI big files - by |gg|Vlado - 04.03.2014, 23:14
Re: Y_INI big files - by Vince - 04.03.2014, 23:27
Re: Y_INI big files - by ColeMiner - 05.03.2014, 04:59
Re: Y_INI big files - by |gg|Vlado - 05.03.2014, 06:16

Forum Jump:


Users browsing this thread: 2 Guest(s)