MySQL R7 by BlueG Problem -
Stevo127 - 15.01.2013
Hey guys, not often I create one of these threads, but I'm very interested in the cache and function query system that R7 offers. So here's my problem.
I re-scripted everything in our script to use both of these together, yet we hit some MAJOR issues. Everything seems to work fine at first, but after a while, some player accounts seem to go missing and reset themselves / get replaced by someone elses.
I THINK the problem is with the cache system, in that it doesn't queue requests into the cache. Therefore, if MySQL function queries were to co-inside with each other at the same time, they might get playerfiles mixed up / reset with someone who is registering.
If anyone has any other suggestions, please let me know, but I think it's an issue that BlueG himself may need to fix.
Thanks in advance.
EDIT: Some examples of the code shown below.
pawn Код:
if(!doesFileAccountExist(playername2))
{
print("[DEBUG] Logging into SQL Account");
format(query,sizeof(query),"SELECT * FROM `users` WHERE `Username` = '%s';",playername2);
mysql_function_query(mysql_connection, query, true, "OnSQLPasswordCheck", "is", playerid, password);
return 1;
}
pawn Код:
forward OnSQLPasswordCheck(playerid, password[]);
public OnSQLPasswordCheck(playerid, password[])
{
new rows, fields, string[128], query[256];
cache_get_data(rows, fields);
if(rows)
{
new playername2[24];
GetPlayerName(playerid,playername2,sizeof(playername2));
new TempStr[126];
cache_get_field_content(0, "Key", TempStr);
strmid(PlayerInfo[playerid][pKey], TempStr, 0, strlen(TempStr), 255);
if(strcmp(PlayerInfo[playerid][pKey],password,true) == 0)
{
format(query,sizeof(query),"SELECT * FROM `users` WHERE `Username` = '%s';",playername2);
mysql_function_query(mysql_connection, query, true, "OnSQLPlayerLogin", "i", playerid);
SetPVarInt(playerid, "FirstSpawn", 0);
}
else
{
ShowMainMenuDialog(playerid, 3);
gPlayerLogTries[playerid] += 1;
if(gPlayerLogTries[playerid] == 2) { SendClientMessageEx(playerid, COLOR_RED, "Wrong password, you have been kicked out automatically."); Kick(playerid); }
return 1;
}
}
return 1;
}
pawn Код:
public OnSQLPlayerLogin(playerid)
{
new tmp2[256];
new playername2[MAX_PLAYER_NAME];
GetPlayerName(playerid, playername2, sizeof(playername2));
new rows, fields, string[128], string2[128];
cache_get_data(rows, fields);
if(rows)
{
new temp[12];
cache_get_field_content(0, "Level", temp), PlayerInfo[playerid][pLevel] = strval(temp);
cache_get_field_content(0, "AdminLevel", temp), PlayerInfo[playerid][pAdmin] = strval(temp);
cache_get_field_content(0, "Band", temp), PlayerInfo[playerid][pBanned] = strval(temp);
cache_get_field_content(0, "PermBand", temp), PlayerInfo[playerid][pPermaBanned] = strval(temp);
cache_get_field_content(0, "Warnings", temp), PlayerInfo[playerid][pWarns] = strval(temp);
}
}
Re: MySQL R7 by BlueG Problem -
park4bmx - 15.01.2013
dont think so sounds more like a script wise problem.
Quote:
Originally Posted by park4bmx
you need to show us some code in order to help you!
else wrong place to post !
|
Re: MySQL R7 by BlueG Problem -
Stevo127 - 15.01.2013
Updated the first post with some code.
(Note there is around 200 more playerfile entries, but they have been removed for viewing purposes.
Re: MySQL R7 by BlueG Problem -
park4bmx - 15.01.2013
dont see nothing wrong in that code but when players are disconnection do you close the connection between them, so for the next player it opens a new connection.
or variables(connection handle) gets mixed up and overweight someone else's account
Re: MySQL R7 by BlueG Problem -
Stevo127 - 15.01.2013
Connection Handle is not meant to be closed until the GameMode closes.
Like I said, it doesn't seem to be my code causing the issue, I think it may be that the cache function does not queue requests, and things overwrite each other / overlap.
Re: MySQL R7 by BlueG Problem -
Stevo127 - 16.01.2013
Need to bump this up as I think I may have stumbled upon a major bug.
Re: MySQL R7 by BlueG Problem -
Stevo127 - 17.01.2013
Still in need of a resolution to this issue...
Re: MySQL R7 by BlueG Problem -
Stevo127 - 19.01.2013
BUMP. In real need of some opinions on this matter..
Re: MySQL R7 by BlueG Problem -
Djole1337 - 20.01.2013
As I can see this code is ok, can you post register part ?
Re: MySQL R7 by BlueG Problem -
Stevo127 - 20.01.2013
The register system does pretty much the same thing, I don't think the register system is getting bugged as it doesn't use cache functions, it is just simple INSERT INTO and UPDATE queries.