Skip to content
home/templates/auction house (/ah) — basic
economyAdvancednewmc 1.20.x – 1.21.x57 lines

auction house (/ah) — basic

players list items for sale at a price. /ah opens the browse gui. buy with /ah buy <id>. money goes to seller.

required addons — install before reloading
  • download skBeeAdds scoreboards, hologram text, and other things Skript can't do on its own.
Drop each .jar into your plugins/ folder, then restart your server.
auction-house.sk57 lines
# Listings layout — one index list of IDs + per-ID nested data.
# {ah.ids::*}                            — list of active listing IDs
# {ah.item::%id%}, {ah.price::%id%}, ...  — per-listing fields

command /ah [<text>] [<integer>]:
    trigger:
        if arg-1 is "buy":
            if arg-2 is not set:
                send "&cUsage: /ah buy <id>" to player
                stop
            if {ah.item::%arg-2%} is not set:
                send "&cListing #%arg-2% doesn't exist." to player
                stop
            set {_price} to {ah.price::%arg-2%}
            if {money.%uuid of player%} ? 0 < {_price}:
                send "&cYou need &a$%{_price}%&c to buy this." to player
                stop
            remove {_price} from {money.%uuid of player%}
            add {_price} to {money.%uuid of {ah.seller::%arg-2%}%}
            give {ah.item::%arg-2%} to player
            send "&aBought listing &f#%arg-2%&a for &a$%{_price}%&a." to player
            if {ah.seller::%arg-2%} is online:
                send "&aYour listing &f#%arg-2% &asold for &a$%{_price}%&a!" to {ah.seller::%arg-2%}
            delete {ah.item::%arg-2%}
            delete {ah.price::%arg-2%}
            delete {ah.seller::%arg-2%}
            remove arg-2 from {ah.ids::*}
            stop
        # Default: open browse GUI
        set {_gui} to chest inventory with 6 rows named "&6Auction House"
        set {_slot} to 0
        loop {ah.ids::*}:
            exit loop if {_slot} >= 54
            set {_id} to loop-value
            set {_item} to {ah.item::%{_id}%}
            set {_price} to {ah.price::%{_id}%}
            set {_seller} to {ah.seller::%{_id}%}
            set slot {_slot} of {_gui} to {_item} with lore "&7Price: &a$%{_price}%", "&7Seller: &f%{_seller}%", "&8/ah buy %{_id}%"
            add 1 to {_slot}
        open {_gui} to player

command /sell <integer>:
    trigger:
        if player's tool is air:
            send "&cHold the item you want to sell." to player
            stop
        if arg-1 < 1:
            send "&cPrice must be at least $1." to player
            stop
        set {_id} to a random integer between 1000 and 9999
        set {ah.item::%{_id}%} to player's tool
        set {ah.price::%{_id}%} to arg-1
        set {ah.seller::%{_id}%} to player
        add {_id} to {ah.ids::*}
        set player's tool to air
        broadcast "&e%player% &7listed &f%type of {ah.item::%{_id}%}% &7for &a$%arg-1%&7. &8/ah buy %{_id}%"

get it running

auction-house.sk · 57 lines · needs skBee
  1. 1

    copy or download

    grab the .sk file with the buttons up top.

    auction-house.sk· ready to drop in
  2. 2

    drop it in your scripts folder

    save it exactly here on your server — no typos, just copy the path:

    …/plugins/Skript/scripts/auction-house.sk
  3. 3

    reload in-game

    run this in chat or console — your script goes live instantly:

    /sk reload auction-house
that's it — your script is live. hop in-game to try it.
/ related templates

more economy templates

comments