Smelter's pickaxe remake

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

Code:
on load:
    delete {sword3::*}
    delete {sword2::*}
    delete {sword1::*}
    add "sharpness" and "fire aspect" and "mending" to {sword3::*}
    add "smite" and "fire aspect" and "looting" to {sword2::*}
    add "bane of arthropods" and "Sweeping Edge" to {sword1::*}
    delete {pick3::*}
    delete {pick2::*}
    delete {pick1::*}
    add "efficiency" and "fortune" to {pick3::*}
    add "silk touch" to {pick2::*}
    add "unbreaking" to {pick1::*}
    delete {axe3::*}
    delete {axe2::*}
    delete {axe1::*}
    add "fortune" and "sharpness" to {axe3::*}
    add "efficiency" to {axe2::*}
    add "silk touch" and "unbreaking" to {axe1::*}
    delete {boot3::*}
    delete {boot2::*}
    delete {boot1::*}
    add "frost walker" and "protection" to {boot3::*}
    add "thorns" to {boot2::*}
    add "Depth Strider" and "unbreaking" to {boot1::*}
    delete {helm3::*}
    delete {helm2::*}
    delete {helm1::*}
    add "protection" to {helm3::*}
    add "thorns" to {helm2::*}
    add "respiration" and "unbreaking" to {helm1::*}
    delete {armor3::*}
    delete {armor2::*}
    delete {armor1::*}
    add "protection" to {armor3::*}
    add "thorns" and "blast protection" to {armor2::*}
    add "unbreaking" and "fire protection" to {armor1::*}
    delete {bow3::*}
    delete {bow2::*}
    delete {bow1::*}
    add "power" to {bow3::*}
    add "punch" to {bow2::*}
    add "unbreaking" to {bow1::*}
    delete {tri3::*}
    delete {tri2::*}
    delete {tri1::*}
    add "riptide" to {tri3::*}
    add "loyalty" to {tri2::*}
    add "unbreaking" to {tri1::*}
    delete {cross3::*}
    delete {cross2::*}
    delete {cross1::*}
    add "multishot" to {cross3::*}
    add "piercing" to {cross2::*}
    add "unbreaking" to {cross1::*}



on join:
    if {players::*} does not contain player:
        add player to {players::*}
        set {cob::%player%} to 0
        
on death:
    if attacker is player:
        if victim is player:
            if {cooldown::%attacker%} is 0:
                add 1 to {cob::%attacker%}
                set {cooldown::%attacker%} to 120
            if {cooldown::%attacker%} is not set:
                add 1 to {cob::%attacker%}
                set {cooldown::%attacker%} to 120
        
every second:
    loop all players:
        if {cooldown::%loop-player%} is set:
            if {cooldown::%loop-player%} is more than 0:
                remove 1 from {cooldown::%loop-player%}
                set {_cooldown} to "%{cooldown::%loop-player%}% seconds" parsed as a timespan
                send action bar "&L&cCogs: &f%{cob::%loop-player%}% / &cCooldown: &f%{_cooldown}%" to loop-player
            else:
                send action bar "&L&cCogs: &f%{cob::%loop-player%}%" to loop-player
        else:
            send action bar "&L&cCogs: &f%{cob::%loop-player%}%" to loop-player
        
        
command /withdraw [<number>]:
    trigger:
        if {cob::%player%} >= arg-1:
            if arg-1 is not less than or equal to 0:
                set {_num} to arg-1
                set {_num} to {_num} / 3
                set {enchnum::%player%} to rounded {_num}
                set {enchnum2::%player%} to arg-1
                set metadata tag "vanillaGUI" of player to chest inventory with 3 rows named "&L&cCog &fEnchanter"
                set slot 0 of metadata tag "vanillaGUI" of player to gray stained glass pane named " "
                loop 50 times:
                    set slot loop-value of metadata tag "vanillaGUI" of player to gray stained glass pane named " "
                set slot 22 of metadata tag "vanillaGUI" of player to enchantment table named "&cClick Here To &aEnchant"
                set slot 13 of metadata tag "vanillaGUI" of player to air
                open (metadata tag "vanillaGUI" of player) to player
            else:
                send "You can not withdraw less than 1 &c&LCog!"
        else:
            send "You need more &L&cCogs!"
command /setcogs [<number>]:
    permission: op
    trigger:
        set {cob::%player%} to arg-1
            
on inventory click:
    if type of event-inventory is anvil inventory:
        cancel event
        close player's inventory
    if type of event-inventory is enchanting table inventory:
        cancel event
        close player's inventory

on inventory click:
    if event-inventory = (metadata tag "vanillaGUI" of player):
        if index of event-slot is 22:
            if slot 22 of current inventory of player is a enchantment table:
                if slot 13 of current inventory of player is a sword:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {sword1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {sword2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {sword3::*}
                if slot 13 of current inventory of player is a pickaxe:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {pick1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {pick2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {pick3::*}
                if slot 13 of current inventory of player is a axe:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {axe1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {axe2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {axe3::*}
                if slot 13 of current inventory of player is a helmet:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {helm1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {helm2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {helm3::*}
                if slot 13 of current inventory of player is boots:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {boot1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {boot2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {boot3::*}
                if slot 13 of current inventory of player is leggings or chestplate:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {armor1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {armor2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {armor3::*}
                if slot 13 of current inventory of player is shield:
                    set {_item} to slot 13 of current inventory of player
                    set {_enchant} to "unbreaking"
                if slot 13 of current inventory of player is a trident:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {tri1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {tri2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {tri3::*}
                if slot 13 of current inventory of player is a bow:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {bow1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {bow2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {bow3::*}
                if slot 13 of current inventory of player is a crossbow:
                    set {_item} to slot 13 of current inventory of player
                    if {enchnum::%player%} is less than or equal to 2:
                        set {_enchant} to random element out of {cross1::*}
                    if {enchnum::%player%} is more than 2:
                        if {enchnum::%player%} is less than or equal to 4:
                            set {_enchant} to random element out of {cross2::*}
                    if {enchnum::%player%} is more than 4:
                        set {_enchant} to random element out of {cross3::*}
                if slot 13 of current inventory of player is not a axe or a sword or a pickaxe or a shovel or boots or leggings or chestplate or helmet or shield or trident or a bow or a crossbow:
                    cancel event
                    stop
                remove {enchnum2::%player%} from {cob::%player%}
                if {enchnum::%player%} is less than 1:
                    set {enchnum::%player%} to 1
                send "You got &a%{_enchant}% %{enchnum::%player%}%" to player
                set {_enchant} to "%{_enchant}% %{enchnum::%player%}%" parsed as enchantment type
                enchant {_item} with {_enchant}
                set slot 13 of metadata tag "vanillaGUI" of player to {_item}
                set slot 22 of metadata tag "vanillaGUI" of player to lime concrete named "&aDone"
                set {close::%player%} to true
                open (metadata tag "vanillaGUI" of player) to player
                set {close::%player%} to false
                play sound "entity.experience_orb.pickup" with volume 10 to the player
        if index of event-slot is not 13:
            cancel event
        else:
        
on inventory close:
    if event-inventory = (metadata tag "vanillaGUI" of player):
        if slot 13 of current inventory of player is not air:
            if {close::%player%} is false:
                give player slot 13 of current inventory of player
 
Thats my code, when you kill someone you get a cog, when u do /withdraw [insert how many cogs] you put a enchantable item in the slot and u get a random enchant. Its a bit unbalanced, so can u add a /refund command with a 30 minute cooldown. It removes the latest enchant, and you get ur cogs back. could u do that?