SA-MP Forums Archive
MySQL Position Saving - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: MySQL Position Saving (/showthread.php?tid=499028)



MySQL Position Saving - Keyhead - 06.03.2014

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;
}



Re: MySQL Position Saving - Misiur - 06.03.2014

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.


Re: MySQL Position Saving - Keyhead - 06.03.2014

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.


Re: MySQL Position Saving - Misiur - 06.03.2014

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?


Re: MySQL Position Saving - Keyhead - 06.03.2014

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.


Re: MySQL Position Saving - Misiur - 06.03.2014

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)