1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Inventoryclick

Discussion in 'Skript' started by Runakai, Apr 30, 2018.

Tags:
Thread Status:
Not open for further replies.
  1. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    497
    Likes Received:
    31
    Hey! I was skripting my shop skript and everything is working fine, but:

    Code (Skript):
    1.  
    2. on inventory click:
    3.     if name of player's current inventory is "&cShop":
    4.         clicked slot is 10:
    5.             cancel event
    6.             wait 1 tick
    7.             open chest with 3 rows named "&cBlöcke" to player
    8.             set slot 18 of player's current inventory to ("MHF_ArrowLeft" parsed as offline player)'s skull named "&c&lZurück"
    9.             set slot 0 of player's current inventory to dirt named "&cErde" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@dirtprice}"
    10.             set slot 1 of player's current inventory to sand named "&cSand" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@sandprice}"
    11.             set slot 2 of player's current inventory to diorite named "&cDiorite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@dioriteprice}"
    12.             set slot 3 of player's current inventory to andesite named "&cAndesite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@andesiteprice}"
    13.             set slot 4 of player's current inventory to andesite named "&cGranite" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@graniteprice}"
    14.             set slot 5 of player's current inventory to stone named "&cStein" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@stoneprice}"
    15.             set slot 6 of player's current inventory to gravel named "&cGravel" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@gravelprice}"
    16.             set slot 7 of player's current inventory to end stone named "&cEndstein" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@endprice}"
    17.             set slot 8 of player's current inventory to red sand named "&cRotersand" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@redsandprice}"
    18.             set slot 9 of player's current inventory to glass named "&cGlass" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@glassprice}"
    19.             set slot 9 of player's current inventory to wool named "&cWolle" with lore "{@Loreitemjustbuy} ||&7Kostet: &c{@woolprice}"
    20.     if name of player's current inventory is "&cBlöcke":
    21.         cancel event
    22.         if clicked slot is 18:
    23.             open chest with 3 rows named "&cShop" to player
    24.             set slot 10 of player's current inventory to grass named "&6Blöcke"
    25.         if player has enough space for 64 dirt:
    26.             clicked slot is 0:
    27.                 if clicked type is LEFT mouse:
    28.                     if {coins::%player%} is more than {@dirtprice}-1:
    29.                         give player a dirt
    30.                         remove {@dirtprice} from {coins::%player%}
    31.                         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

     
    #1 Runakai, Apr 30, 2018
    Last edited: Apr 30, 2018
  2. Best Answer:
    Post #3 by Snow-Pyon, Apr 30, 2018
  3. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,501
    Likes Received:
    107
    Medals:
    You can use these to check the clicked inventory in your event
     
  4. Snow-Pyon

    Snow-Pyon Well-Known Member

    Joined:
    Jan 25, 2017
    Messages:
    1,236
    Likes Received:
    176
    Medals:
    You don't even have to, the following should work:
    Code (Skript):
    1. if event-inventory is player's top inventory:
    #VanillaSkript
     
Thread Status:
Not open for further replies.

Share This Page

Loading...