save system yini
#1

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!
Reply
#2

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
Reply
#3

/// delete
Reply
#4

Did it work?
Reply
#5

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


Forum Jump:


Users browsing this thread: 1 Guest(s)