SA-MP Forums Archive
Limiting to 6 digits. Bank system. - 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: Limiting to 6 digits. Bank system. (/showthread.php?tid=317597)



Limiting to 6 digits. Bank system. - ricardo178 - 11.02.2012

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)
                    {



Re: Limiting to 6 digits. Bank system. - milanosie - 11.02.2012

Make sure that you put it AFTER the sscanf part,


Re : Limiting to 6 digits. Bank system. - ricardo178 - 11.02.2012

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!");
}



Re: Limiting to 6 digits. Bank system. - Babul - 11.02.2012

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


Re: Limiting to 6 digits. Bank system. - milanosie - 11.02.2012

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


Re : Re: Limiting to 6 digits. Bank system. - ricardo178 - 11.02.2012

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


Re: Limiting to 6 digits. Bank system. - milanosie - 11.02.2012

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


Re : Limiting to 6 digits. Bank system. - ricardo178 - 11.02.2012

Yeah.. Just, it isn't. Hehe.


Re: Limiting to 6 digits. Bank system. - Babul - 11.02.2012

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 ^^


Re : Limiting to 6 digits. Bank system. - ricardo178 - 11.02.2012

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