MySQL loading
#2

Maybe try this?

pawn Код:
stock MySQL_Load(playerid)
{
    new
        Float: pos[3], // 0,1,2 - pozicija;
        fetch[16],
        Query[256];

    format(Query, sizeof(Query), "SELECT * FROM `zaidejai` WHERE vardas = '%s'", GetPlayerNameEx(playerid));
    mysql_query(Query);
    mysql_store_result();

    while (mysql_retrieve_row())
    {
        mysql_fetch_field_row( fetch, "x" );
        pos[0] = floatstr(fetch);

        mysql_fetch_field_row( fetch, "y" );
        pos[1] = floatstr(fetch);

        mysql_fetch_field_row( fetch, "z" );
        pos[2] = floatstr(fetch);

        SetPlayerPos( playerid, pos[0], pos[1], pos[2] + 0.75);

        mysql_fetch_field_row( fetch,"pLytis" );        playerData[playerid][pLytis] = strval(fetch);
        mysql_fetch_field_row( fetch,"pAdmin" );        playerData[playerid][pAdmin] = strval(fetch);
        mysql_fetch_field_row( fetch,"pVip" );          playerData[playerid][pVip] = strval(fetch);
        mysql_fetch_field_row( fetch,"pAdmin" );        playerData[playerid][pAdmin] = strval(fetch);
        mysql_fetch_field_row( fetch,"skin" );          playerData[playerid][pSkin] = strval(fetch);    SetPlayerSkin(playerid, playerData[playerid][pSkin]);
        mysql_fetch_field_row( fetch,"pinigai" );       playerData[playerid][pPinigai] = strval(fetch); GivePlayerMoney(playerid, playerData[playerid][pPinigai]);
        mysql_fetch_field_row( fetch,"patirtis" );      playerData[playerid][pPatirtis] = strval(fetch);    SetPlayerScore(playerid, playerData[playerid][pPatirtis]);
        mysql_fetch_field_row( fetch,"hp" );            SetPlayerHealth( playerid, floatstr( fetch ));
        mysql_fetch_field_row( fetch,"armour" );        SetPlayerArmour( playerid, floatstr( fetch ));
    }
    mysql_free_result();

    printf("Pakrautas юaidлjas. [%s]", GetPlayerNameEx(playerid));
    return 1;
}
You need to use mysql_retrieve_row each time you fetch a row, so it can move on to the next pointer.
Reply


Messages In This Thread
MySQL loading - by Burning - 03.10.2013, 14:43
Re: MySQL loading - by Emmet_ - 03.10.2013, 23:56
Re: MySQL loading - by Blueflash123 - 04.10.2013, 00:30
Re: MySQL loading - by Scenario - 04.10.2013, 04:15

Forum Jump:


Users browsing this thread: 1 Guest(s)