mysql server problem
#1

I took from the moderntopia with the r6 plugin the login, register and update system. It doesn't load the data from the database and doesn't save it when i close.
When i close the server i get the "don't send" error.

pawn Код:
public OnPlayerLogin(playerid,password[])
{
    MySQLCheckConnection();
    new tmp2[256];
    new string2[64];
    new playername2[MAX_PLAYER_NAME];
    new playernamesplit[3][MAX_PLAYER_NAME];
    GetPlayerName(playerid, playername2, sizeof(playername2));
    split(playername2, playernamesplit, '_');
    MySQLFetchAcctSingle(PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pPass]);
    if(strcmp(PlayerInfo[playerid][pPass],password, true ) == 0 )
    {
        mysql_query("SELECT * FROM `users`");
        mysql_store_result();
        if (mysql_num_rows())
        {
            new field[64], data[256];
            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Level");
            PlayerInfo[playerid][pLevel] = strval(field);

            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Money");
            PlayerInfo[playerid][pMoney] = strval(field);

            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Admin");
            PlayerInfo[playerid][pAdmin] = strval(field);

            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Vip");
            PlayerInfo[playerid][pVip] = strval(field);

            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Pos_x");
            PlayerInfo[playerid][pPos_x] = strval(field);
           
            mysql_fetch_row(data);
            mysql_fetch_field_row(field, "Pos_y");
            PlayerInfo[playerid][pPos_y] = strval(field);

            .
            .
            .
            .

        }
        mysql_free_result();
    }
pawn Код:
public SaveAccount(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(gPlayerLogged[playerid])
        {
            MySQLCheckConnection();
            new query[MAX_STRING];
            format(query, MAX_STRING, "UPDATE players SET ");
            MySQLUpdatePlayerStr(query, PlayerInfo[playerid][pSQLID], "Password", PlayerInfo[playerid][pPass]);
            PlayerInfo[playerid][pMoney] = GetPlayerMoney(playerid);
            MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Level", PlayerInfo[playerid][pLevel]);
            MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Money", PlayerInfo[playerid][pMoney]);
            MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Admin", PlayerInfo[playerid][pAdmin]);
            MySQLUpdatePlayerInt(query, PlayerInfo[playerid][pSQLID], "Vip", PlayerInfo[playerid][pVip]);
            .
                        .
                        .
                        .

            MySQLUpdateFinish(query, PlayerInfo[playerid][pSQLID]);
        }
    }
    return 1;
}]
Reply


Messages In This Thread
mysql server problem - by pantelimonfl - 20.07.2011, 16:44
Re: mysql server problem - by Hal - 20.07.2011, 19:05
Re: mysql server problem - by pantelimonfl - 20.07.2011, 19:08
Re: mysql server problem - by Grim_ - 20.07.2011, 19:11
Re: mysql server problem - by pantelimonfl - 20.07.2011, 20:13
Re: mysql server problem - by Grim_ - 20.07.2011, 20:23
Re: mysql server problem - by pantelimonfl - 20.07.2011, 20:29
Re: mysql server problem - by Grim_ - 20.07.2011, 20:37
Re: mysql server problem - by pantelimonfl - 20.07.2011, 20:45
Re: mysql server problem - by Grim_ - 20.07.2011, 20:54
Re: mysql server problem - by pantelimonfl - 20.07.2011, 21:43
Re: mysql server problem - by pantelimonfl - 21.07.2011, 09:20

Forum Jump:


Users browsing this thread: 3 Guest(s)