Registering Password [HELP] +REP
#1

i use Login and Register System - Dialogs - Using Y_INI ( https://sampforum.blast.hk/showthread.php?tid=273088 )

how can i make the server will give it a error like this? : You password must more than 6 character!

if i put 3 digit of password it will give me that error. how to that?
Reply
#2

In OnDialogResponse, use
Код:
if(strlen(inputtext) < 6)
To check if inputtext's length is smaller than 6.
Reply
#3

So this is the script.. where to put it?

Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                GivePlayerMoney(playerid, 500);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME!",""COL_WHITE"Welcome! Please use {F81414}/CMDS {FFFFFF}if you need server's helps.","Ok","");
			}
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
					ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME BACK!",""COL_WHITE"Your {00FF22}stats {FFFFFF}has been automaticlly loaded!","Ok","");
					PlayerPlaySound(playerid, 1052, 1310.0979, -1380.9642, 13.7142);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"LOGIN",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to log in.","Done","Quit");
                    PlayerPlaySound(playerid, 1053, 1310.0979, -1380.9642, 13.7142);
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply
#4

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_PASSWORD, ""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
if(strlen(inputtext) < 6) return SendClientMessage(playerid, Your_color, "Your password must contain more than 6 letters"); // and then show the dialog again...correct me if m wrong.
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                GivePlayerMoney(playerid, 500);
                ShowPlayerDialog(playerid, DIALOG_SUCCESS_1, DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME!",""COL_WHITE"Welcome! Please use {F81414}/CMDS {FFFFFF}if you need server's helps.","Ok","");
            }
        }

        case DIALOG_LOGIN:
        {
            if ( !response ) return Kick ( playerid );
            if( response )
            {
                if(udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
                    GivePlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME BACK!",""COL_WHITE"Your {00FF22}stats {FFFFFF}has been automaticlly loaded!","Ok","");
                    PlayerPlaySound(playerid, 1052, 1310.0979, -1380.9642, 13.7142);
                }
                else
                {
                    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"LOGIN",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to log in.","Done","Quit");
                    PlayerPlaySound(playerid, 1053, 1310.0979, -1380.9642, 13.7142);
                }
                return 1;
            }
        }
    }
    return 1;
}
Reply
#5

not working yet.

after i put 3 digit pass on it to see what happen...

it show me to selection skins and the message appeared top left screen "Your password must contain more than 6 letters"


any ideas?
Reply
#6

Try this:
PHP код:
public OnDialogResponse(playeriddialogidresponselistiteminputtext[])
{
    switch( 
dialogid )
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
                if(
strlen(inputtext) < 6)
                {
                     
SendClientMessage(playeridYour_color"Your password must contain more than 6 letters"); // and then 
                     
ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_PASSWORD""COL_WHITE"REGISTRATION",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to register.","Proceed","Cancel");
                     return 
1;
                }
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
GivePlayerMoney(playerid500);
                
ShowPlayerDialog(playeridDIALOG_SUCCESS_1DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME!",""COL_WHITE"Welcome! Please use {F81414}/CMDS {FFFFFF}if you need server's helps.","Ok","");
            }
        }
        case 
DIALOG_LOGIN:
        {
            if ( !
response ) return Kick playerid );
            if( 
response )
            {
                if(
udb_hash(inputtext) == PlayerInfo[playerid][pPass])
                {
                    
INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra true, .extra playerid);
                    
GivePlayerMoney(playeridPlayerInfo[playerid][pCash]);
                    
ShowPlayerDialog(playeridDIALOG_SUCCESS_2DIALOG_STYLE_MSGBOX,""COL_WHITE"WELCOME BACK!",""COL_WHITE"Your {00FF22}stats {FFFFFF}has been automaticlly loaded!","Ok","");
                    
PlayerPlaySound(playerid10521310.0979, -1380.964213.7142);
                }
                else
                {
                    
ShowPlayerDialog(playeridDIALOG_LOGINDIALOG_STYLE_PASSWORD,""COL_WHITE"LOGIN",""COL_RED"The password you entered is incorrect.\n"COL_WHITE"Please enter a {00FF22}password {FFFFFF}below in order to log in.","Done","Quit");
                    
PlayerPlaySound(playerid10531310.0979, -1380.964213.7142);
                }
                return 
1;
            }
        }
    }
    return 
1;

Reply
#7

Thanks! It's fixed now.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)