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.

I am trying to make a /compress gui

Discussion in 'Skript' started by Smartman_xd, May 17, 2021.

Thread Status:
Not open for further replies.
  1. Smartman_xd

    Smartman_xd Member

    Joined:
    Apr 9, 2021
    Messages:
    2
    Likes Received:
    0
    Problem: My functions dosnt work but i dont get any errors so if anyone could help me it would really make me happy :emoji_slight_smile:

    Code:
    Code (Text):
    1. function compresssel(p: player, i: itemtype, i2: itemtype, done: text):
    2.     set {_amount} to amount of {_i} in {_p}'s inventory
    3.     open chest inventory with 5 rows named "&aCompress Select" to {_p}
    4.     loop 45 times:
    5.         format gui slot (loop-number - 1) of {_p} with lime stained glass pane named " "
    6.     format gui slot 10 of {_p} with 4 of glowing {_i} named "&a&lCompress &ex4" with lore "&7Click me to compress!" to run function compress({_p}, {_i}, 256, 4, {_i2}, {done})
    7.     format gui slot 12 of {_p} with 8 of glowing {_i} named "&a&lCompress &ex8" with lore "&7Click me to compress!" to run function compress({_p}, {_i}, 512, 8, {_i2}, {done})
    8.     format gui slot 14 of {_p} with 16 of glowing {_i} named "&a&lCompress &ex16" with lore "&7Click me to compress!" to run function compress({_p}, {_i}, 1024, 16, {_i2}, {done})
    9.     format gui slot 16 of {_p} with 32 of glowing {_i} named "&a&lCompress &ex32" with lore "&7Click me to compress!" to run function compress({_p}, {_i}, 2048, 32, {_i2}, {done})
    10.     format gui slot 22 of {_p} with 129 of glowing {_i} named "&a&lCompress All" with lore "&7Click me to compress!" to close
    11.     format gui slot 36 of {_p} with 1 of arrow named "&c&lGo Back" with lore "&7Click me to go back" and "&7to the &aCompress Page" to run {_p} command "compress comp"
    12.     format gui slot 40 of {_p} with 1 of {_i} named "&a&lBlocks:" with lore "&2%{_i}%&6: &ax%{_amount}%"
    13.     format gui slot 44 of {_p} with 1 of barrier named "&c&lClose" with lore "&7Click me to close the GUI" to close
    14.  
    15. function compress(p: player, i: itemtype, amount: number, amount2: number, i2: itemtype, donename: text):
    16.     if {_p} have {_amount} of {_i}:
    17.         remove {_amount} of {_i} from {_p}'s inventory
    18.         give {_p} {_amount2} of {_i2} named "%{_donename}%" with lore "&7Mending" and "&7UnPlacable"
    19.         send "&aYou sucessfully compressed &ex%{_amount2}% %{_i}%" to {_p}
    20.         stop
    21.     else:
    22.         send "&cYou dont have enought!" to {_p}
    23.    
    24.    
    25. command /compress [<text>]:
    26.     trigger:
    27.         if arg-1 is not set:
    28.             open chest inventory with 3 rows named "&aCompress&6/&cDecompress" to player
    29.             loop 27 times:
    30.                 format gui slot (loop-number - 1) of player with green stained glass pane named " "
    31.             format gui slot 12 of player with 1 of lime concrete with lore "&7Click to &abuy!" to run player command "compress comp"
    32.             format gui slot 14 of player with 1 of red concrete with lore "&7Click to &abuy!" to run player command "compress decomp"
    33.             format gui slot 22 of player with 1 of barrier named "&c&lClose" with lore "&7Click to close" to close
    34.             stop
    35.         if arg-1 is "comp":
    36.             open chest inventory with 6 rows named "&a&lCompress"  to player
    37.             loop 54 times:
    38.                 format gui slot (loop-number - 1) of player with lime stained glass pane named " "
    39.             format gui slot 10 of player with 1 of oak log with lore "&7Click to &aCompress" to run function compresssel(player, oak log, oak log, &7&lCompressed wood)
    40.             stop
    41.         if arg-1 is "decomp":
    42.             open chest inventory with 6 rows named "&4&lDeCompress"  to player
    43.             loop 54 times:
    44.                 format gui slot (loop-number - 1) of player with red stained glass pane named " "
    45.         if arg-1 is not "decomp" or "comp":
    46.             send "&7Correct Usage: &8/compress (comp/decomp)"
    2021-05-17_13.58.32.png 2021-05-17_13.58.32.png
     
Thread Status:
Not open for further replies.

Share This Page

Loading...