[MySQL] tquery does not call callback correctly.
#1

Hello!

I have a problem. I'm calling a LoginQuery(); from OnPlayerConnect();

This is the code
pawn Код:
forward LoginQuery(playerid);
public LoginQuery(playerid) {
    new query[256];
    mysql_format(mysql, query, sizeof(query), "SELECT `Password`, `ID` FROM `players` WHERE `Name` = '%e' LIMIT 1", PlayerName(playerid));
    mysql_tquery(mysql, query, "OnPlayerRegisteredCheck", "i", playerid);
        SendInfoMessage(playerid,"test"); //This is sent to the chat.
    return 1;
}

forward OnPlayerRegisteredCheck(playerid);
public OnPlayerRegisteredCheck(playerid) {
    SendInfoMessage(playerid, "Registered, please login."); //This isn't sent to the player.
    new rows, fields;
    cache_get_data(rows, fields, mysql);
    if(rows) {
        cache_get_field_content(0, "Password", PlayerInfo[playerid][pPassword], mysql, 128);
        PlayerInfo[playerid][pID] = cache_get_field_content_int(0, "ID");
        ShowPlayerDialog(playerid, LoginDialog, DIALOG_STYLE_INPUT, "Login", "Welcome back!\nYour username is registered. Please fill in your password:", "Login", "Quit");
    } else {
        SendErrorMessage(playerid, "In order to play on this server, you need to fill in an application on http://test.com/.");
        SendErrorMessage(playerid, "Applications are normally responded on within 24 hours. Good luck.");
        SendInfoMessage(playerid, "Should you already be registered, please make sure your character-name is set correctly.");
        Kick(playerid);
    }
    return 1;
}
The second callback OnPlayerRegisteredCheck(); isn't called for some reason. As seen in the code above, the SendInfoMessage(); isn't sent. The function works however.

Any idea is welcome.
Reply
#2

Did you check the mysql log? What does it say?
Reply
#3

Quote:
Originally Posted by zPain
Посмотреть сообщение
Did you check the mysql log? What does it say?
Thank you. Seems like I'm a complete retard but I sure have a lesson learned now.

Problem was connection error.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)