Login screen attempt tries - 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 screen attempt tries (
/showthread.php?tid=607855)
Login screen attempt tries -
Johny32 - 24.05.2016
Tittle is clear, so I made a script it requires the user to login everything works fine!
The problem is, let's say that I type the wrong password, my server will kick me I want to make some wrong password attempt tries so the user gets kicked after 3 wrong tries!
I can post any codes that you may need and I will rep the best answer ty.
Re: Login screen attempt tries -
Stinged - 24.05.2016
Код:
new gAttempts[MAX_PLAYERS]; // A global array to store how many attempts the player has had
// When the player enters his password
// CHECK IF IT WAS INCORRECT
{
gAttempts[playerid]++; // Adds 1 to the attempts count
If (gAttempts[playerid] == 3) return Kick(playerid); // If the attempts equal 3, it kicks
ShowPlayerDialog(Your incorrect dialog here)
}
Don't forget to reset gAttempts[playerid] (set it to 0) when the player connects or disconnects.
Re: Login screen attempt tries -
oMa37 - 24.05.2016
PHP код:
// Top of script
new Attempts [MAX_PLAYERS];
// In your code
Attempts[playerid]++;
if(Attempts [playerid] == 3) {
Attempts[playerid] = 0;
Kick(playerid);}
Re: Login screen attempt tries -
Johny32 - 24.05.2016
Thanks both of these work fine, repped ya guys for your fast support!