Dialog is not showing
#1

The Dialog is not showing when I connect...

PHP код:
public OnUserCheck(playerid)
{
    new 
num_rowsnum_fields;
    
cache_get_data(num_rowsnum_fieldsdbhandle);
    if(
num_rows == 0)
    {
        
// Register
        
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register""Typ a password to register""Register""Leave");
    }
    else
    {
        
// Login
       // ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Login", "Fill your password to register", "Login", "Leave");
    
}
    return 
1;

PHP код:
if(dialogid==DIALOG_REGISTER)
    {
        if(
response)
        {
            new 
pName[MAX_PLAYER_NAME], query[100], password[35];
            
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
            if(
strlen(inputtext) >= 3)
            {
                
mysql_escape_string(inputtextpassworddbhandle);
                
format(querysizeof query"INSERT INTO accounts (username, password) VALUES ('%s', '%s')"pNamepassword);
                
mysql_function_query(dbhandlequeryfalse"""");
            }
            else
            {
                 
SendClientMessage(playeridCOLOR_RED"Error: Minimum password length is 3 characters!");
                   
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"Register""Typ a password to register""Register""Leave");
            }
        }
        else
        {
            
Kick(playerid);
        }
    } 
Reply
#2

Sorry for this question, but did you make sure that you compiled the code?
Reply
#3

Yeah, lol. I can understand it why you are asking it, because there is nothing strange to my code... But somehow it doesn't show up
Reply
#4

If you've already registered, there's no code to display login dialog. You must also note that your dialog ID can hold a maximum value of 32767. Show us your user account check query if what I mentioned isn't the problem.
Reply
#5

Did you actually call this: 'OnUserCheck(playerid)' under OnPlayerConnect or OnPlayerRequestClass or something?
Reply
#6

I made a new callback
PHP код:
public OnUserCheck(playerid
And @Lordzy, No I haven't even registered, so the dialog should actually pop up.
and the Dialog id is defined as number 1.
I don't really understood what you meant with "Show us your user account check query if what I mentioned isn't the problem."
Reply
#7

Quote:
Originally Posted by Stanford
Посмотреть сообщение
Did you actually call this: 'OnUserCheck(playerid)' under OnPlayerConnect or OnPlayerRequestClass or something?
Did you do this or not?
Reply
#8

Quote:
Originally Posted by rappy93
Посмотреть сообщение
Did you do this or not?
No, I just made a new callback under nothing. just the callback itself
Reply
#9

Put this at the end of OnPlayerConnect:

PHP код:
new query[256],pName[MAX_PLAYER_NAME];
GetPlayerName(playeridpNameMAX_PLAYER_NAME);
format(querysizeof query"SELECT * FROM accounts WHERE username = '%s'"pName);
mysql_function_query(dbhandlequerytrue"OnUserCheck""i"playerid); 
Reply
#10

Add this under OnPlayerConnect.

Код:
OnUserCheck(playerid);
Reply
#11

Aaight thank you man, I just had to put
PHP код:
OnUserCheck(playerid); 
under OnPlayerConnect. rep+
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)