Login Dialog
#1

if(ServerInfo[MustLogin] == 1 && PlayerInfo[playerid][Registered] == 1 && PlayerInfo[playerid][LoggedIn] == 0)
I had a feeling that the thing above will be needed to do this

Could anyone show me how to create a dialog?
I want a dialog that you type in your password in, and clicks ok to login and a choise to choose quit instead and then getting kicked from the server.
Reply
#2

https://sampforum.blast.hk/showthread.php?tid=158858
Reply
#3

Wow thanks alot!
Reply
#4

I can't figure it out :/

Im doing as the tutorial says but the dialog doesnt show up..
Reply
#5

Try This
pawn Код:
// Open Dialog
ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_INPUT, "~ Title ~", "Put you phrase.", "Accept", "Noothing");


// In OnDialogResponse
if(dialogid == DIALOG_ID)
{
    if(response) // checks if player click in "Accept"
    {
        SendClientMessage(playerid, -1,"You Type: ");
        SendClientMessage(playerid, -1, inputtext); // inputtext is input.
    }
    if(!response) // check if player click in "Noothing"
    {
        SendClientMessage(playerid, -1, "NoothingNoothingNoothingNoothingNoothingNoothing");
    }

}
Reply
#6

Quote:
Originally Posted by DarkScripter
Посмотреть сообщение
Try This
pawn Код:
// Open Dialog
ShowPlayerDialog(playerid, DIALOG_ID, DIALOG_STYLE_INPUT, "~ Title ~", "Put you phrase.", "Accept", "Noothing");


// In OnDialogResponse
if(dialogid == DIALOG_ID)
{
    if(response) // checks if player click in "Accept"
    {
        SendClientMessage(playerid, -1,"You Type: ");
        SendClientMessage(playerid, -1, inputtext); // inputtext is input.
    }
    if(!response) // check if player click in "Noothing"
    {
        SendClientMessage(playerid, -1, "NoothingNoothingNoothingNoothingNoothingNoothing");
    }

}
The problem is that I want to make this so I can login using it.

Ive come so far:

pawn Код:
ShowPlayerDialog(playerid,67,DIALOG_STYLE_INPUT,"Login Account","The account '%s' is Registered!\nLogin to acces your Account:","Login","Quit");
but nothing happens when I click on it because I dont know how I should make the response thing.
I am using Lethal Admin.

Btw cant use the password looking one, Im using SA-MP 0.3c.
Reply
#7

pawn Код:
new str[128], nome[24]; GetPlayerName(playerid, nome, 24);
format(str, sizeof(str), "The account '%s' is Registered!\nLogin to acces your Account:", nome);
ShowPlayerDialog(playerid,67,DIALOG_STYLE_INPUT,"Login Account",str,"Login","Quit");
OnDialogResponse
pawn Код:
if(dialogid == 67)
Reply
#8

Here is my old OnDialogResponse, its broken see if you can find any problems with it:

pawn Код:
if(dialogid == DIALOGID+67)
    {
        if(response)
        {
            cmd_login(playerid,inputtext);
            if (PlayerInfo[playerid][LoggedIn] == 1) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: You are already logged in.");
            if (!udb_Exists(PlayerName2(playerid))) return SendClientMessage(playerid,COLOR_RED,"ACCOUNT: Account doesn't exist, please use '/register [password]'.");
            if (udb_CheckLogin(PlayerName2(playerid),inputtext))
            {
                new file[256], tmp3[100], lname[MAX_PLAYER_NAME];
                GetPlayerName(playerid,lname,sizeof(lname));
                format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(lname));
                GetPlayerIp(playerid,tmp3,100);
                dini_Set(file,"ip",tmp3);
                LoginPlayer(playerid);
                PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
                if(PlayerInfo[playerid][Level] > 0) {
                    format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
                    return SendClientMessage(playerid,green,string);
                } else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
            }
            return  ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Password", "WRONG Password, Try Again", "OK", "Cancel");
        }
        return 1;
    }
Edit:
You made my name appear on the dialog but still its not working.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)