Jump to content

can anyone make me a /shop gui skript


SPINNERZ

Recommended Posts

categories:

defense - (stonebricks=$5000 name:&7&lTier 1 Defense block) (basalt-$20000 name:&7&lTier 2 Defense block) (polisheddeepslate-$100000 name:&7&lTier 3 Defense block) (irontrapdoor-$25000 name:&f&lTier 2 Trapdoor) (beacon-$20000 name:&b&lRespawn Block)

gens - (white_glazed_terracotta=$100 name:&fWhite Generator &8[&6T1&8])

 

economy to use for it {balance::%player's uuid%}

example if you bought something "remove 10 from {balance::%player's uuid%}"

Link to comment
Share on other sites

options:
	shopname: &6&lShop
	defname: &a&lDefense
	genname: &b&lGens
	msg: &8[&3Shop&8] &3

function buy(p: player, i: integer, m: string, it: itemtype):
	set {_uuid} to uuid of {_p}
	if {balance::%{_uuid}%} >= {_i}:
		remove {_i} from {balance::%{_uuid}%}
		give {_p} {_it} named {_m}
		send "{@msg}Bought 1 %{_m}% &3for $%{_i}%" to {_p}
	else:
		send "{@msg}Too poor" to {_p}

command /shop:
	trigger:
		set metadata tag "shop" of player to chest inventory with 1 row named "{@shopname}"
		set slot 0 of metadata tag "shop" of player to iron bars named "{@defname}"
		set slot 1 of metadata tag "shop" of player to hay bale named "{@genname}"
		open (metadata tag "shop" of player) to player

on inventory click:
	if event-inventory = (metadata tag "shop" of player):
		cancel event
		if index of event-slot is 0:
			set metadata tag "shopDef" of player to chest inventory with 6 rows named "{@defname}"
			set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopDef" of player to black stained glass pane
			set slot 10 of metadata tag "shopDef" of player to stone brick named "&7&lTier 1 Defense Block" with lore "", "&aPrice: $5000" and ""
			set slot 11 of metadata tag "shopDef" of player to basalt named "&7&lTier 2 Defense Block" with lore "", "&aPrice: $20000" and ""
			set slot 12 of metadata tag "shopDef" of player to polished deepslate named "&7&lTier 3 Defense Block" with lore "", "&aPrice: $100000" and ""
			set slot 13 of metadata tag "shopDef" of player to iron trapdoor named "&f&lTier 2 Trapdoor" with lore "", "&aPrice: $25000" and ""
			set slot 14 of metadata tag "shopDef" of player to beacon named "&b&lRespawn Block" with lore "", "&aPrice: $20000" and ""
			open (metadata tag "shopDef" of player) to player
		if index of event-slot is 1:
			set metadata tag "shopGen" of player to chest inventory with 6 rows named "{@genname}"
			set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopGen" of player to black stained glass pane
			set slot 10 of metadata tag "shopGen" of player to white glazed terracotta named "&fWhite Generator &8[&6T1&8]" with lore "", "&aPrice: $100" and ""
			open (metadata tag "shopGen" of player) to player
	if event-inventory = (metadata tag "shopDef" of player):
		cancel event
		if index of event-slot is 10:
			buy(player, 5000, "&7&lTier 1 Defense Block", stone brick)
		if index of event-slot is 11:
			buy(player, 20000, "&7&lTier 2 Defense Block", basalt)
		if index of event-slot is 12:
			buy(player, 100000, "&7&lTier 3 Defense Block", polished deepslate)
		if index of event-slot is 13:
			buy(player, 25000, "&f&lTier 2 Trapdoor", iron trapdoor)
		if index of event-slot is 14:
			buy(player, 20000, "&b&lRespawn Block", beacon)
	if event-inventory = (metadata tag "shopGen" of player):
		cancel event
		if index of event-slot is 10:
			buy(player, 100, "&fWhite Generator &8[&6T1&8]", white glazed terracotta)

 

  • Like 1

Discord: Dead#6905

Love anime!


Anime Gifs

Link to comment
Share on other sites

1 hour ago, ApexSplat said:
options:
	shopname: &6&lShop
	defname: &a&lDefense
	genname: &b&lGens
	msg: &8[&3Shop&8] &3

function buy(p: player, i: integer, m: string, it: itemtype):
	set {_uuid} to uuid of {_p}
	if {balance::%{_uuid}%} >= {_i}:
		remove {_i} from {balance::%{_uuid}%}
		give {_p} {_it} named {_m}
		send "{@msg}Bought 1 %{_m}% &3for $%{_i}%" to {_p}
	else:
		send "{@msg}Too poor" to {_p}

command /shop:
	trigger:
		set metadata tag "shop" of player to chest inventory with 1 row named "{@shopname}"
		set slot 0 of metadata tag "shop" of player to iron bars named "{@defname}"
		set slot 1 of metadata tag "shop" of player to hay bale named "{@genname}"
		open (metadata tag "shop" of player) to player

on inventory click:
	if event-inventory = (metadata tag "shop" of player):
		cancel event
		if index of event-slot is 0:
			set metadata tag "shopDef" of player to chest inventory with 6 rows named "{@defname}"
			set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopDef" of player to black stained glass pane
			set slot 10 of metadata tag "shopDef" of player to stone brick named "&7&lTier 1 Defense Block" with lore "", "&aPrice: $5000" and ""
			set slot 11 of metadata tag "shopDef" of player to basalt named "&7&lTier 2 Defense Block" with lore "", "&aPrice: $20000" and ""
			set slot 12 of metadata tag "shopDef" of player to polished deepslate named "&7&lTier 3 Defense Block" with lore "", "&aPrice: $100000" and ""
			set slot 13 of metadata tag "shopDef" of player to iron trapdoor named "&f&lTier 2 Trapdoor" with lore "", "&aPrice: $25000" and ""
			set slot 14 of metadata tag "shopDef" of player to beacon named "&b&lRespawn Block" with lore "", "&aPrice: $20000" and ""
			open (metadata tag "shopDef" of player) to player
		if index of event-slot is 1:
			set metadata tag "shopGen" of player to chest inventory with 6 rows named "{@genname}"
			set slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 26, 27, 35, 36, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 of metadata tag "shopGen" of player to black stained glass pane
			set slot 10 of metadata tag "shopGen" of player to white glazed terracotta named "&fWhite Generator &8[&6T1&8]" with lore "", "&aPrice: $100" and ""
			open (metadata tag "shopGen" of player) to player
	if event-inventory = (metadata tag "shopDef" of player):
		cancel event
		if index of event-slot is 10:
			buy(player, 5000, "&7&lTier 1 Defense Block", stone brick)
		if index of event-slot is 11:
			buy(player, 20000, "&7&lTier 2 Defense Block", basalt)
		if index of event-slot is 12:
			buy(player, 100000, "&7&lTier 3 Defense Block", polished deepslate)
		if index of event-slot is 13:
			buy(player, 25000, "&f&lTier 2 Trapdoor", iron trapdoor)
		if index of event-slot is 14:
			buy(player, 20000, "&b&lRespawn Block", beacon)
	if event-inventory = (metadata tag "shopGen" of player):
		cancel event
		if index of event-slot is 10:
			buy(player, 100, "&fWhite Generator &8[&6T1&8]", white glazed terracotta)

 

thanks thats very usefull and it works

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...