16.02.2012, 13:18
pawn Код:
case DIALOG_LOGIN:
{
if(!response) Kick(playerid);
new iStr[128],Tries;
switch(Tries)
{
case 3:
{ // 3 tries = kick
GetPlayerName(playerid,pname,sizeof(pname));
format(iStr,sizeof(iStr),"%s has been kicked for exceeding login tries.",pname);
SendClientMessageToAll(red,iStr);
return Kick(playerid);
}
case 0:
{
if(!strlen(inputtext))
{
Tries++;
format(iStr,sizeof(iStr),"Please enter your password. Tries: %i/3",Tries);
return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"Login",iStr,"Login","Leave");
}
if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
{
pLogged[playerid] = 1;
SendClientMessage(playerid,white,"You've successfully logged in.");
SetPlayerScore(playerid,PlayerInfo[playerid][pScore]); //Loading player score
GivePlayerMoney(playerid,PlayerInfo[playerid][pCash]); //Loading player money
}
else
{
Tries++;
format(iStr,sizeof(iStr),"Incorrect password.(you will see your password now) Tries: %i/3",Tries);
return ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"LOGIN",iStr,"Login","Leave");
}
}
}
also if anything else is wrong please correct me