3 wrong Passwords = Kick?
#1

Hello, how can i make in my register/login system, that when an user typed 3 wrong passwords that he get kicked then?
Reply
#2

Better if you show your codes so we can add to it.
Anyway, you'll need to add something like this:
pawn Код:
new NumAttempt[MAX_PLAYERS];
NumAttempt[playerid] ++;
if(NumAttempt[playerid] == 3)
{
SendClientMessage(playerid, -1,"You have typed your password wrong 3 times and got kicked by the server!");
Kick(playerid);
return 1;
}
Hope it helped.
Reply
#3

Ontop add this variable,
new Attempts[MAX_PLAYERS];

Then under your wrong login attempt dialog add this
Attempt[playerid] ++1;
if(Attempt[playerid] == 3) kick(playerid);

Oh yeah and under OnPlayerConnect add Attempt[playerid] = 0;
Reply
#4

At OnDialogResponse or OnPlayerConnect?
Reply
#5

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
Better if you show your codes so we can add to it.
Anyway, you'll need to add something like this:
pawn Код:
new NumAttempt[MAX_PLAYERS];
NumAttempt[playerid] ++1;
if(NumAttempt[playerid] == 3)
{
SendClientMessage(playerid, -1,"You have typed your password wrong 3 times and got kicked by the server!");
Kick(playerid);
return 1;
}
Hope it helped.
Wow, weak bro, you just edit your post and basicly copied my code.
Reply
#6

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
At OnDialogResponse or OnPlayerConnect?
You only need to add this under OnPlayerConnect - Attempt[playerid] = 0;
And the rest excluding the variable under your fail attempt dialog.
Reply
#7

new NumAttempt[MAX_PLAYERS];

"invalid functoin or decleration" Can you help me with that?
Reply
#8

Quote:
Originally Posted by JimmyCh
Посмотреть сообщение
NumAttempt[playerid] ++1;
Hope it helped.
The 1 should not be there.

Just:
PHP код:
NumAttempt[playerid] ++; 
Reply
#9

pawn Код:
//On the top of the script, with the other variables
new Attempt[MAX_PLAYERS];

//OnPlayerConnect
Attempt[playerid] = 0;

//OnDialogResponse, DIALOG_ID
Attempt[playerid] ++1;
if(Attempt[playerid] == 3) kick(playerid);
Reply
#10

Quote:
Originally Posted by ThePhenix
Посмотреть сообщение
The 1 should not be there.

Just:
PHP код:
NumAttempt[playerid] ++; 
Yea, it's my sluggish mistake, but the guy had to edit his post to copy my code. Thats the weakest thing you can pretty much do.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)