Its not depositting money
#1

Hey, when I /deposit it takes the money from me, but it doesn't add it to the file

pawn Код:
CMD:deposit(playerid, params[])
{
    new number, ammount;
    if(!sscanf(params, "ii", number, ammount))
    {
        format(file, sizeof(file), "realityrp/bank/%d.ini", number);
        if(fexist(file))
        {
            if(ammount <= GetPlayerMoney(playerid))
            {
                if(IsPlayerInRangeOfPoint(playerid, 10.0, 2316.429443, -6.910340, 26.742187) || IsPlayerInRangeOfPoint(playerid, 10.0, 326.8708,131.4956,1007.9657))
                {
                    new string[64];
                    format(string, sizeof(string), "You deposited %d dollar in this bank account.", ammount);
                    SendClientMessage(playerid, 0xFFFFFFFF, string);
                    new mon = dini_Int(file, "Money") + ammount;
                    dini_IntSet(file, "Money", mon);
                    GivePlayerMinusCash(playerid, ammount);
                    return 1;
                }
                else return SendClientMessage(playerid, COLOR_GREY, "You are not at the bank!");
            }
            else return SendClientMessage(playerid, COLOR_GREY, "You don't have that much money!");
        }
        else return SendClientMessage(playerid, 0xFFFFFFFF, "The account you are trying to deposit money at, doesn't exist in our DataBase.");
    }
    else return SendClientMessage(playerid, 0xFFFFFFFF, "Usage: /deposit [Account Number] [Ammount]");
}
Reply
#2

Well, instead of saving it directly, try setting bank info intead, and than save. Creating BankInfo[BankNumber][bInfo]
I am sure it will work this way.

But damn, you are using "ii" in sscanf, and %d in the file check. Or use %i, or repoace with "dd". guess is this.
Reply
#3

Well.. This will work for sure:
pawn Код:
dini_IntSet(file, "Money", dini_Int(file, "Money")+ammount);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)