MySQL fails to load.
#1

Hello,

I'm using BlueG's mysql R8. However when caching, the login function doesn't work at all.

pawn Код:
public LoginPlayerProcessed(playerid)
{
        new rows, fields;
        cache_get_data(rows, fields, conn);
        if(!rows)
        {
                SendClientMessage(playerid, COLOR_RED, "Your password is incorrect. Please try again. Multiple wrong attempts could have you banned.");
                ShowPlayerDialog(playerid, 1002, DIALOG_STYLE_PASSWORD, "Login", ""HEX_AQUA"This account is registered.\n"HEX_WHITE"Please login using the password you used when you registered\n", "Login", "Cancel");
                return 1;
        }
        if(rows)
        {
                new Content[15];
                print("LOADING LOADED");
                cache_get_field_content(rows, "AdminLevel", Content, conn), PlayerInfo[playerid][pAdminLevel] = strval(Content);
                cache_get_field_content(rows, "DonateLevel", Content, conn), PlayerInfo[playerid][pDonateLevel] = strval(Content);
                cache_get_field_content(rows, "Jailed", Content, conn), PlayerInfo[playerid][pJailed] = strval(Content);
                cache_get_field_content(rows, "JailSeconds", Content, conn), PlayerInfo[playerid][pJailSeconds] = strval(Content);
                cache_get_field_content(rows, "Deaths", Content, conn), PlayerInfo[playerid][pDeaths] = strval(Content);
                cache_get_field_content(rows, "Kills", Content, conn), PlayerInfo[playerid][pKills] = strval(Content);
                cache_get_field_content(rows, "Points", Content, conn), PlayerInfo[playerid][pPoints] = strval(Content);
                cache_get_field_content(rows, "TotalHours", Content, conn), SetPVarString(playerid, "totalHours", Content);
                new Score = PlayerInfo[playerid][pKills] - PlayerInfo[playerid][pDeaths];
                SetPlayerScore(playerid, Score);
                GivePlayerPoints(playerid, PlayerInfo[playerid][pPoints]);
                new secs = gettime();
                new rel = secs - PlayerInfo[playerid][pJailSeconds];
                printf("JailSeconds = %d. Jailed = %d. Admin Level = %d", rel, PlayerInfo[playerid][pJailed], PlayerInfo[playerid][pAdminLevel]);
                playerLogged[playerid] = true;
                return 1;

        }
        return 1;

}
Above is my LoginPlayerProcessed.

pawn Код:
LoginPlayer(playerid, password[])
{

    new Query[128];
    format(Query, sizeof(Query), "SELECT * FROM Users WHERE Username='%s' AND Password=MD5('%s')", ReturnPlayerName(playerid), password);
    mysql_function_query(conn, Query, true, "LoginPlayerProcessed", "i", playerid);
    return 1;

}
My Loginplayer.

The debug results from the top function are below:
Код:
[21:24:45] LOADING LOADED
[21:24:45] JailSeconds = 0. Jailed = 0. Admin Level = 0
Doesn't matter what I'm attempting to load, they all fail to load.
Reply
#2

Fixed it. rows should have been 0.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)