login dialog help - 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 dialog help (
/showthread.php?tid=577544)
login dialog help -
SNAKE12 - 12.06.2015
hey samp forum i have a problem when player type a incorrect password he spaw whit out stats but i want that dialog login still repaly again and if it 3 time incorrect password will auto kick
this code under onplayerconnect:
Код:
if(PlayerInfo[playerid][LoggedIn] == 0)
{
ShowPlayerDialog(playerid, 125, DIALOG_STYLE_PASSWORD, "Login","This account is register!login please","Login","Kick");
}
and case 125:
Код:
case 125:
{
if(!response)
{
Kick(playerid);
}
if (udb_Exists(PlayerName2(playerid))) {
if (udb_CheckLogin(PlayerName2(playerid),inputtext))
{
new file[256], tmp3[100], string[128];
format(file,sizeof(file),"/ladmin/users/%s.sav",udb_encode(PlayerName2(playerid)) );
GetPlayerIp(playerid,tmp3,100);
dini_Set(file,"ip",tmp3);
LoginPlayer(playerid);
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
if(PlayerInfo[playerid][Level] > 0) {
format(string,sizeof(string),"ACCOUNT: Successfully Logged In. (Level %d)", PlayerInfo[playerid][Level] );
new text[128];
format(text, sizeof(text), "Promoted! Rank %s.", GetRankName(playerid));
SendClientMessage(playerid, COLOR_WHITE, text);
return SendClientMessage(playerid,green,string);
} else return SendClientMessage(playerid,green,"ACCOUNT: Successfully Logged In");
}
else {
PlayerInfo[playerid][FailLogin]++;
printf("LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)", PlayerName2(playerid),inputtext, PlayerInfo[playerid][FailLogin] );
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
{
new string[128]; format(string, sizeof(string), "%s has been kicked (Failed Logins)", PlayerName2(playerid) );
SendClientMessageToAll(red, string);
print(string);
Kick(playerid);
}
}
}
new string[200];
format(string, sizeof(string),""cwhite"Welcome "cred"%s "cwhite"you are already registered\nKindly enter password to login to your account\n"cred"Incorrect password!", PlayerName2(playerid));
ShowPlayerDialog(playerid, 125, DIALOG_STYLE_INPUT, "Login",string,"Login","Kick");
}
Re: login dialog help -
hamzajaved780 - 12.06.2015
Search you code for this define and change its value to the number of attempts you want
Or else replace this line
PHP код:
if(PlayerInfo[playerid][FailLogin] == MAX_FAIL_LOGINS)
with this
PHP код:
if(PlayerInfo[playerid][FailLogin] == 3)
Re: login dialog help -
SNAKE12 - 12.06.2015
ok but when i set incorrect password its contiue to the spawn i dont want to go to spawn i want to still show dialog untill 3 times.
Re: login dialog help -
hamzajaved780 - 12.06.2015
Show me some more of your code with proper indentation
Re: login dialog help -
hamzajaved780 - 12.06.2015
Does it prints this when password is incorrect
PHP код:
LOGIN: %s has failed to login, Wrong password (%s) Attempt (%d)