Once more /atm help
#7

pawn Код:
if(!strcmp(params, "withdraw", true))
    {
        if(sscanf(params, "s[32]i", params, amount)) return SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /atm [withdraw/balance/deposit] [amount]");
        if(amount > PlayerInfo[playerid][pBank]) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money in your bank account.");
        if(amount <= 0)  return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount.");
        if(amount > 50000) return SendClientMessage(playerid, COLOR_GREY, "You can't deposit more than $50,000 in an ATM.");
        if(ATMTime[playerid] > 0)
        {
            format(string, sizeof(string), "You need to wait %d more seconds before using the ATM again.", ATMTime[playerid]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        PlayerInfo[playerid][pBank] -= amount;
        GiveDodMoney(playerid, amount);
        ATMTime[playerid] = 40;
        format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPN(playerid));
        SendNearbyMessage(playerid, 5, me, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        SendClientMessage(playerid, COLOR_WHITE, "_________________________________");
        format(string, sizeof(string), "You have successfully withdrawn $%d from your Bank account.", amount);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have a total of $%d remaining in your Bank account.", PlayerInfo[playerid][pBank]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        SetTimerEx("ATMTimer", 1000, false, "i", playerid);
        return 1;
    }
    else if(!strcmp(params, "deposit", true))
    {
        if(sscanf(params, "s[32]i", params, amount)) return SendClientMessage(playerid, COLOR_WHITE, "** [Usage]: /atm [withdraw/balance/deposit] [amount]");
        if(amount > PlayerInfo[playerid][pMoney]) return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money on you.");
        if(amount <= 0)  return SendClientMessage(playerid, COLOR_GREY, "Invalid money amount.");
        if(amount > 50000) return SendClientMessage(playerid, COLOR_GREY, "You can't withdraw more than $50,000 from the ATM.");
        if(ATMTime[playerid] > 0)
        {
            format(string, sizeof(string), "You need to wait %d more seconds before using the ATM again.", ATMTime[playerid]);
            SendClientMessage(playerid, COLOR_GREY, string);
            return 1;
        }
        PlayerInfo[playerid][pBank] += amount;
        GiveDodMoney(playerid, -amount);
        ATMTime[playerid] = 40;
        format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPN(playerid));
        SendNearbyMessage(playerid, 5, me, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        SendClientMessage(playerid, COLOR_WHITE, "_________________________________");
        format(string, sizeof(string), "You have successfully deposit $%d into your Bank account.", amount);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "You have a total of $%d in your Bank account now.", PlayerInfo[playerid][pBank]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        SetTimerEx("ATMTimer", 1000, false, "i", playerid);
        return 1;
    }
    else if(!strcmp(params, "balance", true))
    {
        format(me, sizeof(me), "** %s presses a button on the ATM machine and waits for a response.", RPN(playerid));
        SendNearbyMessage(playerid, 5, me, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
        SendClientMessage(playerid, COLOR_WHITE, "_________________________________");
        format(string, sizeof(string), "Your current Bank-account balance is: $%d.", PlayerInfo[playerid][pBank]);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        return 1;
    }
    return 1;
}
First seperate this into three commands not all in one. Then check out if it works for each one. After that add one by one into main ''atm'' command and test after it. I guess you missed something on the way
Reply


Messages In This Thread
Once more /atm help - by MichaelWharton101 - 04.05.2013, 02:54
Re: Once more /atm help - by MP2 - 04.05.2013, 03:21
Re: Once more /atm help - by MichaelWharton101 - 04.05.2013, 03:34
Re: Once more /atm help - by JaKe Elite - 04.05.2013, 03:40
Re: Once more /atm help - by MichaelWharton101 - 04.05.2013, 03:42
Re: Once more /atm help - by MichaelWharton101 - 04.05.2013, 14:26
Re: Once more /atm help - by caki - 04.05.2013, 14:39
Re: Once more /atm help - by caki - 04.05.2013, 14:48

Forum Jump:


Users browsing this thread: 1 Guest(s)