SA-MP Forums Archive
Y_ini strange saving and loading problem - 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: Y_ini strange saving and loading problem (/showthread.php?tid=657805)



Y_ini strange saving and loading problem - Stormalle - 15.08.2018

Hello, i'm making business system with y_ini, and i have this strange thing, when i restart server to save it just spams the .ini file,and it does that everytime i restart my server. and it doesn't load business money
my code and .ini file
Код HTML:
public OnGameModeExit()
{
	for(new id = 1; id < MAX_VERSLU; id++)
	{
		if(vInfo[id][VerslasNupirktas] == 0) continue;
		SaveBusiness(id);
	}
	return 1;
}
Код HTML:
forward SaveBusiness(id);
public SaveBusiness(id)
{
	new file4[40];
	format(file4, sizeof(file4), VersloFailai, id);
	new INI:File = INI_Open(file4);
	INI_SetTag(File,"businessdata");
	INI_WriteInt(File,"Nupirktas", vInfo[id][VerslasNupirktas]);
	INI_WriteInt(File,"Pinigu Likutis Fonde", vInfo[id][VersloFondas]);
	INI_WriteString(File,"Verslo Pavadinimas", vInfo[id][VersloPavadinimas]);
	INI_Close(File);
	return 1;
}
Код HTML:
forward loadbusiness_businessdata(idx, name[], value[]);
public loadbusiness_businessdata(idx, name[], value[])
{
	print("loaded");
	INI_Int("Nupirktas", vInfo[idx][VerslasNupirktas]);
	INI_Int("Pinigu Likutis Fonde", vInfo[idx][VersloFondas]);
	INI_String("Verslo Pavadinimas", vInfo[idx][VersloPavadinimas], 128);
	return 1;
}
Код HTML:
new str[40];
	    format(str, sizeof(str), VersloFailai, ID);
		INI_ParseFile(str, "loadbusiness_%s", .bExtra = true, .extra = ID );
and this is how .ini file looks
https://prnt.sc/kizi75


Re: Y_ini strange saving and loading problem - Stormalle - 15.08.2018

Help!


Re: Y_ini strange saving and loading problem - Shockey HD - 16.08.2018

It's 2018, Why are you using Y_ini and not MySQL? lol

It's going to spam it being that the save function is in a loop.

Under your vData loop add Saved


and then use this.


pawn Код:
public OnGameModeExit()
{
    for(new id = 1; id < MAX_VERSLU; id++)
    {
        if(vInfo[id][Saved] == 0)
        {
            if(vInfo[id][VerslasNupirktas] == 0) continue;
            SaveBusiness(id);
            vInfo[id][Saved] = 1;
        }
    }
    return 1;
}



Re: Y_ini strange saving and loading problem - Stormalle - 16.08.2018

i'll quit samp soon so no point learning mysql right now
and that didn't fix the problem


Re: Y_ini strange saving and loading problem - CodeStyle175 - 16.08.2018

again just don't use ini for vehicles, cause this old ini file shit must be stopped, idk why it was started at all in the beginning.


Re: Y_ini strange saving and loading problem - Stormalle - 16.08.2018

it's not for vehicles


Re: Y_ini strange saving and loading problem - Stormalle - 16.08.2018

Spaces in keys?


Re: Y_ini strange saving and loading problem - Stormalle - 16.08.2018

Can u explain that?