Solved Inventoryclick

  • 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.

Runakai

Supporter
Apr 27, 2018
496
32
28
21
Hey! I was skripting my shop skript and everything is working fine, but:

code_language.skript:
on inventory click:
    if name of player's current inventory is "&cShop":
        clicked slot is 10:
            cancel event
            wait 1 tick
            open chest with 3 rows named "&cBlöcke" to player
            set slot 18 of player's current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "&c&lZurück"
            set slot 0 of player's current inventory to dirt named "&cErde" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@dirtprice}"
            set slot 1 of player's current inventory to sand named "&cSand" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@sandprice}"
            set slot 2 of player's current inventory to diorite named "&cDiorite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@dioriteprice}"
            set slot 3 of player's current inventory to andesite named "&cAndesite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@andesiteprice}"
            set slot 4 of player's current inventory to andesite named "&cGranite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@graniteprice}"
            set slot 5 of player's current inventory to stone named "&cStein" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@stoneprice}"
            set slot 6 of player's current inventory to gravel named "&cGravel" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@gravelprice}"
            set slot 7 of player's current inventory to end stone named "&cEndstein" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@endprice}"
            set slot 8 of player's current inventory to red sand named "&cRotersand" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@redsandprice}"
            set slot 9 of player's current inventory to glass named "&cGlass" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@glassprice}"
            set slot 9 of player's current inventory to wool named "&cWolle" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@woolprice}"
    if name of player's current inventory is "&cBlöcke":
        cancel event
        if clicked slot is 18:
            open chest with 3 rows named "&cShop" to player
            set slot 10 of player's current inventory to grass named "&6Blöcke"
        if player has enough space for 64 dirt:
            clicked slot is 0:
                if clicked type is LEFT mouse:
                    if {coins::%player%} is more than {@dirtprice}-1:
                        give player a dirt
                        remove {@dirtprice} from {coins::%player%}
                        send "{@buyed1}"

Also when user click on THEIR inventory (slot 0 e.g) The Event is also being executed, But it should only be executed clicking on the chest gui
 
Last edited:
You can use these to check the clicked inventory in your event
 
Status
Not open for further replies.