SA-MP Forums Archive
Dini is too slow to save data under OnPlayerDisconnect? - 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: Dini is too slow to save data under OnPlayerDisconnect? (/showthread.php?tid=519242)



Dini is too slow to save data under OnPlayerDisconnect? - Battlezone - 13.06.2014

When the player uses /savestats cmd, his stats save successfully in-game.

pawn Код:
CMD:savestats(playerid, params[])
{
    SendClientMessage(playerid, COLOR_YELLOW, ".:||Stats Saved||:.");
    dini_Set(file, "example0", PlayerInfo[playerid][example0]);
    dini_Set(file, "example1", PlayerInfo[playerid][example1]);
    dini_Set(file, "example2", PlayerInfo[playerid][example2]);
    dini_Set(file, "example3", PlayerInfo[playerid][example3]);
    return 1;
}
But when i put the same thing under OnPlayerDisconnect ( and add if(gPlayerLogged == 1) ) the stats won't save

Under onplayerdisconnect

pawn Код:
format(file, sizeof(file), SERVER_USER_FILE, GetName(playerid));
if(gPlayerLogged[playerid] == 1)
    {
        dini_Set(file, "example0", PlayerInfo[playerid][example0]);
        dini_Set(file, "example1", PlayerInfo[playerid][example1]);
        dini_Set(file, "example2", PlayerInfo[playerid][example2]);
        dini_Set(file, "example3", PlayerInfo[playerid][example3]);
    }
    gPlayerLogged[playerid] = 0;
Any solution?


Re: Dini is too slow to save data under OnPlayerDisconnect? - Jankingston - 13.06.2014

Use YSI [y_ini] it saves data very fastly, and DINI's kinda old. So, i'll advise you to switch it from y_ini


Re: Dini is too slow to save data under OnPlayerDisconnect? - VladimirMark - 13.06.2014

y_ini is the best at the moment Try it, it's much much more faster than Dini


Re: Dini is too slow to save data under OnPlayerDisconnect? - Battlezone - 13.06.2014

Thanks guys, ill switch right now


Re: Dini is too slow to save data under OnPlayerDisconnect? - VladimirMark - 13.06.2014

That's the right thing to do If you need any further help just PM me


Re: Dini is too slow to save data under OnPlayerDisconnect? - nmader - 13.06.2014

Well... actually... Y_ini is the fastest individual saver. However if you want really quick speed I'd roll with MySQL, it'd take some time to convert, but the speed will amaze you at times.


Re: Dini is too slow to save data under OnPlayerDisconnect? - nmader - 13.06.2014

Quote:
Originally Posted by ******
Посмотреть сообщение
I have to point out, yet again, that SQL is NOT a magic bullet. Yes, you CAN get good speed from it, but most people don't realise that it is actually a whole other language, not just 3 functions you call that transforms your mode instantly. If you want the possible speed you have to put in the effort to learn the language for what it is - another language.
I know it's not a "magic bullet". But if you have a gamemode with a lot of registered players (or vehicles, homes or businesses) it can definitely speed up the process of things. And MySQL is used in multiple programming languages so it never really hurts to learn it regardless.