/withdraw sets -Moneys.. Help plx
#1

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
Reply
#2

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");
}
Reply
#3

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
Reply
#4

Can anyone help plx?
Reply
#5

maybe

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

yep thx :P
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)