Password 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: Password problem (
/showthread.php?tid=313398)
Password problem -
Bogdan1992 - 25.01.2012
Well, i don't know why when i type my/everyone password wrong, next time , even if i write it correctly the server still kicks me for wrong password.
PHP код:
if(dialogid == 15500) //Dialog login
{
if(!response)
{
Kick(playerid);
}
if(response)
{
if(Wrongpass[playerid] >= 1)
{
GetPlayerName( playerid, Nam, sizeof Nam );
format( mystring, sizeof mystring, "Admin-Log: %s has been kicked for wrong password.", Nam);
SendAdminMessage( COLOR_WHITE, mystring);
SendClientMessage(playerid, COLOR_RED, "You have been kicked for wrong password.");
Kick(playerid);
}
ShowPlayerDialog(playerid, 15500+1, DIALOG_STYLE_MSGBOX, "{FFFFFF}Rules!", "{00FFFF}Server rules!\n\n{FFFFFF}- Do not deathmatch unless an admin has started a DM event or anything similar to that.\n{FFFFFF}- Don't spam/flood the server chat.\n- Don't insult people.\n{FFFFFF}- Don't go around and annoy people that is drifting. (eg ramming)\n\n{00FFFF}By clicking the Ok button you will agree with those terms.","Ok","");
new query[200], pnamez[24], escapepass[100];
GetPlayerName(playerid, pnamez, 24);
mysql_real_escape_string(inputtext, escapepass);
format(query, sizeof(query), "SELECT `user` FROM playerdata WHERE user = '%s' AND password = SHA1('%s')", pnamez, escapepass);
mysql_query(query);
mysql_store_result();
new numrows = mysql_num_rows();
if(numrows == 1) MySQL_Login(playerid);
if(!numrows)
{
new strz[182];
GetPlayerName(playerid,pname,sizeof(pname));
format(strz,sizeof(strz), "{00FFFF}Account: {FFFFFF}%s\n\n{FF0000}ERROR: {FFFFFF}You have entered an invalid password.\n\n{FFFFFF}Type your password below in order to login.",pname);
ShowPlayerDialog(playerid, 15500, DIALOG_STYLE_PASSWORD, "{FFFFFF}Login", strz,"Login","Quit");
Wrongpass[playerid]++;
}
mysql_free_result();
}
}
Re: Password problem -
milanosie - 25.01.2012
what is your password saving, registering and login code
Re: Password problem -
Bogdan1992 - 25.01.2012
You really dont need the rest of the code.
Worked good until i added the wrongpass variable.
Re: Password problem -
milanosie - 25.01.2012
ofcourse we do, We need to know if you use a whirlpool or anything like that.
Also, did you place
when a player enters the right password?
Re: Password problem -
Bogdan1992 - 25.01.2012
I dont use whirlpool.
And yes.
Re: Password problem -
Vince - 25.01.2012
That's because that if structure will return true if the 'WrongPass' variable is greater than,
or equal to 1. Either change that 1 to 2 or change your >= to just >.
Re: Password problem -
Bogdan1992 - 25.01.2012
Thanks Vince.