SA-MP Forums Archive
/withdraw sets -Moneys.. Help plx - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /withdraw sets -Moneys.. Help plx (/showthread.php?tid=68353)



/withdraw sets -Moneys.. Help plx - introzen - 09.03.2009

Okey, I got this /withdraw command...

pawn Код:
dcmd_withdraw(playerid, params[])
    {
      if(PlayerToPoint(3.0,playerid,822.5534,4.1383,1004.1797) || PlayerToPoint(3.0,playerid,-269.332855, 2643.274414, 61.681332)
        || PlayerToPoint(3.0,playerid,-246.366257, 2604.845703, 61.696018) || PlayerToPoint(3.0,playerid,-551.660522, 2599.094727, 52.833538)
        || PlayerToPoint(3.0,playerid,-780.411743, 2744.200195, 44.809681) || PlayerToPoint(3.0,playerid,-1317.879761, 2699.827637, 49.156090)
        || PlayerToPoint(3.0,playerid,-1435.860718, 2614.272461, 54.778828) || PlayerToPoint(3.0,playerid,-1505.444580, 2583.840576, 54.753826)
        || PlayerToPoint(3.0,playerid,-1505.501831, 2630.620605, 54.753826))
      {
            new Moneys;
            if(sscanf(params, "d", Moneys)) return SendClientMessage(playerid,COLOR_DARKRED,"Usage: /withdraw [amount]");
            new pName[MAX_PLAYER_NAME],string[256],string2[256];
            GetPlayerName(playerid,pName,sizeof(pName));
            format(string,sizeof(string),"EQRP/Players/%s.ini",pName);
            if(dini_Int(string,"Bank") < params[0]) return SendClientMessage(playerid,COLOR_DARKRED,"You don't have that mutch in your bank");
            format(string2,sizeof(string2),"$%s Withdrawed",params[0]);
            SendClientMessage(playerid,COLOR_YELLOW,string2);
            GivePlayerMoney(playerid,Moneys);
            dini_IntSet(string,"Bank",-Moneys);
            return 1;
        }
        return SendClientMessage(playerid,COLOR_DARKRED,"Not at the Bank or at a ATM");
    }
This line:

Код:
dini_IntSet(string,"Bank",-Moneys);
Is setting the %s.ini to:

Bank=-(amount of moneys that you withdrawed with /withdraw)

ex.

/withdraw 50000
then:

Bank=-50000

..

But i want like, if i have 100000 on the bank, and i do /withdraw 50000, it will set the Bank=50000 instead of -50000

Can someone help me PLEASE? =) <33


Re: /withdraw sets -Moneys.. Help plx - [RP]Rav - 09.03.2009

pawn Код:
dcmd_withdraw(playerid, params[])
{
  if(PlayerToPoint(3.0,playerid,822.5534,4.1383,1004.1797) || PlayerToPoint(3.0,playerid,-269.332855, 2643.274414, 61.681332)
  || PlayerToPoint(3.0,playerid,-246.366257, 2604.845703, 61.696018) || PlayerToPoint(3.0,playerid,-551.660522, 2599.094727, 52.833538)
  || PlayerToPoint(3.0,playerid,-780.411743, 2744.200195, 44.809681) || PlayerToPoint(3.0,playerid,-1317.879761, 2699.827637, 49.156090)
  || PlayerToPoint(3.0,playerid,-1435.860718, 2614.272461, 54.778828) || PlayerToPoint(3.0,playerid,-1505.444580, 2583.840576, 54.753826)
  || PlayerToPoint(3.0,playerid,-1505.501831, 2630.620605, 54.753826))
  {
    new Moneys;
    if(sscanf(params, "d", Moneys))
      return SendClientMessage(playerid,COLOR_DARKRED,"Usage: /withdraw [amount]");
           
    new pName[MAX_PLAYER_NAME],string[256],string2[256];
    GetPlayerName(playerid,pName,sizeof(pName));
    format(string,sizeof(string),"EQRP/Players/%s.ini",pName);

    if(dini_Int(string,"Bank") < params[0])
      return SendClientMessage(playerid,COLOR_DARKRED,"You don't have that mutch in your bank");
           
    format(string2,sizeof(string2),"$%s Withdrawed",params[0]);
    SendClientMessage(playerid,COLOR_YELLOW,string2);
    GivePlayerMoney(playerid,Moneys);

    new bankbalance = dini_Int(string,"Bank") - Moneys;
   
    dini_IntSet(string,"Bank",bankbalance );
    return 1;
       
  }
  return SendClientMessage(playerid,COLOR_DARKRED,"Not at the Bank or at a ATM");
}



Re: /withdraw sets -Moneys.. Help plx - introzen - 09.03.2009

Problem now is:

Код:
if(dini_Int(string,"Bank") < params[0]) 
      return SendClientMessage(playerid,COLOR_DARKRED,"You don't have that mutch in your bank");
Doesn't return if you don't have that amount in your bank... Instead it sets your bank to Minus


Re: /withdraw sets -Moneys.. Help plx - introzen - 09.03.2009

Can anyone help plx?


Re: /withdraw sets -Moneys.. Help plx - [RP]Rav - 09.03.2009

maybe

Код:
if(dini_Int(string,"Bank") < strval(params))



Re: /withdraw sets -Moneys.. Help plx - introzen - 09.03.2009

yep thx :P