SA-MP Forums Archive
Its not depositting money - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Its not depositting money (/showthread.php?tid=317408)



Its not depositting money - milanosie - 11.02.2012

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]");
}



Re : Its not depositting money - ricardo178 - 11.02.2012

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.


Re : Its not depositting money - ricardo178 - 11.02.2012

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