So another player has made me this plugin, but i am trying to see if i can make it into a shop that can be left clicked or right clicked instead of having 2 sections sell and buy. He told me that may have problems but i would like to try.
code_language.skript:
command /openshop:
trigger:
open virtual chest with 3 rows named "&8Shop" to player
format gui slot 0 of player with grass named "&2Buy Blocks" to run player command "/openshopbuyblocks"
format gui slot 1 of player with dirt named "&2Sell Blocks" to run player command "/openshopsellblocks"
command /openshopbuyblocks:
trigger:
open virtual chest with 1 rows named "&2Buy Blocks" to player
format gui slot 0 of player with dirt named "&2Buy 64 Dirt" to run player command "/buydirt"
format gui slot 1 of player with grass block named "&2Buy 64 Grass Blocks" to run player command "/buygrass"
format gui slot 2 of player with stone named "&2Buy 64 Stone" to run player command "/buystone"
command /openshopsellblocks:
trigger:
open virtual chest with 1 rows named "&2Sell Blocks" to player
format gui slot 0 of player with dirt named "&2Sell 64 Dirt" to run player command "/selldirt"
format gui slot 1 of player with grass block named "&2Sell 64 Grass Blocks" to run player command "/sellgrass"
format gui slot 2 of player with stone named "&2Sell 64 Stone" to run player command "/sellstone"
command /buydirt:
trigger:
if player's balance is more than or equal to 10:
subtract 10 from player's balance
message "&cBought 64 Dirt for $&d10&c!"
give player 64 dirt
else:
message "&cError: &dInsufficient funds"
command /buygrass:
trigger:
if player's balance is more than or equal to 20:
subtract 20 from player's balance
message "&cBought 64 Grass Blocks for $&d20&c!"
give player 64 grass
else:
message "&cError: &dInsufficient funds"
command /buystone:
trigger:
if player's balance is more than or equal to 30:
subtract 30 from player's balance
message "&cBought 64 Stone for $&d30&c!"
give player 64 stone
else:
message "&cError: &dInsufficient funds"
command /selldirt:
trigger:
if player has 64 dirt:
add 10 to player's balance
message "&cSold 64 Dirt for $&d10&c!"
remove 64 dirt from player
else:
message "&cError: &dYou dont have 64 dirt to sell!"
command /sellgrass:
trigger:
if player has 64 grass:
add 20 to player's balance
message "&cSold 64 Grass Blocks for $&d20&c!"
remove 64 grass from player
else:
message "&cError: You dont have 64 Grass Blocks to sell!"
command /sellstone:
trigger:
if player has 64 stone:
add 30 to player's balance
message "&cSold 64 Stone for $&d30&c!"
remove 64 stone from player
else:
message "&cError: You dont have 64 Stone to sell!"