Limiting to 6 digits. Bank system.
#1

Hello. Actualy i am createing a bank system. All work right, and you can /createaccount [Number][Pin] but i want Number to be max 6 digits, and pin to be max 4 digits. How to make that?

This isn't working:
pawn Код:
if(pin >= 0001 && pin <= 9999)
                {
                    if(number >= 0 && number <= 999999)
                    {
Reply
#2

Make sure that you put it AFTER the sscanf part,
Reply
#3

pawn Код:
CMD:createaccount(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 10.0,10.0,10.0) || IsPlayerInRangeOfPoint(playerid, 10.0, 10.0,10.0,10.0))
    {
        new number, pin;
        if(!sscanf(params, "dd", number, pin))
        {
            if(PlayerInfo[playerid][Bank] < 3)
            {
                if(pin >= 0001 && pin <= 9999)
                {
                    if(number >= 0 && number <= 999999)
                    {
                        format(file, sizeof(file), "bank/%d.ini", number);
                        if(!dini_Exists(file))
                        {
                                             //Stuff here
                                                }
                        else return SendClientMessage(playerid, 0xFFFFFFFF, "This Bank account already exists!");
                    }
                    else return SendClientMessage(playerid, 0xFFFFFFFF, "the account number can only have 6 numbers!");
                }
                else return SendClientMessage(playerid, 0xFFFFFFFF, "Your PIN code can only have 4 digits!");
            }
            else return SendClientMessage(playerid, 0xFFFFFFFF, "You can have 3 accounts only.");
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createaccount [Account Number] [Account Pin]");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not at the bank!");
}
Reply
#4

may we know what the command retiurns when creating a bank account?
is this working? does it stop before/after this?
pawn Код:
if(PlayerInfo[playerid][Bank] < 3)
it would help a lot if we know where the command stops working
Reply
#5

AS I said, I made this code for him. it worked all fine in my script..
Reply
#6

Quote:
Originally Posted by Babul
Посмотреть сообщение
awesome. 98476598374534875 users can reply at the same time, but sometimes we need to wait 2 minutes WTF
Your reply doesn't really help in anything... xD
Reply
#7

well, its just a good code, and it should be completly working
Reply
#8

Yeah.. Just, it isn't. Hehe.
Reply
#9

pawn Код:
CMD:createaccount(playerid, params[])
{
    if(IsPlayerInRangeOfPoint(playerid, 10.0, 10.0,10.0,10.0) || IsPlayerInRangeOfPoint(playerid, 10.0, 10.0,10.0,10.0))
    {
        new number, pin;
        if(!sscanf(params, "dd", number, pin))
        {
SendClientMessage(playerid,0xffffffff,"sscan2 works");
            if(PlayerInfo[playerid][Bank] < 3)
            {
SendClientMessage(playerid,0xffffffff,"bank<3");
                if(pin >= 0001 && pin <= 9999)
                {
SendClientMessage(playerid,0xffffffff,"pin ok");
                    if(number >= 0 && number <= 999999)
                    {
SendClientMessage(playerid,0xffffffff,"number ok");
                        format(file, sizeof(file), "bank/%d.ini", number);
                        if(!dini_Exists(file))
                        {
SendClientMessage(playerid,0xffffffff,"file existing");
                                             //Stuff here
                                                }
                        else return SendClientMessage(playerid, 0xFFFFFFFF, "This Bank account already exists!");
                    }
                    else return SendClientMessage(playerid, 0xFFFFFFFF, "the account number can only have 6 numbers!");
                }
                else return SendClientMessage(playerid, 0xFFFFFFFF, "Your PIN code can only have 4 digits!");
            }
            else return SendClientMessage(playerid, 0xFFFFFFFF, "You can have 3 accounts only.");
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /createaccount [Account Number] [Account Pin]");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "You are not at the bank!");
}
i wont tell you how many commented lines like those my gamemode has, cant count them ^^
Reply
#10

Still, it let me /createaccount 1 1
Lol. Don't know why this happen.
It limits the max, but not the min.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)