/withdraw command
#1

can someone help trying to make it that if your not in the bank or at the atm you cant use this command someone help?

pawn Код:
if(strcmp(cmd, "/withdraw", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(BizzInfo[PlayerInfo[playerid][InBusiness]][bType] == 8 || IsPlayerNearBank(playerid))
            {
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /withdraw [Amount]");
                format(string, sizeof(string), "  You have $%d in your bank account.", PlayerInfo[playerid][pAccount]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            new cashdeposit = strvalEx(tmp);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE, "USAGE: /withdraw [Amount]");
                format(string, sizeof(string), "  You have $%d in your bank account.", PlayerInfo[playerid][pAccount]);
                SendClientMessage(playerid, COLOR_GRAD3, string);
                return 1;
            }
            if(cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
            {
                SendClientMessage(playerid, COLOR_GRAD2, "   You don't have that much!");
                return 1;
            }
            if(cashdeposit < 20)
            {
                SendClientMessage(playerid, COLOR_GREY, "You can only withdraw a minimum of $20!");
                return 1;
            }
            PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+cashdeposit;
            GivePlayerMoney(playerid,cashdeposit);
            PlayerInfo[playerid][pAccount] = PlayerInfo[playerid][pAccount]-cashdeposit;
            format(string, sizeof(string), "  You have withdrawn $%d from your bank account, Total: $%d ", cashdeposit,PlayerInfo[playerid][pAccount]);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
    }
        return 1;
    }
Reply


Messages In This Thread
/withdraw command - by Donvalley - 15.06.2013, 10:14
Re: /withdraw command - by LilBob - 15.06.2013, 14:00
Re: /withdraw command - by Red_Dragon. - 15.06.2013, 14:03
Re: /withdraw command - by Donvalley - 15.06.2013, 14:59
Re: /withdraw command - by LilBob - 15.06.2013, 15:55
Re: /withdraw command - by Goldilox - 15.06.2013, 16:11
Re: /withdraw command - by Donvalley - 15.06.2013, 22:16
Re: /withdraw command - by JJB562 - 15.06.2013, 22:18
Re: /withdraw command - by Donvalley - 15.06.2013, 22:30
Re: /withdraw command - by Donvalley - 15.06.2013, 22:47

Forum Jump:


Users browsing this thread: 1 Guest(s)