Scripting Help -
TheRandomManUK - 17.10.2014
Please can you help me so i cn make it so you have to enter your password correctly in 3 attempts then it kicks you, but at the minute if you enter the wrong pass it kicks you
case LOGIN_MENU:
{
new f[40], string[150];
format(f, sizeof(f), USER_FILE, GetName(playerid));
if(!strlen(inputtext)) return SendClientMessage(playerid, RED, "You MUST provide a password.") && Kick(playerid);
else if(!response) return SendClientMessage(playerid, RED, "You MUST login before you can spawn.") && Kick(playerid);
{
new buf[129];
WP_Hash(buf, sizeof (buf), inputtext);
if(strcmp(buf, PlayerInfo[playerid][pPass], false) != 0)
{
SendClientMessage(playerid, RED, "Incorrect password.");
format(string, sizeof(string), "%s [%d] has been kicked from CCNR - Reason: Incorrect password", GetName(playerid), playerid);
SendClientMessage(playerid, RED, string);
Kick(playerid);
return 1;
}
else
{
Re: Scripting Help -
TheRandomManUK - 17.10.2014
Can Someone Help me Please?
Re: Scripting Help -
AnnaSB - 17.10.2014
At the top of your script add:
pawn Код:
new LoginAttempts[MAX_PLAYERS];
Inside
OnPlayerConnect in first lines, add this:
pawn Код:
LoginAttempts[playerid] = 0;
Now the code you used:
pawn Код:
if(strcmp(buf, PlayerInfo[playerid][pPass], false) != 0)
{
SendClientMessage(playerid, RED, "Incorrect password.");
if(LoginAttempts[playerid] == 3)
{
format(string, sizeof(string), "%s [%d] has been kicked from CCNR - Reason: Incorrect password", GetName(playerid), playerid);
SendClientMessage(playerid, RED, string);
Kick(playerid);
}
else
{
LoginAttempts[playerid]++;
// Create the same dialog box here again.
}
return 1;
}
Also use [pawn] tags for codes, for easier reading.
Hope I helped ^^