Results 1 to 3 of 3

Thread: Problem with an action

  1. #1
    Normal User Stanky's Avatar
    Join Date
    Aug 2012
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    20
    Rep Power
    5

    Unhappy Problem with an action

    npcsay("hi")
    wait(1300,1450)
    npcsay("deposit all")
    wait(300,450)
    npcsay("yes")
    wait(300,450)

    local health = positive(HpToBuy -itemcount(HpName)) * Hpprice
    local healthtotal = Health

    local spear = positive(AmmoToBuy - itemcount(AmmoName)) *AmmoPrice
    local speartotal = Ammo

    local mana = positive(MpToBuy -itemcount(MpName)) * Mpprice
    local manatotal = Mana

    if manatotal + speartotal + healthtotal > 0 then
    npcsay("withdraw "..total)
    wait(200,300)
    npcsay("yes")

    Could someone help me? Trying to get it to withdraw the right amount of cash for Spears/mana's/health potion. Should it be (manatotal) + (speartotal) + healthtotal = (total)
    Last edited by Stanky; 05-03-2013 at 09:50 AM.

  2. #2
    iBot User Raph_'s Avatar
    Join Date
    Feb 2013
    Posts
    391
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    59
    Rep Power
    4
    local spearCount = weaponamount + itemcount(AmmoName)
    local _CASH = math.max(MpToBuy - itemcount(MpName), 0) * itemcost(MpName) + math.max(HpToBuy - itemcount(HpName), 0) * itemcost(HpName) + math.max(AmmoToBuy - spearCount, 0) * itemcost(AmmoName)

    if ischannel("NPCs") then
    npcsay("hi")
    wait(1000, 2000)
    else
    say("hi")
    wait(1000, 2000)
    end
    npcsay("deposit all")
    wait(300, 600)
    npcsay("yes")
    wait(300, 600)

    if _total > 0 then
    npcsay("withdraw ".._CASH)
    wait(300, 600)
    npcsay("yes")
    wait(300, 600)
    npcsay("balance")
    wait(300, 600)
    end

  3. #3
    Normal User Stanky's Avatar
    Join Date
    Aug 2012
    Posts
    112
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    0 Post(s)
    Reputation
    20
    Rep Power
    5
    I love you

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •