sell skript problem

Discussion in 'Skript' started by AggerTV, Jan 24, 2020.

  1. Anyone who know why 2 of the same items will not sell for the price of 2 item, but instead of the price of 1.
    This is only a problem whenever you have more of the same item.

    Code (Text):
    loop all items in player's inventory:
                           if {a::%id of loop-item%} is set:
                               wait 5 ticks
                               add {a::%id of loop-item%} to {_money}
                               remove loop-item from player's inventory
                       if {_money} is greater than 0:
                           add {_money} to player's balance
                           send "&8&l&m----------------------"
                           send "&7                         &7"
                           send "&cDu tjente &a$%{_money}%&a på at sælge dine items!"
                           send "&7                         &7"
                           send "&8&l&m----------------------"
     
  2. hei venn. the script you posted seems to be incomplete + you should "resolve" the shorthanded variables for us, so we can understand what you're doing + trying to do.

    as far as i can tell tho, you probably want to do something like:
    Code (Text):
    add ({a::%id of loop-item%} * [amount of sold item]) to {_money}
    multiplying the value by the amount of items that have been sold
     
  3. I'm not quite sure how I would multiply "{z::%id of loop-item%}" by "loop-value".

    Also, variables like these won't sell for some weird reason.

    Code (Text):
    {v::35:1} = 250 #colored whool
        {v::35:2} = 250 #colored whool
        {v::35:3} = 250 #colored whool
        {v::35:4} = 250 #colored whool
        {v::35:5} = 250 #colored whool
        {v::35:6} = 250 #colored whool
        {v::35:7} = 250 #colored whool
        {v::35:8} = 250 #colored whool
        {v::35:9} = 250 #colored whool
        {v::35:10} = 250 #colored whool
        {v::35:11} = 250 #colored whool
        {v::35:12} = 250 #colored whool
        {v::35:13} = 250 #colored whool
        {v::35:14} = 250 #colored whool
        {v::35:15} = 250 #colored whool
        {v::35:16} = 250 #colored whool


        {w::351:4} = 1100 #lapis lazuli
     
  4. well they are numbers, how will it know what to sell.. xD you have to use full block names, but I am guessing you forget to compare data of item part

    I strongly don't recommend use of ids, it has been deprecated for years and doesn't work anymore in 1.13+
     

  5. Ok, but How would i multiply the variable and the loop-value together?
     
    #5 AggerTV, Jan 25, 2020
    Last edited: Jan 25, 2020
  6. set {_var} to {_var} * loop-value