Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- options:
- dirdata: plugins/Skript/scripts/data/shop.yml
- line1buy: [&3&lBuy&0]
- line1sell: [&2&lSell&0]
- line2: &lKlik Kanan
- line3: &1Harga: &0[price]
- line4: &1ID: &c[id]
- invbuy: &3&lBuy &2%{_item}% &0&lShop
- invsell: &a&lSell &2%{_item}% &0&lShop
- steal: &a&c&d
- function citem(t: text) :: item:
- set {_a} to "%{_t}%" parsed as item
- return {_a}
- function cid(t: text) :: text:
- set {_a} to citem("%{_t}%")
- set {_b} to data of {_a}
- set {_id} to id of {_a}
- if {_b} is equal to 0:
- set {_c} to "%{_id}%"
- else:
- set {_c} to "%{_id}%:%{_b}%"
- return {_c}
- function cekload(e: entity) :: boolean:
- if {_e} is item_frame:
- if block below {_e} is not wall_sign:
- return true
- return false
- function cekfresh(e: entity) :: boolean:
- if {_e} is item_frame:
- if block below {_e} is wall_sign:
- set {_a} to block below {_e}
- if line 1 of {_a} is not "":
- if line 3 of {_a} is not "":
- if line 4 of {_a} is not "":
- return true
- return false
- function cek(e: entity) :: boolean:
- if {_e} is item_frame:
- if block below {_e} is wall_sign:
- set {_a} to block below {_e}
- if line 1 of {_a} is "":
- if line 3 of {_a} is not "":
- if line 4 of {_a} is not "":
- return true
- return false
- function ceksave(e: entity) :: boolean:
- if {_e} is item_frame:
- if block below {_e} is wall_sign:
- set {_a} to block below {_e}
- if line 1 of {_a} is "{@line1buy}":
- return true
- return false
- function setsign(e: entity):
- set {_signbuy} to block below {_e}
- set {_line3} to "{@line3}"
- set {_price} to "%line 3 of {_signbuy}%"
- replace all "[price]" with "%{_price}%" in {_line3}
- set {_line4} to "{@line4}"
- set {_id} to cid("%line 4 of {_signbuy}%")
- replace all "[id]" with "%{_id}%" in {_line4}
- set line 1 of {_signbuy} to "{@line1buy}"
- set line 2 of {_signbuy} to "{@line2}"
- set line 3 of {_signbuy} to "%{_line3}%$"
- set line 4 of {_signbuy} to "%{_line4}%"
- set {_item} to citem("%{_id}%")
- set name of {_item} to "&e☏ &f%{_item}% &8&l| &7Price: &e%{_price}%&a$"
- set the displayed item on {_e} to {_item}
- function seticon(e: entity):
- set {_signbuy} to block below {_e}
- set {_signsell} to block above {_e}
- set {_icon} to block behind {_signbuy}
- set {_icon2} to block behind {_signsell}
- set {_id} to id("%line 4 of {_signbuy}%")
- set {_item} to citem("%{_id}%")
- set block at {_icon}'s location to {_item}
- wait 1 tick
- set block at {_icon2}'s location to {_item}
- function setsell(e: entity):
- set block above {_e} to wall_Sign
- set {_signsell} to block above {_e}
- set {_signbuy} to block below {_e}
- set {_price} to price("%line 3 of {_signbuy}%")
- set {_price} to {_price} parsed as number
- set {_price} to {_price} / 4
- set {_line3} to "{@line3}"
- replace all "[price]" with "%{_price}%" in {_line3}
- set line 1 of {_signsell} to "{@line1sell}"
- set line 2 of {_signsell} to "{@line2}"
- set line 3 of {_signsell} to "%{_line3}%$"
- set line 4 of {_signsell} to "%line 4 of {_signbuy}%"
- command /ds [<text>] [<number>]:
- trigger:
- if arg 1 is not set:
- send "/ds t - Toggle Admin Mode"
- send "/ds set <radius> - Set Sign In Radius"
- if arg 1 is "save":
- if arg 2 is set:
- loop entities in radius arg 2 of player:
- set {_a} to ceksave(loop-entity)
- if {_a} is true:
- set {_sign} to block below loop-entity
- set {_id} to id("%line 4 of {_sign}%")
- set {_price} to price("%line 3 of {_sign}%")
- set "Saved.%{_id}%" to "%{_price}%" in yaml file "plugins/Skript/scripts/worth.yml"
- send "%{_id}% = %{_price}%"
- if arg 1 is "cek":
- if arg 2 is set:
- set {_s::*} to configuration section "Items" get of "plugins/Skript/scripts/worth.yml"
- set "Total" to "%size of {_s::*}%" in yaml file "plugins/Skript/scripts/worth.yml"
- set {_total} to single value "Total" get of "plugins/Skript/scripts/worth.yml"
- loop entities in radius arg 2 of player:
- set {_a} to cekload(loop-entity)
- if {_a} is true:
- add 1 to {_count}
- send "&8[&bShop&8] &eItemFrame Total: %{_count}%"
- send "&8[&bShop&8] &bItemWorth Total: %{_total}%"
- if arg 1 is "load":
- if arg 2 is set:
- set {_s::*} to configuration section "Items" get of "plugins/Skript/scripts/worth.yml"
- set "Total" to "%size of {_s::*}%" in yaml file "plugins/Skript/scripts/worth.yml"
- set {_total} to single value "Total" get of "plugins/Skript/scripts/worth.yml"
- loop entities in radius arg 2 of player:
- set {_a} to cekload(loop-entity)
- if {_a} is true:
- add 1 to {_count}
- send "&8[&bShop&8] &fProcess &a%{_count}%&7/&6%{_total}%"
- set {_id} to "%{_s::%{_count}%}%"
- set {_convert} to cid("%{_id}%")
- send "%{_id}% = %{_convert}%" to console
- set {_price} to single value "Items.%{_s::%{_count}%}%" get of "plugins/Skript/scripts/worth.yml"
- if {_price} contains "/":
- set {_pr::*} to {_price} split at "/"
- set {_p1} to {_pr::1} parsed as number
- set {_p2} to {_pr::2} parsed as number
- set {_price} to {_p1} / {_p2}
- set block below loop-entity to wall_sign
- set {_block} to block below loop-entity
- set line 3 of {_block} to "%{_price}%"
- set line 4 of {_block} to "%{_id}%"
- if "%{_total}%" is "%{_count}%":
- send "&8[&bShop&8] &eComplete &6%{_count}%&7/&6%{_total}%"
- player command "/ds set %arg 2%"
- stop
- wait 1 tick
- if arg 1 is "set":
- if arg 2 is set:
- loop entities in radius arg 2 of player:
- set {_a} to cek(loop-entity)
- if {_a} is true:
- setsign(loop-entity)
- wait 1 tick
- player command "/ds sell %arg 2%"
- if arg 1 is "icon":
- if arg 2 is set:
- loop entities in radius arg 2 of player:
- set {_a} to cekfresh(loop-entity)
- if {_a} is true:
- seticon(loop-entity)
- wait 1 tick
- if arg 1 is "reset":
- if arg 2 is set:
- loop entities in radius arg 2 of player:
- set {_a} to cekfresh(loop-entity)
- if {_a} is true:
- set displayed item on loop-entity to air
- set block below loop-entity to air
- if arg 1 is "sell":
- if arg 2 is set:
- loop entities in radius arg 2 of player:
- set {_a} to cekfresh(loop-entity)
- if {_a} is true:
- setsell(loop-entity)
- wait 1 tick
- if arg 1 is "t":
- if {mode::%player%} is true:
- delete {mode::%player%}
- send "&8[&bShop&8] &fAdmin Mode : OFF"
- stop
- if {mode::%player%} is not set:
- set {mode::%player%} to true
- send "&8[&bShop&8] &fAdmin Mode : ON"
- stop
- if arg 1 is "price":
- if arg 2 is set:
- set {_block} to player's targeted block
- loop entities in radius 1 around location of block above location of {_block}:
- set {_id} to cid("%displayed item on loop-entity%")
- set line 3 of {_block} to "%arg 2%"
- set line 4 of {_block} to "%{_id}%"
- setsign(loop-entity)
- on leftclick on sign:
- if {mode::%player%} is true:
- cancel event
- set {_price} to line 1 of event-block parsed as number
- if {_price} is set:
- if player's tool is air:
- send "&8[&bShop&8] &fTolong Pegang Item"
- stop
- set line 3 of event-block to "%line 1 of event-block%"
- set line 1 of event-block to ""
- set {_id} to cid("%player's tool%")
- set line 4 of event-block to "%{_id}%"
- loop entities in radius 1 around location of block above location of event-block:
- set {_a} to cek(loop-entity)
- if {_a} is true:
- setsign(loop-entity)
- else:
- if line 1 is not "":
- if line 3 of event-block is set:
- set {_price} to price("%line 3 of event-block%")
- set line 3 of event-block to "%{_price}%"
- if line 1 is "":
- set line 3 of event-block to "0"
- loop entities in radius 1 around location of block above location of event-block:
- if displayed item on loop-entity is air:
- set displayed item on loop-entity to player's tool
- set {_id} to cid("%displayed item on loop-entity%")
- set line 4 of event-block to "%{_id}%"
- setsign(loop-entity)
- function reloadmenu(p: player):
- {_p} command "/sk reload %script%"
- function buy(p: player, amount: number, price: number, item: item):
- set {_prices} to {_price} * {_amount}
- if {_p}'s balance is more than {_prices}:
- loop {_amount} times:
- set {_event} to event({_p}, {limit::multiplier::%{_p}%}, "transaction")
- if {_event} is false:
- if {_count} is set:
- set {_harga} to {_price} * {_count}
- log("%{_p}%", "Sadap/trade/%{_p}%-Trade.txt", "[Buy] %{_count}% %{_item}% | Harga > %{_harga}% !Terkena Limit!)")
- send "&8[&bShop&8] &eKamu Berhasil Membeli Sebanyak &6%{_count}% &2%{_item}%" to {_p}
- send "&8[&bShop&8] &eDengan Total Harga: &f%{_price} * {_count}%$" to {_p}
- stop
- add {_item} to {_p}'s inventory
- subtract {_price} from {_p}'s balance
- add 1 to {_count}
- set {_harga} to {_price} * {_count}
- log("%{_p}%", "Sadap/trade/%{_p}%-Trade.txt", "[Buy] %{_count}% %{_item}% | Harga > %{_harga}%")
- send "&8[&bShop&8] &eKamu Berhasil Membeli Sebanyak &6%{_count}% &2%{_item}%" to {_p}
- send "&8[&bShop&8] &eDengan Total Harga: &f%{_price} * {_count}%$" to {_p}
- play "ENTITY_VILLAGER_YES" to {_p} at volume 2
- stop
- else:
- send "&8[&bShop&8] &cUangmu tidak cukup untuk membeli &6%{_amount}% &2%{_item}%" to {_p}
- play "ENTITY_VILLAGER_NO" to {_p} at volume 2
- stop
- function sell(p: player, amount: number, price: number, item: item):
- set {_prices} to {_price} * {_amount}
- if {_amount} is more than number of {_item} in {_p}'s inventory:
- send "&8[&bShop&8] &eKamu Tidak Mempunyai &2%{_item}% Sebanyak &6%{_amount}%" to {_p}
- play "ENTITY_VILLAGER_NO" to {_p} at volume 2
- stop
- loop {_amount} times:
- set {_event} to event({_p}, {limit::multiplier::%{_p}%}, "transaction")
- if {_event} is false:
- if {_count} is set:
- set {_harga} to {_price} * {_count}
- log("%{_p}%", "Sadap/trade/%{_p}%-Trade.txt", "[Sell] %{_count}% %{_item}% | Harga > %{_harga}% [Terkena Limit]")
- send "&8[&bShop&8] &eKamu Berhasil Menjual Sebanyak &6%{_count}% &2%{_item}%" to {_p}
- send "&8[&bShop&8] &eDengan Total Harga: &f%{_price} * {_count}%$" to {_p}
- stop
- remove {_item} from {_p}
- add {_price} to {_p}'s balance
- add 1 to {_count}
- set {_harga} to {_price} * {_count}
- log("%{_p}%", "Sadap/trade/%{_p}%-Trade.txt", "[Sell] %{_count}% %{_item}% | Harga > %{_harga}%")
- send "&8[&bShop&8] &eKamu Berhasil Menjual Sebanyak &6%{_count}% &2%{_item}%" to {_p}
- send "&8[&bShop&8] &eDengan Total Harga: &f%{_price} * {_count}%$" to {_p}
- play "ENTITY_VILLAGER_YES" to {_p} at volume 2
- stop
- on rightclick on sign:
- if line 1 of event-block is "{@line1sell}":
- wait 1 tick
- set {_b} to event-block
- set {_price} to price("%line 3 of {_b}%")
- set {_id} to id("%line 4 of {_b}%")
- set {_item} to citem("%{_id}%")
- set {_miaw} to cid("%{_item}%")
- set {_2item} to "2 %{_miaw}%" parsed as item
- if {_2item} is not set:
- set {_2item} to {_item}
- set {_4item} to "4 %{_miaw}%" parsed as item
- if {_4item} is not set:
- set {_4item} to {_item}
- set {_8item} to "8 %{_miaw}%" parsed as item
- if {_8item} is not set:
- set {_8item} to {_item}
- set {_16item} to "16 %{_miaw}%" parsed as item
- if {_16item} is not set:
- set {_16item} to {_item}
- set {_32item} to "32 %{_miaw}%" parsed as item
- if {_32item} is not set:
- set {_32item} to {_item}
- set {_64item} to "64 %{_miaw}%" parsed as item
- if {_64item} is not set:
- set {_64item} to {_item}
- if inventory name of player's current inventory is "{@invsell}":
- stop
- play "UI_BUTTON_CLICK" to player at volume 2
- open chest with 1 row named "{@invsell}" to player
- while inventory name of player's current inventory is "{@invsell}":
- set {_have} to number of {_item} in player's inventory
- format slot 0 of player with chest named "{@steal}&a&lINFO>" with lore "&bName&f&l: &e%player%||&bMoney&f&l: &e%player's balance%" to run [reloadmenu(player)]
- format slot 8 of player with chest named "{@steal}&a&lINFO>" with lore "&bName&f&l: &e%player%||&bMoney&f&l: &e%player's balance%" to run [reloadmenu(player)]
- format slot 1 of player with {_item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}%$||&fJumlah&f&l: &e1x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 1, {_price}, {_item})]
- format slot 2 of player with {_2item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*2%$||&fJumlah&f&l: &e2x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 2, {_price}, {_item})]
- format slot 3 of player with {_4item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*4%$||&fJumlah&f&l: &e4x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 4, {_price}, {_item})]
- format slot 4 of player with {_8item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*8%$||&fJumlah&f&l: &e8x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 8, {_price}, {_item})]
- format slot 5 of player with {_16item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*16%$||&fJumlah&f&l: &e16x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 16, {_price}, {_item})]
- format slot 6 of player with {_32item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*32%$||&fJumlah&f&l: &e32x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 32, {_price}, {_item})]
- format slot 7 of player with {_64item} named "{@steal}&b&lSell> &7Klik Untuk menjual" with lore "&fHarga&f&l: &e%{_price}*64%$||&fJumlah&f&l: &e64x||&aPunyamu&f&l: %{_have}%x" to run [sell(player, 64, {_price}, {_item})]
- wait 2 tick
- on rightclick on sign:
- if line 1 of event-block is "{@line1buy}":
- wait 1 tick
- set {_b} to event-block
- set {_price} to price("%line 3 of {_b}%")
- set {_id} to id("%line 4 of {_b}%")
- set {_item} to citem("%{_id}%")
- set {_miaw} to cid("%{_item}%")
- set {_2item} to "2 %{_miaw}%" parsed as item
- if {_2item} is not set:
- set {_2item} to {_item}
- set {_4item} to "4 %{_miaw}%" parsed as item
- if {_4item} is not set:
- set {_4item} to {_item}
- set {_8item} to "8 %{_miaw}%" parsed as item
- if {_8item} is not set:
- set {_8item} to {_item}
- set {_16item} to "16 %{_miaw}%" parsed as item
- if {_16item} is not set:
- set {_16item} to {_item}
- set {_32item} to "32 %{_miaw}%" parsed as item
- if {_32item} is not set:
- set {_32item} to {_item}
- set {_64item} to "64 %{_miaw}%" parsed as item
- if {_64item} is not set:
- set {_64item} to {_item}
- if inventory name of player's current inventory is "{@invbuy}":
- stop
- play "UI_BUTTON_CLICK" to player at volume 2
- open chest with 1 row named "{@invbuy}" to player
- while inventory name of player's current inventory is "{@invbuy}":
- format slot 0 of player with chest named "{@steal}&a&lINFO>" with lore "&bName&f&l: &e%player%||&bMoney&f&l: &e%player's balance%" to run [reloadmenu(player)]
- format slot 8 of player with chest named "{@steal}&a&lINFO>" with lore "&bName&f&l: &e%player%||&bMoney&f&l: &e%player's balance%" to run [reloadmenu(player)]
- format slot 1 of player with {_item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}%$||&fJumlah&f&l: &e1x" to run [buy(player, 1, {_price}, {_item})]
- format slot 2 of player with {_2item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*2%$||&fJumlah&f&l: &e2x" to run [buy(player, 2, {_price}, {_item})]
- format slot 3 of player with {_4item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*4%$||&fJumlah&f&l: &e4x" to run [buy(player, 4, {_price}, {_item})]
- format slot 4 of player with {_8item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*8%$||&fJumlah&f&l: &e8x" to run [buy(player, 8, {_price}, {_item})]
- format slot 5 of player with {_16item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*16%$||&fJumlah&f&l: &e16x" to run [buy(player, 16, {_price}, {_item})]
- format slot 6 of player with {_32item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*32%$||&fJumlah&f&l: &e32x" to run [buy(player, 32, {_price}, {_item})]
- format slot 7 of player with {_64item} named "{@steal}&b&lBuy> &7Klik Untuk Membeli" with lore "&fHarga&f&l: &e%{_price}*64%$||&fJumlah&f&l: &e64x" to run [buy(player, 64, {_price}, {_item})]
- wait 2 tick
- on drop:
- if name of player's current inventory is "{@invbuy}":
- cancel event
- on break:
- if line 1 of event-block is "{@line1sell}":
- if player's tool is not golden axe:
- send "&8[&bShop&8] &7Use golden axe to destroy" to player
- cancel event
- if line 1 of event-block is "{@line1buy}":
- if player's tool is not golden axe:
- send "&8[&bShop&8] &7Use golden axe to destroy" to player
- cancel event
- on damage:
- if victim is item_Frame:
- set {_a} to location of block at victim's location
- if block below {_a}'s location is wall_sign:
- set {_block} to block below {_a}
- if line 1 of {_block} is "{@line1buy}":
- send "&8[&bShop&8] &cDon't Touch!" to attacker
- cancel event
- if line 1 of {_block} is "{@line1sell}":
- send "&8[&bShop&8] &cDon't Touch!" to attacker
- cancel event
Advertisement
Add Comment
Please, Sign In to add comment