dialog login
#1

Код:
// Process the login-dialog
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)
{
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
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
Kick(playerid);
}
}
else
{
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
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 the player
Kick(playerid);
}
}
return 1;
}
how can I make you can go wrong password 3 times ago you out
Now if you're giving off the wrong password once and do not like
Reply
#2

pawn Код:
// At the top of your script:
new loginattempts[MAX_PLAYERS] = 0;

// Process the login-dialog
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)
                {
                    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
                    loginattempts[playerid] = 0;
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    if(loginattempts[playerid] == 3) Kick(playerid);
                    else loginattempts[playerid]++;
                }
            }
            else
            {
                SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                if(loginattempts[playerid] == 3) Kick(playerid);
                else loginattempt[playerid]s++;
            }
        }
       
        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 the player
            Kick(playerid);
        }
    }
    return 1;
}
Not compiled and NOT the best way to do it but it should do the trick...
Reply
#3

don't work
Reply
#4

Try This
pawn Код:
// At the top of your script:
new loginattempts[MAX_PLAYERS];

// Process the login-dialog
Dialog_Login(playerid, response, inputtext[])
{
   if(response == 1)
   {
    switch (listitem) // 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)
                {
                    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
                    loginattempts[playerid] = 0;
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    loginattempts[playerid]+1;
                    if(loginattempts[playerid] == 3) return Kick(playerid);
                   
                }
            }
            else
            {
                SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                loginattempt[playerid]+1;
                if(loginattempts[playerid] == 3) return Kick(playerid);
               
            }
        }
      }
      else
      {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
               // Kick the player
            Kick(playerid);
      }        
    }
    return 1;
}
EDIT: I do some changes again now copy and try
Reply
#5

Quote:
Originally Posted by IceBilizard
Посмотреть сообщение
Try This
pawn Код:
// At the top of your script:
new loginattempts[MAX_PLAYERS];

// Process the login-dialog
Dialog_Login(playerid, response, inputtext[])
{
   if(response == 1)
   {
    switch (listitem) // 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)
                {
                    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
                    loginattempts[playerid] = 0;
                }
                else
                {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    loginattempts[playerid]+1;
                    if(loginattempts[playerid] == 3) return Kick(playerid);
                   
                }
            }
            else
            {
                SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                loginattempt[playerid]+1;
                if(loginattempts[playerid] == 3) return Kick(playerid);
               
            }
        }
      }
      else
      {
            // Show a message that the player must be logged in to play on this server
            SendClientMessage(playerid, 0xFFFFFFFF, TXT_PlayerMustLogin);
               // Kick the player
            Kick(playerid);
      }        
    }
    return 1;
}
EDIT: I do some changes again now copy and try
don't work
Reply
#6

pawn Код:
// At the top of your script:
new loginattempts[MAX_PLAYERS];

// Process the login-dialog
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)
                {
                    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
                    loginattempts[playerid] = 0;
                }
                else
                {                    
                    if(loginattempts[playerid] >= 3) return Kick(playerid);
                    else {
                        SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                        loginattempts[playerid]++;
                    }
                }
            }
            else
            {
                if(loginattempts[playerid] >= 3) return Kick(playerid);
                else {
                    SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
                    loginattempts[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 the player
            Kick(playerid);
        }
    }
    return 1;
}
I think it will work... untested.
Reply
#7

Nooot work (
Reply
#8

pawn Код:
new tryhard[MAX_PLAYERS];
// Process the login-dialog
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)
{
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
{
tryhard[playerid]++;
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
if (tryhard[playerid] == 3) return tryhard(playerid) = 0, Kick(playerid);
}
}
else
{
tryhard[playerid]++;
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
if (tryhard[playerid] == 3) return tryhard(playerid) = 0, 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 the player
Kick(playerid);
}
}
return 1;
}
Reply
#9

Quote:
Originally Posted by ProjectMan
Посмотреть сообщение
pawn Код:
new tryhard[MAX_PLAYERS];
// Process the login-dialog
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)
{
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
{
tryhard[playerid]++;
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
if (tryhard[playerid] == 3) return tryhard(playerid) = 0, Kick(playerid);
}
}
else
{
tryhard[playerid]++;
SendClientMessage(playerid, 0xFFFFFFFF, TXT_WrongPassword);
if (tryhard[playerid] == 3) return tryhard(playerid) = 0, 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 the player
Kick(playerid);
}
}
return 1;
}
pawn Код:
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(64) : warning 217: loose indentation
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(65) : warning 217: loose indentation
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(67) : warning 217: loose indentation
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(71) : error 012: invalid function call, not a valid address
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(71) : warning 215: expression has no effect
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(71) : error 001: expected token: ";", but found ")"
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(71) : error 029: invalid expression, assumed zero
C:\Users\KyLLeR\Desktop\2.3\pawno\include\BJ_Dialogs.inc(71) : fatal error 107: too many error messages on one line
Linie 71 = if (tryhard[playerid] == 3) return tryhard(playerid) = 0, Kick(playerid);
#define TXT_PlayerMustLogin "{FF0000}You must login in order to play, you've been kicked out!"
snd
TXT_WrongPassword = Password incorect, kicked
Reply
#10

pawn Код:
if (tryhard[playerid] == 3) return tryhard[playerid] = 0 /* the playerid hee needs to be in square brackets*/, Kick(playerid);
Do the same with the other occasions you did this mistake with.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)