18.09.2012, 10:43
hello.
i had an little problem with my mysql-load/save system.
so, the account loads in ~0-1ms
I tried this:
"Account wurde in %d ms geladen" = Account was loaded in .. ms"
The ms shows "0" or "1". this is very good.
but if i save the player (logout/gmx)
it takes up to 40ms.
its too much!
I use blueG's mysql plugin.
can anyone help me ? :/
i had an little problem with my mysql-load/save system.
so, the account loads in ~0-1ms
I tried this:
pawn Код:
stock LoadPlayer(playerid)
{
new count = GetTickCount();
new Query[128], savingstring[40];
format(Query, sizeof(Query), "SELECT * FROM `accounts` WHERE `Name` = '%s'", GetName(playerid));
mysql_query(Query);
mysql_store_result();
while(mysql_fetch_row_format(Query,"|"))
{
mysql_fetch_field_row(savingstring, "Level"); Spieler[playerid][pLevel] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Admin"); Spieler[playerid][pAdmin] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Cash"); Spieler[playerid][pCash] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Tutorial"); Spieler[playerid][pTutorial] = strval(savingstring);
mysql_fetch_field_row(savingstring, "AccountLocked"); Spieler[playerid][pAccountLocked] = strval(savingstring);
mysql_fetch_field_row(savingstring, "SpawnHealth"); Spieler[playerid][pSpawnHealth] = floatstr(savingstring);
mysql_fetch_field_row(savingstring, "Geschlecht"); Spieler[playerid][pGeschlecht] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Skin"); Spieler[playerid][pSkin] = strval(savingstring);
mysql_fetch_field_row(savingstring, "Perso"); Spieler[playerid][pPerso] = strval(savingstring);
}
mysql_free_result();
printf("Account wurde in %d ms geladen.", GetTickCount() - count);
The ms shows "0" or "1". this is very good.
but if i save the player (logout/gmx)
it takes up to 40ms.
its too much!
pawn Код:
stock SavePlayer(playerid)
{
if(IsPlayerConnected(playerid))
{
new query[1024];
new count = GetTickCount();
format(query, sizeof(query), "UPDATE `accounts` SET Level=%d, Admin=%d, Cash=%d, Tutorial=%d, AccountLocked=%d, SpawnHealth=%f, Geschlecht=%d, Skin=%d, Perso=%d WHERE Name='%s'",
Spieler[playerid][pLevel],
Spieler[playerid][pAdmin],
Spieler[playerid][pCash],
Spieler[playerid][pTutorial],
Spieler[playerid][pAccountLocked],
Spieler[playerid][pSpawnHealth],
Spieler[playerid][pGeschlecht],
Spieler[playerid][pSkin],
Spieler[playerid][pPerso],
GetName(playerid));
mysql_query(query);
printf("Account wurde in %d ms gespeichert.", GetTickCount() - count);
}
return 1;
}
can anyone help me ? :/