Looking for right click and left click event skript

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

kalib

New Member
Jan 6, 2019
6
0
0
23
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!"
 
here's an example of how you format a slot 2 different ways for clicks
code_language.skript:
command /test:
    trigger:
        open virtual chest inventory named "&2GUI" to player
        format gui slot 1 of player with stone named "&aClick Me" with lore "&7Left-Click to buy" and "&7Right-Click to sell" to run using "right" click:
            send "right click"
            close inventory of player
        format gui slot 1 of player with stone named "&aClick Me" with lore "&7Left-Click to buy" and "&7Right-Click to sell" to run using "left" click:
            send "left click"
            close inventory of player
 
Status
Not open for further replies.