4-digits, how to count?
#1

Hello, I'm making a bank script, I now have a problem with the password creation.

First of all, how to check the amount of digits?
Second of all, why does it set my password to 54 when I wrote 646589865?

pawn Код:
if(dialogid == 5)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","Bank Selection Aborted","Exit","Exit");
            dini_Remove(Bankfile(PlayerInfo[playerid][pBankcreate]));
            return 1;
        }
        if(!IsNumeric(inputtext[0])) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        if(inputtext[0] < 4 && inputtext[0] > 4) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        dini_IntSet(Bankfile(PlayerInfo[playerid][pBankcreate]),"Password",inputtext[0]);
        new text[128];
        format(text,sizeof(text),"Congratulations! Your bank account has been successfully created with the Account ID: %d and Password: %d.",PlayerInfo[playerid][pBankcreate],inputtext[0]);
        ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,"Las Venturas Bank",text,"Finish","Exit");
        return 1;
    }
Reply
#2

pawn Код:
if(dialogid == 5)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","Bank Selection Aborted","Exit","Exit");
            dini_Remove(Bankfile(PlayerInfo[playerid][pBankcreate]));
            return 1;
        }
        if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        if(strlen(inputtext) != 4) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        new password = strval(inputtext);
        dini_IntSet(Bankfile(PlayerInfo[playerid][pBankcreate]),"Password",password);
        new text[128];
        format(text,sizeof(text),"Congratulations! Your bank account has been successfully created with the Account ID: %d and Password: %d.",PlayerInfo[playerid][pBankcreate],password);
        ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,"Las Venturas Bank",text,"Finish","Exit");
        return 1;
    }
Reply
#3

Use SSCANF: it's useful in this situation!
Reply
#4

Quote:
Originally Posted by MadeMan
Посмотреть сообщение
pawn Код:
if(dialogid == 5)
    {
        if(!response)
        {
            ShowPlayerDialog(playerid,10,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","Bank Selection Aborted","Exit","Exit");
            dini_Remove(Bankfile(PlayerInfo[playerid][pBankcreate]));
            return 1;
        }
        if(!IsNumeric(inputtext)) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        if(strlen(inputtext) != 4) return ShowPlayerDialog(playerid,11,DIALOG_STYLE_MSGBOX,"Las Venturas Bank","You must type a 4-digit password","Continue","Cancel");
        new password = strval(inputtext);
        dini_IntSet(Bankfile(PlayerInfo[playerid][pBankcreate]),"Password",password);
        new text[128];
        format(text,sizeof(text),"Congratulations! Your bank account has been successfully created with the Account ID: %d and Password: %d.",PlayerInfo[playerid][pBankcreate],password);
        ShowPlayerDialog(playerid,6,DIALOG_STYLE_MSGBOX,"Las Venturas Bank",text,"Finish","Exit");
        return 1;
    }
Thank you mate,
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)