Advanced sscanf usage?
#1

I need some help with this command..

pawn Код:
COMMAND:bank(playerid, params[]) {

    new
        BankAccountNum,
        BankAccountPIN,
        BankWithdrawAmount,
        BankDepositAmount,
        string[128];

    if(IsPlayerInRangeOfPoint(playerid, 3, 2447.6873,2376.2104,12.1635)) {
        if(strcmp(params, "login", true, 5) == 0) {
            strdel(params, 0, 5);

            if(sscanf(params, "ii", BankAccountNum, BankAccountPIN)) {
                UsageMessage(playerid, "Bank Login", "[Bank Account Number] [Bank Account PIN]", "Logs you into the specified bank account.");
                return 1;
            }
            if(GetPVarInt(playerid, "LoggedIntoBankAccount") != -1) {
                ErrorMessage(playerid, "You're already logged in!");
                return 1;
            }
            for(new i = 0; i < MAX_PLAYERS; i++) {
                if(PVar[i][BankAccount] == BankAccountNum) {
                    if(PVar[i][BankPIN] == BankAccountPIN) {
                        SetPVarInt(playerid, "LoggedIntoBankAccount", BankAccountNum);
                        format(string, sizeof(string), "You have logged into Bank Account #%d, PIN: %d", BankAccountNum, BankAccountPIN);
                        SuccessMessage(playerid, string);
                        return 1;
                    }
                    else return ErrorMessage(playerid, "Invalid Bank Account PIN!");
                }
                else return ErrorMessage(playerid, "Invalid Bank Account Number!");
            }
            return 1;
        }
        //snip.
        else if(strcmp(params, "savings", true, 7) == 0) { //problem area
            strdel(params, 0, 7);
           
            if(GetPVarInt(playerid, "LoggedIntoBankAccount") != -1) {
//here I want to add another sscanf usage, example:
// USAGE: /bank savings [withdraw/deposit/balance] and then have more sscanf inside of that;
                return 1;
            }
            else return ErrorMessage(playerid, "You are not logged into a Bank Account!");
        }
        else {
            UsageMessage(playerid, "Bank", "[Login/Create/Withdraw/Deposit/Balance/Savings]", "Accesses your Bank Account.");
            return 1;
        }
    }
    else return ErrorMessage(playerid, "You are not at the Bank of Las Venturas!");
    return 1;
}
How would I go about doing this?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)