// 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; }
// 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;
}
// 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;
}
Try This
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;
}
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
if (tryhard[playerid] == 3) return tryhard[playerid] = 0 /* the playerid hee needs to be in square brackets*/, Kick(playerid);