I am trying to make a /compress gui

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

Smartman_xd

Member
Apr 9, 2021
2
0
1
24
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:
function compresssel(p: player, i: itemtype, i2: itemtype, done: text):
    set {_amount} to amount of {_i} in {_p}'s inventory
    open chest inventory with 5 rows named "&aCompress Select" to {_p}
    loop 45 times:
        format gui slot (loop-number - 1) of {_p} with lime stained glass pane named " "
    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})
    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})
    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})
    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})
    format gui slot 22 of {_p} with 129 of glowing {_i} named "&a&lCompress All" with lore "&7Click me to compress!" to close
    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"
    format gui slot 40 of {_p} with 1 of {_i} named "&a&lBlocks:" with lore "&2%{_i}%&6: &ax%{_amount}%"
    format gui slot 44 of {_p} with 1 of barrier named "&c&lClose" with lore "&7Click me to close the GUI" to close

function compress(p: player, i: itemtype, amount: number, amount2: number, i2: itemtype, donename: text):
    if {_p} have {_amount} of {_i}:
        remove {_amount} of {_i} from {_p}'s inventory
        give {_p} {_amount2} of {_i2} named "%{_donename}%" with lore "&7Mending" and "&7UnPlacable"
        send "&aYou sucessfully compressed &ex%{_amount2}% %{_i}%" to {_p}
        stop
    else:
        send "&cYou dont have enought!" to {_p}
    
    
command /compress [<text>]:
    trigger:
        if arg-1 is not set:
            open chest inventory with 3 rows named "&aCompress&6/&cDecompress" to player
            loop 27 times:
                format gui slot (loop-number - 1) of player with green stained glass pane named " "
            format gui slot 12 of player with 1 of lime concrete with lore "&7Click to &abuy!" to run player command "compress comp"
            format gui slot 14 of player with 1 of red concrete with lore "&7Click to &abuy!" to run player command "compress decomp"
            format gui slot 22 of player with 1 of barrier named "&c&lClose" with lore "&7Click to close" to close
            stop
        if arg-1 is "comp":
            open chest inventory with 6 rows named "&a&lCompress"  to player
            loop 54 times:
                format gui slot (loop-number - 1) of player with lime stained glass pane named " "
            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)
            stop
        if arg-1 is "decomp":
            open chest inventory with 6 rows named "&4&lDeCompress"  to player
            loop 54 times:
                format gui slot (loop-number - 1) of player with red stained glass pane named " "
        if arg-1 is not "decomp" or "comp":
            send "&7Correct Usage: &8/compress (comp/decomp)"

2021-05-17_13.58.32.png
2021-05-17_13.58.32.png
 
Status
Not open for further replies.