Problem with MySQL Data Loading
#1

Hey,

I've created a MySQL dialog login system and it works fine... Until it attempts to load the players data when logging in. It just keeps everything set to 0.


enum:
Код:
enum pData
{
username[MAX_PLAYER_NAME],
password[32],
score,
money,
admin,
logged,
}
new playerdata[MAX_PLAYERS][pData];
loginplayer stock:
Код:
stock LoginPlayer(playerid, pass[])
{
    new query[1000];
    format(query, sizeof(query),"SELECT * FROM playerdata WHERE username = '%s' AND password = md5('%s')",playerdata[playerid][username],pass);
    mysql_query(query);
    mysql_store_result();
    if(mysql_num_rows() != 0)
    {
        if(mysql_fetch_row(query, "|"))
        {
            sscanf(query,"e<p<|>s[180]s[180]iii>", playerdata[playerid]);
            new str[80];
            format(str, sizeof(str),"Welcome %s, you have been logged in to your account",playerdata[playerid][username]);
            SendClientMessage(playerid, COLOR_BLUE, str);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            SetPlayerScore(playerid, playerdata[playerid][score]);
            GivePlayerMoney(playerid, playerdata[playerid][money]);
            SpawnPlayer(playerid);
            playerdata[playerid][logged] = 1;
        }
    }
    else
    {
        ShowPlayerDialog(playerid,LOGIN_DIALOG,DIALOG_STYLE_PASSWORD,"Login to Account.","Wrong password:","Login","Cancel");
    }
}
Reply


Messages In This Thread
Problem with MySQL Data Loading - by Slepur - 04.08.2013, 20:17
Re: Problem with MySQL Data Loading - by Slepur - 04.08.2013, 21:58
Re: Problem with MySQL Data Loading - by HarrisonC - 04.08.2013, 22:13
Re: Problem with MySQL Data Loading - by CrazyChoco - 04.08.2013, 22:37
Re: Problem with MySQL Data Loading - by SuperViper - 04.08.2013, 22:41

Forum Jump:


Users browsing this thread: 3 Guest(s)