[MYSQ] Script not detecting username.
#1

Note: I'm really new with MYSQL so please give full explanations.

So i've been trying to get my script to understand that the field "NAME" with the username %s, GetName(playerid) will allow them to login, but it keeps sending them to register dialog.

Account Checking
pawn Код:
forward OnAccountCheck(playerid);
public OnAccountCheck(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, DB);
    if(rows)
    {
        cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "In order to play, you need to login", "Login", "Quit");
    }
    else
    {
        ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "Register", "In order to play, you need to register.", "Register", "Quit");
    }
    return 1;
}
Reply
#2

If it shows the register dialog then it is fairly obvious that there aren't any rows returned. This may mean that your query is logically wrong or that there's simply nothing to retrieve to begin with. Also:
pawn Код:
cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
What is this even? Makes no sense. At all.
Reply
#3

Quote:
Originally Posted by Vince
Посмотреть сообщение
If it shows the register dialog then it is fairly obvious that there aren't any rows returned. This may mean that your query is logically wrong or that there's simply nothing to retrieve to begin with. Also:
pawn Код:
cache_get_field_content(0, "Name", GetName(playerid), DB, 129);
What is this even? Makes no sense. At all.
The rows are fine, registering is fine but when i was to re-log the server wouldn't recognize the account being in there, also that get_content was an accident, forgot to remove it before posting the code.

What's your suggestion for a function to check if a user is registered or not?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)