1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

Solved Player has enough money

Discussion in 'Development' started by _XHazardX_, Oct 30, 2017.

  1. _XHazardX_

    _XHazardX_ Spider Jockey

    Messages:
    33
    GitHub:
    XHazardX420
    Hello, so I want to check if the sender has enough money (5000) using EconomyAPI but I don't know how can anyone help me? Also if they don't have enough money how can I close the ui?
     
    OnTheVerge likes this.
  2. friscowz

    friscowz Baby Zombie Ban Evader Banned

    Messages:
    128
    GitHub:
    friscowzmcpe
    i don't really know how the UI works exactly but for EconomyAPI:
    PHP:
    if(EconomyAPI::reduceMoney($sender$amount) == EconomyAPI::RET_SUCCESS){
     
    //Money successfully reduced from the sender account
    } else {
     
    //Player doesn't have enough of money
    }
     
  3. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    please note that using that DEDUCTS the user's money
    it dosent checks it
    try doing myMoney(sender)>=5000
     
  4. friscowz

    friscowz Baby Zombie Ban Evader Banned

    Messages:
    128
    GitHub:
    friscowzmcpe
    The function reduceMoney() return if it's or not.
     
    xXNiceAssassinlo YT likes this.
  5. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    but it reduces it if it's over
    OP never said that he wanted that
     
    OnTheVerge likes this.
  6. WinterBuild7074

    WinterBuild7074 Zombie Pigman

    Messages:
    693
    GitHub:
    winterbuild7074
    Use this to check if the player has 5000 or more.
    PHP:
    if(EconomyAPI::myMoney($sender) <= 5000){
        
    // do something
    } else {
        
    // not enough money
    }
     
    CaptainDuck likes this.
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.