dialog not showing
#1

For some reason, this dialog is refusing to show under any conditions. I added some debug lines and 'a' and 'c' print. 'b' does not print because it never makes it to the existing file condition because the registration dialog does not appear.

pawn Код:
#define dialog_login 1
#define dialog_register 2

stock ShowPlayerRegister(playerid)
{
    ShowPlayerDialog(playerid, dialog_register, DIALOG_STYLE_INPUT, "Welcome to ARP!", "Enter a password to register your account.", "Register", "Cancel");
}


forward CheckPlayerExists(playerid);
public CheckPlayerExists(playerid)
{
    new rows, fields;
    cache_get_data(rows, fields, sHandle);

    if(rows)
    {
        cache_get_field_content(0, "password", PlayerInfo[playerid][Password], sHandle, 129);
        ShowPlayerLogin(playerid);
        print("b");
    }
    else
    {
        print("c");
        ShowPlayerRegister(playerid);
    }

    return 1;
}


public OnPlayerConnect(playerid)
{
    new query[128];
    mysql_format(sHandle, query, sizeof(query), "SELECT `password` FROM `users` WHERE `name` = '%e' LIMIT 1", GetPName(playerid));
    mysql_tquery(sHandle, query, "CheckPlayerExists", "i", "playerid");
    print("a");
   
    return 1;
}


public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid)
    {
        case dialog_login:
        {
            if(!response) Kick(playerid);
           
            new hash[129], query[128];
            WP_Hash(hash, sizeof(hash), inputtext);
            if(strcmp(hash, PlayerInfo[playerid][Password])== 0)
            {
                mysql_format(sHandle, query, sizeof(query), "SELECT * FROM `users` WHERE `name` = '%e' LIMIT 1", GetPName(playerid));
                mysql_tquery(sHandle, query, "OnAccountLoad", "i", "playerid");
            }
            else
            {
                ShowBadLogin(playerid);
            }
        }
        case dialog_register:
        {
            if(!response) Kick(playerid);
            if(!strlen(inputtext)) ShowBadRegister(playerid);
           
            new query[512];
            new ip[24];
           
            GetPlayerIp(playerid, ip, 24);
            WP_Hash(PlayerInfo[playerid][Password], 129, inputtext);
           
            mysql_format(sHandle, query, sizeof(query), "INSERT INTO `users` (`name`, `password`, `ip`, `adminlevel`, `posx`, `posy`, `posz`, `posa`, `money`, `bank`) VALUES ('%e', '%e', '%e', 0, '%f', '%f', '%f', '%f', 0, 0)", GetPName(playerid), PlayerInfo[playerid][Password], ip, 0, 0, 0, 0, 0, 0);
            mysql_tquery(sHandle, query, "SendQuery");
        }
    }

    return 1;
}
Reply
#2

Show the dialog again Onplayerconnect..
Reply
#3

Quote:
Originally Posted by Joron
Посмотреть сообщение
Show the dialog again Onplayerconnect..
It's not supposed to be shown regardlessly in OnPlayerConnect. That's why I have it in CheckPlayerExists.
Reply
#4

Add a print to the ShowPlayerRegister function just to make sure it's being executed.
Reply
#5

Quote:
Originally Posted by zPain
Посмотреть сообщение
Add a print to the ShowPlayerRegister function just to make sure it's being executed.
I did this and it does call the function.
Reply
#6

Quote:
Originally Posted by austin070
Посмотреть сообщение
I did this and it does call the function.
That's odd. Did you check the mysql_log?
Reply
#7

Quote:
Originally Posted by zPain
Посмотреть сообщение
That's odd. Did you check the mysql_log?
Yes. No errors.
Reply
#8

Instead of print("a"); try print("c"); onplayerconnect
Am Guessing eh.
Reply
#9

Quote:
Originally Posted by Joron
Посмотреть сообщение
Instead of print("a"); try print("c"); onplayerconnect
Am Guessing eh.
With all due respect, that's preposterous.
Reply
#10

Quote:
Originally Posted by zPain
Посмотреть сообщение
With all due respect, that's preposterous.
Indeed.

I have no other leads to what the issue is.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)