#1

Hello!
I am using 1admin system.When a player connect then the login box will appear and 2 options will be there "Login" & "Quit"

I want when the player click "Quit" then he should get kick from the server

Here is the code

pawn Код:
public OnPlayerConnect(playerid){
    new logstring[256];
    format(logstring,256,"Welcome back \n\n '%s 'is already Registered!\n Login to access your Account",pName(playerid));
    ShowPlayerDialog(playerid,DIALOGID0+2,DIALOG_STYLE_INPUT,"Login Account",logstring,"Login","Quit");
    return 1}
OnDialogResponse

pawn Код:
if(dialogid == DIALOGID0+2){
        if(response)
        {
            cmd_login(playerid,inputtext);
            if (PlayerInfo[playerid][LoggedIn] == 1) {
            SendClientMessage(playerid, 0x32CD32AA,"* Login Successfull... Welcome Back !");
            return 1;}
            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),"|- You have Successfully Logged! | Level %d -|", PlayerInfo[playerid][Level]);
                    SendClientMessage(playerid,green,string);

                } else return SendClientMessage(playerid,green,"|- You have Successfully logged! -|");
            }
            return  ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Password", "WRONG Password, Try Again", "OK", "Cancel");
        }
        return 1;}
Reply
#2

pawn Код:
// I hope this works!
    if(dialogid == DIALOGID0+2)
    {
        if(response)
        {
            cmd_login(playerid,inputtext);
            if (PlayerInfo[playerid][LoggedIn] == 1)
            {
                SendClientMessage(playerid, 0x32CD32AA,"* Login Successfull... Welcome Back !");
                return 1;
            }
            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),"|- You have Successfully Logged! | Level %d -|", PlayerInfo[playerid][Level]);
                    SendClientMessage(playerid,green,string);

                }
                else
                {
                    SendClientMessage(playerid,green,"|- You have Successfully logged! -|");
                }
            }
            else
            {
                ShowPlayerDialog(playerid, DIALOGID0+2, DIALOG_STYLE_INPUT,"Password", "WRONG Password, Try Again", "OK", "Cancel");
            }
        }
        else
        {
            SendClientMessage(playerid,green,"You have choosen to not login!");
            Kick(playerid);
        }
        return 1;
    }
Reply
#3

pawn Код:
if(!response) return Kick(playerid);
Reply
#4

First of all, for the love of god...decrease the size of your babatz string.
Secondly, use if(response == 1) for the login button and else for the quit button.
Thirdly, check your brackets.

Start with these three things.
Reply
#5

Worked! ty dude +rep
Reply
#6

Thanks, and Anytime.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)