Dialog disconnect
#1

How can i make "Cancel" button to disconnect player from the server on login/register dialogs?

And i also made a little code to make "<" ">" "Spawn" button to dissapear, but is ther way to make it short like in 1-2 line?
pawn Код:
public OnPlayerRequestClass(playerid, classid)
{
    SetSpawnInfo( playerid, 0, 0, 1958.33, 1343.12, 15.36, 269.15, 26, 36, 28, 150, 0, 0 );
    if(JustLogged[playerid] == 1)
    {
        SpawnPlayer(playerid);
    }
    else
    {
        TogglePlayerSpectating(playerid, 1);
    }
    return 1;
}
I need to get "Cancel" button to close connection, cuz if i hit this button and later logging in, it spawns with Spectating view, and it's annoying

EDIT:

As i didn't get any answers so far, i tought maybe it's better to put dialog also...
pawn Код:
if(dialogid == DIALOG_LOGIN)
    {
        if(!response)
        {
                SendMessage(playerid, "~r~Error: ~w~You must login before you spawn!");
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
        }
        if(response)
        {
            new query[200], pname[24], escapepass[100];
            GetPlayerName(playerid, pname, 24);
            mysql_real_escape_string(inputtext, escapepass);
            format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')", pname, escapepass);
            mysql_query(query);
            mysql_store_result();
            new numrows = mysql_num_rows();
            if(numrows == 1) MySQL_Login(playerid);
            if(!numrows)
            {
                ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
                SendMessage(playerid, "~r~Error: ~w~Incorrect password!");
            }
            mysql_free_result();
        }
    }
pawn Код:
if(IsRegistered[playerid] == 1)
        {
            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
            return 0;
        }
Reply
#2

Well, actualy why you make it spec when he hit disconnect? xD
But the solution is deleting the "Cancel" text.. Replace your ShowDialog with:

I will comment on the end of script with // to explain what i did. Just check it.

This one with:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "");//Keep the "".
And this one with:
pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "Cancel");
pawn Код:
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""Blue"Please log-in", ""White"Welcome back to "Red""SERVER_NAME""White"!\n"White"In order to start playing, you have to log-in!\n\n"White"Please insert "Red"your"White" password below:", "Login", "");//It was like: "Login", "Cancel");   Just deleted the cancel, but let the "". Now you know how to do it, so do it everywhere you want.
Also you didn't get an answer cos it's still too early for forum most active/helpful people.
Reply
#3

Under OnDialogResponse(or whatever it was.. Im on my phone now) add:
Код:
if(dialogid== LoginDialog)
{
if(!response)
{
Kick(playerid);
}
else
{
//Do what you want to do when he presses the Login button
}
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)