Understanding y_ini.
#1

So i want to learn y_ini, because i heard it's the fastest one. So i need a little help from you.
pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_LIST, "Login", "Write password below", "Login", "Kick");
            }
            if(fexist(accname))
            {
                INI_Load(accname);
                if(HOW TO CHECK IF "PASSWORD" FROM FILE IS SAME AS THE INPUTTEXT)
                {
                    SendClientMessage(playerid, COLOUR_INFO, "Here functions of login etc.");
                }
                else
                {
                    Kick(playerid);
                }
            }
        }
    }
    if(dialogid == DIALOG_REGISTER)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(strlen(inputtext) == 0)
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_LIST, "Registering", "Write password below", "Register", "Kick");
            }
            if(!fexist(accname))
            {
                new INI:Player = INI_Open(accname);
                INI_WriteString(Player, "PASSWORD", inputtext);
                INI_Close(Player);
            }
        }
    }
}
Any help?!
Reply
#2

I little search in the y_ini topic

Quote:
Originally Posted by Zh3r0
Посмотреть сообщение
pawn Код:
//Outside anything
//public to check the password and insert the value found at name Password.
forward ParsePass( playerid, name[], value[] );
public ParsePass( playerid, name[], value[] )
{
    if ( !strcmp( name, "Password" )) SetPVarString( playerid, "pPass", value );
}

//Command, or any function

//Parses Password from a file.
INI_ParseFile("myini.ini","ParsePass", .bExtra = true, .extra = playerid);

//Variable to store the pass
new pPass[ 129 ];

//Function to get the password inserted in the PVarString at the ParsePass public
GetPVarString( playerid, "pPass", pPass, sizeof (pPass) );

//Send message with the password.
new Str[ 129 ];
format( Str, sizeof (Str), "Your password: %s", pPass );
SendClientMessage( playerid, -1, Str );
Reply
#3

Thanks!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)