Dialog Register Help
#1

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register - Los Santos Battlefields",""cgreen"Your Account is Unregistered!\nPlease type your password here to Register!","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",50000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Hours",0);
                INI_WriteInt(File,"Minutes",0);
                INI_WriteInt(File,"Seconds",0);
                INI_WriteInt(File,"Scores",0);
                INI_WriteInt(File,"VIP",0);
                INI_Close(File);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You're succesfully creating an password!\nPlease dont give your password to anyone if you dont want to be hacked!\nPlease write your password on a note to remember it!","Ok","");
            }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login - Los Santos Battlefield",""cgreen"Your Account is Registered!\nPlease type your password here to Login!","Login","Quit");
                }
                return 1;
            }
        }
    }
    return 1;
}
Error
Код:
(937) : warning 217: loose indentation
(954) : warning 217: loose indentation
(954) : error 014: invalid statement; not in switch
(954) : warning 215: expression has no effect
(954) : error 001: expected token: ";", but found ":"
(954) : error 029: invalid expression, assumed zero
(954) : fatal error 107: too many error messages on one line
Reply
#2

which line has error?!
Reply
#3

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register - Los Santos Battlefields",""cgreen"Your Account is Unregistered!\nPlease type your password here to Register!","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",50000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Hours",0);
                INI_WriteInt(File,"Minutes",0);
                INI_WriteInt(File,"Seconds",0);
                INI_WriteInt(File,"Scores",0);
                INI_WriteInt(File,"VIP",0);
                INI_Close(File);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You're succesfully creating an password!\nPlease dont give your password to anyone if you dont want to be hacked!\nPlease write your password on a note to remember it!","Ok","");
            }
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login - Los Santos Battlefield",""cgreen"Your Account is Registered!\nPlease type your password here to Login!","Login","Quit");
                }
                return 1;
            }
    }
    return 1;
}
Reply
#4

It still error >> case DIALOG_LOGIN: <<
Reply
#5

PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
        if(
dialogid == DIALOG_REGISTER)
        {
            if (!
response) return Kick(playerid);
            if(
response
            {
            if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT,"Register - Los Santos Battlefields",""cgreen"Your Account is Unregistered!\nPlease type your password here to Register!","Register","Quit");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",50000);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_WriteInt(File,"Hours",0);
                
INI_WriteInt(File,"Minutes",0);
                
INI_WriteInt(File,"Seconds",0);
                
INI_WriteInt(File,"Scores",0);
                
INI_WriteInt(File,"VIP",0);
                
INI_Close(File);
                
SpawnPlayer(playerid);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You're succesfully creating an password!\nPlease dont give your password to anyone if you dont want to be hacked!\nPlease write your password on a note to remember it!","Ok","");
            
            }
        }
        if(
dialogid == DIALOG_LOGIN)
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You have successfully logged in!","Ok","");
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_INPUT,"Login - Los Santos Battlefield",""cgreen"Your Account is Registered!\nPlease type your password here to Login!","Login","Quit");
                }
                return 
1;
            }
        }
    }
    return 
1;

i think it can help you

if it didn't work tell me how did you define DIALOG_LOGIN
Reply
#6

Still error : (937) : warning 217: loose indentation
(954) : warning 209: function "S@@_OnDialogResponse" should return a value
(955) : error 010: invalid function or declaration
(957) : error 010: invalid function or declaration
(95 : error 010: invalid function or declaration
(960) : error 010: invalid function or declaration
(962) : error 021: symbol already defined: "INI_ParseFile"
(962) : error 017: undefined symbol "playerid"
(962) : error 010: invalid function or declaration
(962 -- 966) : fatal error 107: too many error messages on one line
Reply
#7

Problem with the brackets.

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) Kick(playerid);
            else
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT,"Register - Los Santos Battlefields",""cgreen"Your Account is Unregistered!\nPlease type your password here to Register!","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",50000);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Hours",0);
                INI_WriteInt(File,"Minutes",0);
                INI_WriteInt(File,"Seconds",0);
                INI_WriteInt(File,"Scores",0);
                INI_WriteInt(File,"VIP",0);
                INI_Close(File);
                SpawnPlayer(playerid);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You're succesfully creating an password!\nPlease dont give your password to anyone if you dont want to be hacked!\nPlease write your password on a note to remember it!","Ok","");
            }
            return 1;
        }
        case DIALOG_LOGIN:
        {
            if ( !response ) Kick ( playerid );
            else
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,"Account Access!",""cgreen"You have successfully logged in!","Ok","");
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"Login - Los Santos Battlefield",""cgreen"Your Account is Registered!\nPlease type your password here to Login!","Login","Quit");
                }
            }
            return 1;
        }
    }
    return 1; // returning 0 will allow other scripts to search for the dialogid if not found here.
}
Reply
#8

loate the line 962 962. so we can fix it
Reply
#9

Type here Your includes
Reply
#10

Anyway can you help me :
pawn Код:
CMD:setlevel(playerid, params[])
{
    new id, level, n[MAX_PLAYER_NAME], str[128];
    if (!IsPlayerAdmin(playerid)) return SendClientMessage(playerid, COLOR_GREEN, "{FF0000}[Set-Level]: {FFFFFF}You're not RCON Staffs !");
    if (sscanf(params, "dd", id, level)) return SendClientMessage(playerid, COLOR_GREEN, "{FF0000}[Set-Level]: {FFFFFF}/setlevel <ID> <Level>");
    if (!IsPlayerConnected(id)) return SendClientMessage(playerid, COLOR_GREEN, "{FF0000}[Set-Level]: {FFFFFF}You have entered an incorrect ID");
    GetPlayerName(id, n, MAX_PLAYER_NAME);
    PlayerInfo[id][pAdmin] = level;
    INI_WriteInt(file,"Admin", level);
    format(str, 128, "You have set %s's level to %d", n, level);
    SendClientMessage(playerid, COLOR_GREEN, str);
    return 1;
}
(1063) : error 017: undefined symbol "file"
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)