MySQL R8 Loading problem
#1

pawn Код:
stock LoadAccount(playerid, Password[])
{
    new Query[150], PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, sizeof(PlayerName));
    format(Query, sizeof(Query), "SELECT * FROM `players` WHERE `Name`='%s' AND `Password`='%s' LIMIT 0,1", PlayerName, Password);
    mysql_function_query(MySQLConnection, Query, true, "OnLoadAccount", "ds", playerid, PlayerName);
    return 1;
}
       

public OnLoadAccount(playerid, PlayerName)
{
    new Rows, Fields, String[100];
    cache_get_data(Rows, Fields, MySQLConnection);
    if(Rows)
    {    
        // Floats
        PlayerInfo[playerid][pPos_x] = cache_get_field_float(0, "Pos_x", MySQLConnection);
        PlayerInfo[playerid][pPos_y] = cache_get_field_float(0, "Pos_y", MySQLConnection);
        PlayerInfo[playerid][pPos_z] = cache_get_field_float(0, "Pos_z", MySQLConnection);
        PlayerInfo[playerid][pPos_a] = cache_get_field_float(0, "Pos_a", MySQLConnection);
        printf("%f - %f - %f", PlayerInfo[playerid][pPos_x], PlayerInfo[playerid][pPos_y], PlayerInfo[playerid][pPos_z]);      
 
    }
I'm pretty sure I got this right, but it doesn't load coordinates properly. It works sometimes, and somtimes I spawn under a bridge in the middle of nowhere. I've tried debugging, and it loads the right coordinates one time, and then I quit and login again, and then it loads other coords.

I've double checked the coords in the database, and they are different than the ones being loaded.

Thanks for any suggestions on what may be wrong.
Reply


Messages In This Thread
MySQL R8 Loading problem - by Knappen - 10.03.2013, 16:46
Re: MySQL R8 Loading problem - by Bakr - 10.03.2013, 17:20
Re: MySQL R8 Loading problem - by Knappen - 10.03.2013, 17:38
Re: MySQL R8 Loading problem - by Bakr - 10.03.2013, 17:46
Re: MySQL R8 Loading problem - by Patrick - 10.03.2013, 18:03
Re: MySQL R8 Loading problem - by Knappen - 11.03.2013, 07:15
Re: MySQL R8 Loading problem - by Knappen - 11.03.2013, 21:04

Forum Jump:


Users browsing this thread: 1 Guest(s)