Y_ini strange saving and loading problem
#1

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

Help!
Reply
#3

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;
}
Reply
#4

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

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.
Reply
#6

it's not for vehicles
Reply
#7

Spaces in keys?
Reply
#8

Can u explain that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)