29.08.2008, 15:32
I have tried turning the Autocommit of at the beginning of all the data writing, then I commited the file and at the end I turned Autocommit on again.
The time that it takes is still around 2-5 seconds.
And I've maybe found a bug. When I registered directly after a gmx, it didn't stored all the data that I was going to save, it only saved 2 of the 7 savings to the file.
Here is my code:
The variables player and params have been defined already.
Thanks
The time that it takes is still around 2-5 seconds.
And I've maybe found a bug. When I registered directly after a gmx, it didn't stored all the data that I was going to save, it only saved 2 of the 7 savings to the file.
Here is my code:
pawn Код:
djAutocommit(false);
format(str, sizeof(str), "%s/Password", player);
djSetInt("Accounts.json", str, udb_hash(params));
format(str, sizeof(str), "%s/Money", player);
djSetInt("Accounts.json", str, GetPlayerMoney(playerid));
format(str, sizeof(str), "%s/Score", player);
djSetInt("Accounts.json", str, GetPlayerScore(playerid));
format(str, sizeof(str), "%s/Health", player);
GetPlayerHealth(playerid, pHealth);
djSetFloat("Accounts.json", str, pHealth);
GetPlayerPos(playerid, Pos[0], Pos[1], Pos[2]);
format(str, sizeof(str), "%s/X", player);
djSetFloat("Accounts.json", str, Pos[0]);
format(str, sizeof(str), "%s/Y", player);
djSetFloat("Accounts.json", str, Pos[1]);
format(str, sizeof(str), "%s/Z", player);
djSetFloat("Accounts.json", str, Pos[2]);
djCommit("Accounts.json");
djAutocommit(true);
Thanks