Login problem
#1

i got login problem.if the player reach 3 warns.don't get kicked? But how?

Код:
// The login dialog
#define TXT_DialogLoginTitle "Test Login" // Define the title-message on top of the login-dialog
#define TXT_DialogLoginMsg "Please login by entering your password:" // Define the actual message in the login-dialog
#define TXT_DialogLoginButton1 "Login" // Define the text on the "login" button for the login-dialog
#define TXT_LoggedIn "You logged in, welcome back to Test"
#define TXT_WrongPassword "You've entered the wrong password, you've been kicked"
#define TXT_LoginEnterValidPassword "Please login by entering your password:"
#define TXT_PlayerMustLogin "You must login in order to play, you've been kicked out!"
#define TXT_FailedLoginProperly "You failed to login properly, you're kicked"
Код:
// Process the login-dialog
#define MAX_FAIL_LOGINS 3
new FailLogin[MAX_PLAYERS];
Dialog_Login(playerid, response, inputtext[])
{
    switch (response) // Check which button was clicked
    {
        case 1: // Player clicked "Login"
        {
            // Check if the player entered a password
            if (strlen(inputtext) > 0)
            {
                // Check if the entered password is the same as the password saved in the player's account
                if (strcmp(APlayerData[playerid][PlayerPassword], inputtext, false) == 0)
                {
                    new string[128];
                    FailLogin[playerid]++;
                    format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
                    APlayerData[playerid][LoggedIn] = true; // The player has logged in properly
                    BankFile_Load(playerid); // Load your bank account (if it exists, the player will be notified about this)
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_LoggedIn); // Send a message to the client to inform him that he logged in properly
                }
                else
                {
                    new string[128];
                    FailLogin[playerid]++;
                    format(string, sizeof(string), "The password you have entered was incorrect. Attempts(%d)", FailLogin[playerid]);
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
     			    ShowPlayerDialog(playerid, DialogLogin, DIALOG_STYLE_INPUT, TXT_DialogLoginTitle, TXT_DialogLoginMsg, TXT_DialogLoginButton1, TXT_DialogButtonCancel);
                }
            }
            else
            {
            if(FailLogin[playerid] == MAX_FAIL_LOGINS)
            {
             new pname[MAX_PLAYER_NAME];
             GetPlayerName(playerid, pname, sizeof(pname));
             new string[128];
			 format(string, sizeof(string), "%s has been kicked (Failed Logins)",pname);
             SendClientMessageToAll(-1, string);
             Kick(playerid);
            }
            }
        }
        case 0: // Player clicked "Cancel"
        {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
            Kick(playerid);
        }
    }

    return 1;
}
Reply
#2

/bump 1 day.
still haveing problem.
Reply
#3

i got login problem.if the player reach 3
warns.don't get kicked? But how
just dont kick ?
whats the problem
Reply
#4

You want them to get kicked if they have 3 warns at any time? or kick them when they try to login? if it's the first one, you're looking in the wrong place.

Off topic: is this PPC Trucking?
Reply
#5

Yes.dont kick the player after 3 warns.
Reply
#6

i was wrong here.
Reply
#7

he said dont kick read the topic
Reply
#8

Where i put dis code?
Reply
#9

Oh sorry. Didn't read it properly. Forget what i said. Just remove this or change it accordingly

pawn Код:
if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
                        Kick(PlayerToWarn);
Example instead of kick:

pawn Код:
if ((APlayerData[PlayerToWarn][Warnings] == AutoKickWarnings) && (AutoKickAfterWarn == 1))
                        SendClientMessage(PlayerToWarn,-1,"3 warnings!,behave");
Or you can jail them

The above look for in the warn command.
Reply
#10

Where i put the code at


in
Dialog_Login(playerid?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)