Login problem - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Login problem (
/showthread.php?tid=439289)
Login problem -
DerickClark - 24.05.2013
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;
}
Re: Login problem -
DerickClark - 25.05.2013
/bump 1 day.
still haveing problem.
Re: Login problem -
Abhishek. - 25.05.2013
i got login problem.if the player reach 3
warns.don't get kicked? But how
just dont kick ?
whats the problem
Re: Login problem -
DobbysGamertag - 25.05.2013
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?
Re: Login problem -
DerickClark - 25.05.2013
Yes.dont kick the player after 3 warns.
Re: Login problem -
DobbysGamertag - 25.05.2013
i was wrong here.
Re: Login problem -
Abhishek. - 25.05.2013
he said dont kick read the topic
Re: Login problem -
DerickClark - 25.05.2013
Where i put dis code?
Re: Login problem -
DobbysGamertag - 25.05.2013
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.
Re: Login problem -
DerickClark - 25.05.2013
Where i put the code at
in
Dialog_Login(playerid?