MySQL Position Saving
#1

I'm having some issues loading positions.


pawn Код:
stock AssignPlayerData(playerid)
{
    Player[playerid][ID] = cache_get_field_content_int(0, "id");
    cache_get_field_content(0, "password", Player[playerid][Password], SQL, 129);
    Player[playerid][Money] = cache_get_field_content_int(0, "money");
    Player[playerid][Skin] = cache_get_field_content_int(0, "skin");
    Player[playerid][x] = cache_get_field_content_float(0, "x");
    Player[playerid][y] = cache_get_field_content_float(0, "y");
    Player[playerid][z] = cache_get_field_content_float(0, "z");
    return 1;
}
Reply
#2

Ok, can you show 1. the query 2. place where you fire the query 3. mysql_log?
Also AssignPlayerData can't be a stock, as callbacks have to be public functions.
Reply
#3

It's not a callback

pawn Код:
public OnPlayerDataLoaded(playerid, race_check)
{
    if(race_check != MysqlRaceCheck[playerid])
        return Kick(playerid);


    new string[128];
    if(cache_num_rows() > 0)
    {
        AssignPlayerData(playerid);

        format(string, sizeof(string), CHAT_WHITE "This account (" CHAT_YELLOW "%s" CHAT_WHITE ") is registered. Please login by entering your password in the field below:", Player[playerid][Name]);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Login", string, "Login", "Abort");
        Player[playerid][IsRegistered] = true;
    }
    else
    {
        format(string, sizeof(string), CHAT_WHITE "Welcome " CHAT_YELLOW "%s" CHAT_WHITE ", you can register by entering your password in the field below:", Player[playerid][Name]);
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, "Registration", string, "Register", "Abort");
        Player[playerid][IsRegistered] = false;
    }
    return 1;
}
The log is fine. There are no errors.
Reply
#4

Just to be sure check your field names in database, and compare to fields requested in query. I'd like to see the query (also logs, because important info isn't always an error).

I'm not sure though when cache is autoflushed. Do other things load correctly?
Reply
#5

Yes, other things load correctly like skin etc. But, it just seems to be the positions. Also, the log is in HTML format so I'm not sure how to show you.

EDIT: Fixed it. Thanks anyway, I'll rep you.
Reply
#6

http://pastebin.com http://jsfiddle.net/

Once again - what are your field names in database? Does the case match? How does your query look like? (Sorry if you ignored those question because of their trivialnousness, but I ask them not without a reason. I'm here to help)
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)