SA-MP Forums Archive
Help with this one - 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: Help with this one (/showthread.php?tid=403545)



Help with this one - Safe - 30.12.2012

My problem is

when i put an emty text on the dialog
it will accept and will let the player log in help me
but when i put a wrong password it will not accept


pawn Код:
public OnPlayerLogin(playerid,pasword[])
{
    new attemts = 3;
    if(!strcmp(pasword,pData[playerid][pPass]))
    {
        SendClientMessage(playerid,C_WHITE,"Welcome Back");
        INI_ParseFile(pFiles(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
    }
    else
    {
        attemts -= 1;
        new l_msg[500];
        format(l_msg,sizeof(l_msg),"Welcome Back "CGREEN"%s"CWHITE" This Account is registred \nPlease Enter your password to login \n\n "CRED"[ Error ]: You have entered a invalid password \n you have %d more attemts left",pName(playerid),attemts);
        ShowPlayerDialog(playerid,D_LOGIN,PASSWORD,servername(),l_msg,"login","cancel");
        if(attemts == 0 )
        {
            return BotKick(playerid,"Failure to Login");
        }
    }
    return 1;
}



Re: Help with this one - RedCrossER - 30.12.2012

Add this line in onplayerdialog response
pawn Код:
if(inputtext < 3) return sentclientmessage(playerid, color , "password must more than 3 letters");



Re: Help with this one - Threshold - 30.12.2012

or:
pawn Код:
if(!strlen(inputtext)) return SendClientMessage(playerid, 0xFF0000FF, "You must enter a password!");
//Also kick player if you want, unless it's already included