Bank system problem
#4

Quote:
Originally Posted by DaRoderick
Посмотреть сообщение
It does not actually deposit or withdraw the money
changed, and heres my code for it on my server,

pawn Код:
COMMAND:withdraw(playerid, params[])
{
    new ammount;
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][AdminLevel] >= 0 && PlayerInfo[playerid][pInarea] == 1)
        {
            if(!sscanf(params, "i", ammount))
            {
                if(ammount <= PlayerInfo[playerid][pBank])
                {
                    if(ammount > -1)
                    {
                        new string[64];
                        new PName[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, PName, sizeof(PName));
                        PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]+ammount;
                        PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]-ammount;
                        SendClientMessage(playerid, 0xD8D8D8FF, "----Bank Statement----");
                        format(string, sizeof(string), "New Balance %d", PlayerInfo[playerid][pBank]);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SetPlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xD8D8D8FF, "You Can't withdraw less than $0 nice try tho.");
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "You don't have enough cash.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /withdraw [amount]");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not near a bank.");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}

COMMAND:deposit(playerid, params[])
{
    new ammount;
    if(IsPlayerConnected(playerid))
    {
        if(PlayerInfo[playerid][AdminLevel] >= 0 && PlayerInfo[playerid][pInarea] == 1)
        {
            if(!sscanf(params, "i", ammount))
            {
                if(ammount <= PlayerInfo[playerid][pCash])
                {
                    if(ammount > -1)
                    {
                        new string[64];
                        new PName[MAX_PLAYER_NAME];
                        GetPlayerName(playerid, PName, sizeof(PName));
                        PlayerInfo[playerid][pCash] = PlayerInfo[playerid][pCash]-ammount;
                        PlayerInfo[playerid][pBank] = PlayerInfo[playerid][pBank]+ammount;
                        SendClientMessage(playerid, 0xD8D8D8FF, "----Bank Statement----");
                        format(string, sizeof(string), "New Balance %d", PlayerInfo[playerid][pBank]);
                        SendClientMessage(playerid, COLOR_GREEN, string);
                        SetPlayerMoney(playerid, PlayerInfo[playerid][pCash]);
                        return 1;
                    }
                    else return SendClientMessage(playerid, 0xD8D8D8FF, "You Can't deposit less than $0 nice try tho.");
                }
                else return SendClientMessage(playerid, 0xD8D8D8FF, "You don't have enough cash.");
            }
            else return SendClientMessage(playerid, 0xD8D8D8FF, "USAGE: /deposit [amount]");
        }
        else return SendClientMessage(playerid, 0xD8D8D8FF, "You are not near a bank.");
    }
    else return SendClientMessage(playerid, 0xD8D8D8FF, "Player is not connected.");
}
Reply


Messages In This Thread
Bank system problem - by DaRoderick - 26.11.2012, 19:05
Re: Bank system problem - by jueix - 26.11.2012, 19:10
Re: Bank system problem - by DaRoderick - 26.11.2012, 19:12
Re: Bank system problem - by jueix - 26.11.2012, 19:15
Re: Bank system problem - by DaRoderick - 26.11.2012, 19:53
Re: Bank system problem - by DaRoderick - 26.11.2012, 21:10
Re: Bank system problem - by DaRoderick - 27.11.2012, 10:07
Re: Bank system problem - by jueix - 27.11.2012, 11:32
Re: Bank system problem - by DaRoderick - 27.11.2012, 12:47
Re: Bank system problem - by zT KiNgKoNg - 27.11.2012, 14:08

Forum Jump:


Users browsing this thread: 1 Guest(s)