SA-MP Forums Archive
save system yini - 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)
+--- Thread: save system yini (/showthread.php?tid=429232)



save system yini - Gangasta300 - 08.04.2013

how should I solve problem with those two variables saving one below another.
this is first time I got something like this...




Код:
forward SaveRuksak(playerid);
public SaveRuksak(playerid)
{
	new INI:File = INI_Open(RuksakPath(playerid));
	INI_SetTag(File,"data");
	INI_WriteInt(File, "Oruzje", InventoryInfo[playerid][iImeoruzja]);
	INI_WriteInt(File, "Municija", InventoryInfo[playerid][iMunicija]);
	INI_WriteInt(File, "Crack", InventoryInfo[playerid][iCrack]);
	INI_WriteInt(File, "Marihuana", InventoryInfo[playerid][iMarihuana]);
	INI_WriteInt(File, "Sjeme Marihuane", InventoryInfo[playerid][iSjemeM]);
	INI_WriteInt(File, "Sjeme Koke", InventoryInfo[playerid][iSjemeK]);
	INI_Close(File);
	return 1;
}
Код:
forward ucitajruksak_data(playerid, name[], value[]);
public ucitajruksak_data(playerid, name[], value[])
{
	INI_Int("Oruzje", InventoryInfo[playerid][iImeoruzja]);
	INI_Int("Municija", InventoryInfo[playerid][iMunicija]);
	INI_Int("Crack", InventoryInfo[playerid][iCrack]);
	INI_Int("Marihuana", InventoryInfo[playerid][iMarihuana]);
	INI_Int("Sjeme Marihuane", InventoryInfo[playerid][iSjemeM]);
	INI_Int("Sjeme Koke", InventoryInfo[playerid][iSjemeK]);
	return 1;
}
SOLVED!


Re: save system yini - Pawnie - 08.04.2013

Make sure you have the same order inside the enum. It must go in the same order you want to save it. For example if you place the Sjeme Marihuane and after it Sjeme Koke bellow it, it will save in that order, no matter if you placed how you setted the Int.

So for example:

Код:
enum pInfo
{
    iMunicija, //This will be saved first
    iImeoruzja //This will be saved second
}
new PlayerInfo[MAX_PLAYERS][pInfo];

forward SaveRuksak(playerid);
public SaveRuksak(playerid)
{
    INI_WriteInt(File, "Oruzje", InventoryInfo[playerid][iImeoruzja]); //This will be saved/loaded second
	INI_WriteInt(File, "Municija", InventoryInfo[playerid][iMunicija]); //This will be saved/loaded first
}
It's writting the int on how you setted it inside the enum, not on how you setted the save/load Y_Int


Re: save system yini - Sremke - 08.04.2013

/// delete


Re: save system yini - Pawnie - 09.04.2013

Did it work?


Re: save system yini - Gangasta300 - 09.04.2013

Quote:
Originally Posted by Pawnie
Посмотреть сообщение
Did it work?
nop, I already have enum arranged that way.