[CLOSED] I'll make anything

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

TPGamesNL

Staff member
Moderator
Supporter
Addon Developer
Dev Programme
Jan 20, 2018
1,501
108
63
20
I don't really have any ideas to do, so if you send me something to make, I'll make it for you. It can be anything, small, big, easy, complicated, whatever you want. If you have any questions, feel free to ask. :emoji_slight_smile:

Currently closed, DM me if you really want to have something made and we'll discuss it.

Back in business, but now paid. Reply here or DM me on the forums / Discord (TPGamesNL#0880) and we'll discuss it.


And it's closed again. If you're still interested and if the thing you want made is complex but not big, DM anyway (just don't get your hopes up)
 
Last edited:
  • Like
Reactions: Runakai
I don't really have any ideas to do, so if you send me something to make, I'll make it for you. It can be anything, small, big, easy, complicated, whatever you want. If you have any questions, feel free to ask. :emoji_slight_smile:
Hehe, :emoji_wink: I'd like to have a case skript where you can add items ingame with chances and open like a CSGO Spin-Thing just by rightclicking with a specific player's head which will be removed when using the crate.
 
@FabricioSouza I have finished most of the animation, but do you also want the GUI or just the animation?

@Runakai1 could you send me something like a video of that CSGO spin thing?
 
@FabricioSouza I have finished most of the animation, but do you also want the GUI or just the animation?

@Runakai1 could you send me something like a video of that CSGO spin thing?
upload_2018-5-11_15-24-56.png
 
You already finished with the part of the customized heads that is rotated between the chest of the end.
 
You already finished with the part of the customized heads that is rotated between the chest of the end.
yes but I just have to add direction support for that part
[doublepost=1526063427,1526051307][/doublepost]Okay @FabricioSouza I finished it for dev23 and it required SkQuery, Biosphere2, Skellett and Umbaska:
code_language.skript:
options:
    skull-owner: MHF_Question
    skull-owner-2: MHF_Exclamation

function animation(loct: location, p: player):
    set {_b} to block above block at {_loct}
    set {_f} to facing of block above block at {_loct}
    if {_f} is north:
        set {_angle} to 3.1
        set {_d} to "z"
    else if {_f} is east:
        set {_angle} to 4.75
        set {_d} to "x"
    else if {_f} is south:
        set {_d} to "z"
        set {_angle} to 0
    else if {_f} is west:
        set {_d} to "x"
        set {_angle} to 1.55
    evaluate "openChest({_b}, 7.5 seconds)"
    set {_loct2} to {_loct}
    add 0.5 to y coord of {_loct2}
    loop 6 times:
        spawn armor stand at location of block at {_loct}
        set {_as} to last spawned armor stand
        add {_as} to {_as::*}
        set visible of {_as} to false
        set small of {_as} to true
        set gravity of {_as} to false
        set helmet of {_as} to skull of "{@skull-owner}" parsed as a offline player
        set {_asloc} to location of {_as}
        set y coord of {_asloc} to y coord of {_as} + 5
        teleport {_as} to {_asloc}
        loop 5 times:
            add 1/6 to y coord of {_asloc}
            teleport {_as} to {_asloc}
            wait 1 tick
        set y coord of {_asloc} to y coord of {_loct} + 1.5
        teleport {_as} to {_asloc}
        circleAS({_as}, {_asloc}, {_b}, {_loct2}, {_angle}, {_d})
    wait 2 seconds
    set {_l} to size of {_as::*}
    delete {_as::%{_l}%}
    set {_l::*} to {_as::*}
    loop {_l::*}:
        set {_o} to random element out of {_as::*}
        remove {_o} from {_as::*}
        kill {_o}
        wait 4 ticks
    set metadata "stop" of {_as} to true
    while metadata "stopped" of {_as} is not set:
        wait 1 tick
    set {_asloc} to location of {_as}
    loop 3 times:
        remove 0.1 from y coord of {_asloc}
        teleport {_as} to {_asloc}
        wait 3 ticks
    wait 2 ticks
    set custom name visible of {_as} to true
    set custom name of {_as} to "&kabcdefghijklmnop"
    wait 1.5 seconds
    show mob spawner flames at location of block above {_as} to all players
    set helmet of {_as} to skull of "{@skull-owner-2}" parsed as a offline player
    set custom name of {_as} to "&cYour price!"
    # price code
    give {_p} 1 diamond
    send "&aYou got &ba diamond &afrom a crate!" to {_p}
    # price code
    wait 2 seconds
    kill {_as}
  
function openChest(b: block, t: timespan):
    set {_now} to now
    while {_now} was less than {_t} ago:
        skellett make {_b} look open for all players
        wait 1 tick
      
function circleAS(as: entity, asloc: location, b: block, loct: location, angle: number, d: text):
    set {_l::*} to circle at location of {_b} with radius 1 and density 5
    loop {_l::*}:
        set {_loc2} to loop-value
        if {_d} is "z":
            set z coord of {_loc2} to z coord of {_loct}
            set y coord of {_loc2} to y coord of {_loct} - (z coord of {_loct} - z coord of loop-value)
            set z coord of {_loc2} to z coord of {_loct}
        else:
            set x coord of {_loc2} to x coord of {_loct}
            set y coord of {_loc2} to y coord of {_loct} - (x coord of {_loct} - x coord of loop-value)
            set x coord of {_loc2} to x coord of {_loct}
        set {_l::%loop-index%} to {_loc2}
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 24
        if {_i} > size of {_l::*}:
            remove size of {_l::*} from {_i}
        set {_l2::%{_i}%} to loop-value
    while true:
        loop {_l2::*}:
            teleport {_as} to loop-value
            set head y angle of {_as} to {_angle}
            wait 1 tick
        teleport {_as} to {_asloc}
        if metadata "stop" of {_as} is true:
            wait 10 ticks
            set metadata "stopped" of {_as} to true
            stop
  
on right click on ender chest:
    cancel event
    set {_loc} to location of clicked block
    remove 1.5 from y coord of {_loc}
    animation({_loc}, player)
If you find any bugs tell me and I'll fix them
Here is a video I've made from the script, so this is what it should look like:
[doublepost=1526116894][/doublepost]@Runakai1 I made it for the newest version (dev35b) and it requires SkQuery and Skellett
Code:
code_language.skript:
options:
    items-gui-name: &aCrate Items
    crate-gui-name: &aCSGO Crate

command /csgoitems [<text>]:
    permission: admin
    trigger:
        set {_s::*} to split arg-1 at " "
        if {_s::1} is "list":
            loop {csgocrate::items::*}:
                set {_t} to "%loop-value%"
                add 1 to {_items::%{_t}%}
            if {_items::*} is not set:
                message "&cNo items defined!"
                stop
            set {_rows} to rounded up (size of {_items::*} / 9)
            open chest with {_rows} rows named "{@items-gui-name}" to player
            set {_i} to 0
            loop {_items::*}:
                set slot {_i} of player's current inventory to loop-index parsed as a item named "&a%firstCapital(loop-index)%" with lore "&7Chance: %loop-value%"
                add 1 to {_i}
            stop
        if {_s::1} is "add":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if {_s::2} parsed as a number is not set:
                message "&cThe second argument has to be a number! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_c} to {_s::2} parsed as a number
            if {_c} <= 0:
                message "&cYour number must be positive and can't be 0! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if "%{_c}%" contains ".":
                message "&cYour number must be a full number (1, 4, 8, 3) Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if tool of player is air:
                message "&cYou can't add air to the list! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            loop {_c} times:
                add tool of player to {csgocrate::items::*}
            message "&a%firstCapital(tool of player)% added to the list with chance %{_c}%!"
            stop
        if {_s::1} is "remove":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems remove <item>"
                stop
            delete {_s::1}
            set {_item} to join {_s::*} with " "
            if {_item} parsed as a item is not set:
                message "&cThe second argument has to be a item! Usage: /csgoitems remove <item>"
                stop
            remove every {_item} parsed as a item from {csgocrate::items::*}
            message "&a%firstCapital({_item})% removed from the list!"
                
on inventory click:
    name of player's current inventory is "{@items-gui-name}" or "{@crate-gui-name}"
    cancel event
                
function firstCapital(t: object) :: string:
    set {_l::*} to split "%{_t}%" at ""
    set {_l::1} to {_l::1} in upper case
    return join {_l::*} with ""
    
on join:
    delete {csgocrate::opening::%player%}
    
on disconnect:
    delete {csgocrate::opening::%player%}
    
function openCSGOCrate(p: player, new: boolean):
    if {_new} is true:
        set {csgocrate::opening::%{_p}%} to true
    open chest with 3 rows named "{@crate-gui-name}" to {_p}
    loop 2 times:
        loop 3 times:
            set slot ((loop-number-2) - 1) * 9 + ((loop-number-1) - 1) * 8 of {_p}'s current inventory to black glass named ""
    loop 2 times:
        loop 2 times:
            loop 3 times:
                set slot (((loop-number-3) + ((loop-number-2) - 1) * 18) + ((loop-number-1) - 1) * 4) of {_p}'s current inventory to red glass named ""
    loop 2 times:
        set slot ((loop-number - 1) * 18) + 4 of {_p}'s current inventory to torch named ""
    if {_new} is false:
        stop
    loop 100 times:
        add random element of {csgocrate::items::*} to {_items::*}
    loop 10 times:
        add 0.15 seconds to {_times::*}
    loop 10 times:
        add "%loop-number/20+0.15% seconds" parsed as a timespan to {_times::*}
    set {_l::*} to {_items::*}
    loop {_times::*}:
        set {_l::*} to cycleList({_l::*})
        if name of {_p}'s current inventory is "{@crate-gui-name}":
            play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p} with volume 1 and pitch 3
            set {_i} to 0
            loop 7 times:
                set slot loop-number + 9 of {_p}'s current inventory to {_l::%loop-number%}
        wait loop-value
    if {_new}:
        delete {csgocrate::opening::%{_p}%}
    set {_f} to {_l::4}
    play sound "ENTITY_FIREWORK_BLAST" to {_p} with volume 1 and pitch 1
    loop 3 times:
        show mob spawner flames at {_p} to all players
    give {_f} to {_p}
    send "&aYou got &e%{_f}% &afrom a CSGO crate!" to {_p}
    
function cycleList(l: objects) :: objects:
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 1
        set {_out::%{_i}%} to loop-value
    set {_s} to size of {_out::*} + 1
    set {_out::1} to {_out::%{_s}%}
    delete {_out::%{_s}%}
    return {_out::*}
            
on right click:
    tool of player is player head
    if {csgocrate::opening::%player%} is set:
        openCSGOCrate(player, false)
        stop
    if {csgocrate::items::*} is not set:
        message "&cNo items defined!"
        stop
    remove 1 player head from tool of player
    openCSGOCrate(player, true)
Video:
(It has sound effects but my recording software didn't add it)
Also if you find any bugs please tell me and I'll try my best to fix them
 
yes but I just have to add direction support for that part
[doublepost=1526063427,1526051307][/doublepost]Okay @FabricioSouza I finished it for dev23 and it required SkQuery, Biosphere2, Skellett and Umbaska:
code_language.skript:
options:
    skull-owner: MHF_Question
    skull-owner-2: MHF_Exclamation

function animation(loct: location, p: player):
    set {_b} to block above block at {_loct}
    set {_f} to facing of block above block at {_loct}
    if {_f} is north:
        set {_angle} to 3.1
        set {_d} to "z"
    else if {_f} is east:
        set {_angle} to 4.75
        set {_d} to "x"
    else if {_f} is south:
        set {_d} to "z"
        set {_angle} to 0
    else if {_f} is west:
        set {_d} to "x"
        set {_angle} to 1.55
    evaluate "openChest({_b}, 7.5 seconds)"
    set {_loct2} to {_loct}
    add 0.5 to y coord of {_loct2}
    loop 6 times:
        spawn armor stand at location of block at {_loct}
        set {_as} to last spawned armor stand
        add {_as} to {_as::*}
        set visible of {_as} to false
        set small of {_as} to true
        set gravity of {_as} to false
        set helmet of {_as} to skull of "{@skull-owner}" parsed as a offline player
        set {_asloc} to location of {_as}
        set y coord of {_asloc} to y coord of {_as} + 5
        teleport {_as} to {_asloc}
        loop 5 times:
            add 1/6 to y coord of {_asloc}
            teleport {_as} to {_asloc}
            wait 1 tick
        set y coord of {_asloc} to y coord of {_loct} + 1.5
        teleport {_as} to {_asloc}
        circleAS({_as}, {_asloc}, {_b}, {_loct2}, {_angle}, {_d})
    wait 2 seconds
    set {_l} to size of {_as::*}
    delete {_as::%{_l}%}
    set {_l::*} to {_as::*}
    loop {_l::*}:
        set {_o} to random element out of {_as::*}
        remove {_o} from {_as::*}
        kill {_o}
        wait 4 ticks
    set metadata "stop" of {_as} to true
    while metadata "stopped" of {_as} is not set:
        wait 1 tick
    set {_asloc} to location of {_as}
    loop 3 times:
        remove 0.1 from y coord of {_asloc}
        teleport {_as} to {_asloc}
        wait 3 ticks
    wait 2 ticks
    set custom name visible of {_as} to true
    set custom name of {_as} to "&kabcdefghijklmnop"
    wait 1.5 seconds
    show mob spawner flames at location of block above {_as} to all players
    set helmet of {_as} to skull of "{@skull-owner-2}" parsed as a offline player
    set custom name of {_as} to "&cYour price!"
    # price code
    give {_p} 1 diamond
    send "&aYou got &ba diamond &afrom a crate!" to {_p}
    # price code
    wait 2 seconds
    kill {_as}
 
function openChest(b: block, t: timespan):
    set {_now} to now
    while {_now} was less than {_t} ago:
        skellett make {_b} look open for all players
        wait 1 tick
     
function circleAS(as: entity, asloc: location, b: block, loct: location, angle: number, d: text):
    set {_l::*} to circle at location of {_b} with radius 1 and density 5
    loop {_l::*}:
        set {_loc2} to loop-value
        if {_d} is "z":
            set z coord of {_loc2} to z coord of {_loct}
            set y coord of {_loc2} to y coord of {_loct} - (z coord of {_loct} - z coord of loop-value)
            set z coord of {_loc2} to z coord of {_loct}
        else:
            set x coord of {_loc2} to x coord of {_loct}
            set y coord of {_loc2} to y coord of {_loct} - (x coord of {_loct} - x coord of loop-value)
            set x coord of {_loc2} to x coord of {_loct}
        set {_l::%loop-index%} to {_loc2}
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 24
        if {_i} > size of {_l::*}:
            remove size of {_l::*} from {_i}
        set {_l2::%{_i}%} to loop-value
    while true:
        loop {_l2::*}:
            teleport {_as} to loop-value
            set head y angle of {_as} to {_angle}
            wait 1 tick
        teleport {_as} to {_asloc}
        if metadata "stop" of {_as} is true:
            wait 10 ticks
            set metadata "stopped" of {_as} to true
            stop
 
on right click on ender chest:
    cancel event
    set {_loc} to location of clicked block
    remove 1.5 from y coord of {_loc}
    animation({_loc}, player)
If you find any bugs tell me and I'll fix them
Here is a video I've made from the script, so this is what it should look like:
[doublepost=1526116894][/doublepost]@Runakai1 I made it for the newest version (dev35b) and it requires SkQuery and Skellett
Code:
code_language.skript:
options:
    items-gui-name: &aCrate Items
    crate-gui-name: &aCSGO Crate

command /csgoitems [<text>]:
    permission: admin
    trigger:
        set {_s::*} to split arg-1 at " "
        if {_s::1} is "list":
            loop {csgocrate::items::*}:
                set {_t} to "%loop-value%"
                add 1 to {_items::%{_t}%}
            if {_items::*} is not set:
                message "&cNo items defined!"
                stop
            set {_rows} to rounded up (size of {_items::*} / 9)
            open chest with {_rows} rows named "{@items-gui-name}" to player
            set {_i} to 0
            loop {_items::*}:
                set slot {_i} of player's current inventory to loop-index parsed as a item named "&a%firstCapital(loop-index)%" with lore "&7Chance: %loop-value%"
                add 1 to {_i}
            stop
        if {_s::1} is "add":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if {_s::2} parsed as a number is not set:
                message "&cThe second argument has to be a number! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_c} to {_s::2} parsed as a number
            if {_c} <= 0:
                message "&cYour number must be positive and can't be 0! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if "%{_c}%" contains ".":
                message "&cYour number must be a full number (1, 4, 8, 3) Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if tool of player is air:
                message "&cYou can't add air to the list! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            loop {_c} times:
                add tool of player to {csgocrate::items::*}
            message "&a%firstCapital(tool of player)% added to the list with chance %{_c}%!"
            stop
        if {_s::1} is "remove":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems remove <item>"
                stop
            delete {_s::1}
            set {_item} to join {_s::*} with " "
            if {_item} parsed as a item is not set:
                message "&cThe second argument has to be a item! Usage: /csgoitems remove <item>"
                stop
            remove every {_item} parsed as a item from {csgocrate::items::*}
            message "&a%firstCapital({_item})% removed from the list!"
               
on inventory click:
    name of player's current inventory is "{@items-gui-name}" or "{@crate-gui-name}"
    cancel event
               
function firstCapital(t: object) :: string:
    set {_l::*} to split "%{_t}%" at ""
    set {_l::1} to {_l::1} in upper case
    return join {_l::*} with ""
   
on join:
    delete {csgocrate::opening::%player%}
   
on disconnect:
    delete {csgocrate::opening::%player%}
   
function openCSGOCrate(p: player, new: boolean):
    if {_new} is true:
        set {csgocrate::opening::%{_p}%} to true
    open chest with 3 rows named "{@crate-gui-name}" to {_p}
    loop 2 times:
        loop 3 times:
            set slot ((loop-number-2) - 1) * 9 + ((loop-number-1) - 1) * 8 of {_p}'s current inventory to black glass named ""
    loop 2 times:
        loop 2 times:
            loop 3 times:
                set slot (((loop-number-3) + ((loop-number-2) - 1) * 18) + ((loop-number-1) - 1) * 4) of {_p}'s current inventory to red glass named ""
    loop 2 times:
        set slot ((loop-number - 1) * 18) + 4 of {_p}'s current inventory to torch named ""
    if {_new} is false:
        stop
    loop 100 times:
        add random element of {csgocrate::items::*} to {_items::*}
    loop 10 times:
        add 0.15 seconds to {_times::*}
    loop 10 times:
        add "%loop-number/20+0.15% seconds" parsed as a timespan to {_times::*}
    set {_l::*} to {_items::*}
    loop {_times::*}:
        set {_l::*} to cycleList({_l::*})
        if name of {_p}'s current inventory is "{@crate-gui-name}":
            play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p} with volume 1 and pitch 3
            set {_i} to 0
            loop 7 times:
                set slot loop-number + 9 of {_p}'s current inventory to {_l::%loop-number%}
        wait loop-value
    if {_new}:
        delete {csgocrate::opening::%{_p}%}
    set {_f} to {_l::4}
    play sound "ENTITY_FIREWORK_BLAST" to {_p} with volume 1 and pitch 1
    loop 3 times:
        show mob spawner flames at {_p} to all players
    give {_f} to {_p}
    send "&aYou got &e%{_f}% &afrom a CSGO crate!" to {_p}
   
function cycleList(l: objects) :: objects:
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 1
        set {_out::%{_i}%} to loop-value
    set {_s} to size of {_out::*} + 1
    set {_out::1} to {_out::%{_s}%}
    delete {_out::%{_s}%}
    return {_out::*}
           
on right click:
    tool of player is player head
    if {csgocrate::opening::%player%} is set:
        openCSGOCrate(player, false)
        stop
    if {csgocrate::items::*} is not set:
        message "&cNo items defined!"
        stop
    remove 1 player head from tool of player
    openCSGOCrate(player, true)
Video:
(It has sound effects but my recording software didn't add it)
Also if you find any bugs please tell me and I'll try my best to fix them
Yeah, there is a little one. If I add e.g sunflowers just with different names it's kinda buggy. Sometimes there appear 2 "10.000Coins" sunflowers even though I just add 1
 
Do you mean that there appear two in the opening itself or in the item list
 
Okay I will try rt fix it tomorrow as I don't have much time now, but there might be a chance I get it done today
 
Okay I think I've fixed the bugs, but if you find any that I've missed, tell me.
code_language.skript:
options:
    items-gui-name: &aCrate Items
    crate-gui-name: &aCSGO Crate

command /csgoitems [<text>]:
    permission: admin
    trigger:
        set {_s::*} to split arg-1 at " "
        if {_s::1} is "list":
            loop {csgocrate::items::*}:
                set {_t} to "%loop-value%<|>%name of loop-value%"
                add 1 to {_items::%{_t}%}
            if {_items::*} is not set:
                message "&cNo items defined!"
                stop
            set {_rows} to rounded up (size of {_items::*} / 9)
            open chest with {_rows} rows named "{@items-gui-name}" to player
            set {_i} to 0
            loop {_items::*}:
                delete {_l::*}
                set {_l::*} to split loop-index at "<|>"
                set slot {_i} of player's current inventory to {_l::1} parsed as a item named "&a%{_l::2}%" with lore "&7Chance: %loop-value%"
                add 1 to {_i}
            stop
        if {_s::1} is "add":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if {_s::2} parsed as a number is not set:
                message "&cThe second argument has to be a number! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_c} to {_s::2} parsed as a number
            if {_c} <= 0:
                message "&cYour number must be positive and can't be 0! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if "%{_c}%" contains ".":
                message "&cYour number must be a full number (1, 4, 8, 3) Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if tool of player is air:
                message "&cYou can't add air to the list! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_item} to "%tool of player%" parsed as an item
            set name of {_item} to name of tool of player
            set lore of {_item} to lore of tool of player
            loop {_c} times:
                add {_item} to {csgocrate::items::*}
            message "&a%firstCapital(tool of player)% added to the list with chance %{_c}%!"
            stop
        if {_s::1} is "remove":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems remove <item>"
                stop
            delete {_s::1}
            set {_item} to join {_s::*} with " "
            if {_item} parsed as a item is not set:
                message "&cThe second argument has to be a item! Usage: /csgoitems remove <item>"
                stop
            loop {csgocrate::items::*}:
                "%loop-value%" is "%{_item} parsed as a item%"
                delete {csgocrate::items::%loop-index%}
            message "&a%firstCapital({_item})% removed from the list!"

on inventory click:
    name of player's current inventory is "{@items-gui-name}" or "{@crate-gui-name}"
    cancel event
                
function firstCapital(t: object) :: string:
    set {_l::*} to split "%{_t}%" at ""
    set {_l::1} to {_l::1} in upper case
    return join {_l::*} with ""
    
on join:
    delete {csgocrate::opening::%player%}
    
on disconnect:
    delete {csgocrate::opening::%player%}
    
function openCSGOCrate(p: player, new: boolean):
    if {_new} is true:
        set {csgocrate::opening::%{_p}%} to true
    open chest with 3 rows named "{@crate-gui-name}" to {_p}
    loop 2 times:
        loop 3 times:
            set slot ((loop-number-2) - 1) * 9 + ((loop-number-1) - 1) * 8 of {_p}'s current inventory to black glass named ""
    loop 2 times:
        loop 2 times:
            loop 3 times:
                set slot (((loop-number-3) + ((loop-number-2) - 1) * 18) + ((loop-number-1) - 1) * 4) of {_p}'s current inventory to red glass named ""
    loop 2 times:
        set slot ((loop-number - 1) * 18) + 4 of {_p}'s current inventory to torch named ""
    if {_new} is false:
        stop
    loop 100 times:
        add random element of {csgocrate::items::*} to {_items::*}
    loop 10 times:
        add 0.15 seconds to {_times::*}
    loop 10 times:
        add "%loop-number/20+0.15% seconds" parsed as a timespan to {_times::*}
    set {_l::*} to {_items::*}
    loop {_times::*}:
        set {_l::*} to cycleList({_l::*})
        if name of {_p}'s current inventory is "{@crate-gui-name}":
            play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p} with volume 1 and pitch 3
            set {_i} to 0
            loop 7 times:
                set slot loop-number + 9 of {_p}'s current inventory to {_l::%loop-number%}
        wait loop-value
    if {_new}:
        delete {csgocrate::opening::%{_p}%}
    set {_f} to {_l::4}
    play sound "ENTITY_FIREWORK_BLAST" to {_p} with volume 1 and pitch 1
    loop 3 times:
        show mob spawner flames at {_p} to all players
    give {_f} to {_p}
    send "&aYou got &e%{_f}% &afrom a CSGO crate!" to {_p}
    
function cycleList(l: objects) :: objects:
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 1
        set {_out::%{_i}%} to loop-value
    set {_s} to size of {_out::*} + 1
    set {_out::1} to {_out::%{_s}%}
    delete {_out::%{_s}%}
    return {_out::*}
            
on right click:
    tool of player is player head
    if {csgocrate::opening::%player%} is set:
        openCSGOCrate(player, false)
        stop
    if {csgocrate::items::*} is not set:
        message "&cNo items defined!"
        stop
    remove 1 player head from tool of player
    openCSGOCrate(player, true)
 
Okay I think I've fixed the bugs, but if you find any that I've missed, tell me.
code_language.skript:
options:
    items-gui-name: &aCrate Items
    crate-gui-name: &aCSGO Crate

command /csgoitems [<text>]:
    permission: admin
    trigger:
        set {_s::*} to split arg-1 at " "
        if {_s::1} is "list":
            loop {csgocrate::items::*}:
                set {_t} to "%loop-value%<|>%name of loop-value%"
                add 1 to {_items::%{_t}%}
            if {_items::*} is not set:
                message "&cNo items defined!"
                stop
            set {_rows} to rounded up (size of {_items::*} / 9)
            open chest with {_rows} rows named "{@items-gui-name}" to player
            set {_i} to 0
            loop {_items::*}:
                delete {_l::*}
                set {_l::*} to split loop-index at "<|>"
                set slot {_i} of player's current inventory to {_l::1} parsed as a item named "&a%{_l::2}%" with lore "&7Chance: %loop-value%"
                add 1 to {_i}
            stop
        if {_s::1} is "add":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if {_s::2} parsed as a number is not set:
                message "&cThe second argument has to be a number! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_c} to {_s::2} parsed as a number
            if {_c} <= 0:
                message "&cYour number must be positive and can't be 0! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if "%{_c}%" contains ".":
                message "&cYour number must be a full number (1, 4, 8, 3) Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            if tool of player is air:
                message "&cYou can't add air to the list! Usage: /csgoitems add <chance> (your held item will be the item)"
                stop
            set {_item} to "%tool of player%" parsed as an item
            set name of {_item} to name of tool of player
            set lore of {_item} to lore of tool of player
            loop {_c} times:
                add {_item} to {csgocrate::items::*}
            message "&a%firstCapital(tool of player)% added to the list with chance %{_c}%!"
            stop
        if {_s::1} is "remove":
            if {_s::2} is not set:
                message "&cPlease input a second argument! Usage: /csgoitems remove <item>"
                stop
            delete {_s::1}
            set {_item} to join {_s::*} with " "
            if {_item} parsed as a item is not set:
                message "&cThe second argument has to be a item! Usage: /csgoitems remove <item>"
                stop
            loop {csgocrate::items::*}:
                "%loop-value%" is "%{_item} parsed as a item%"
                delete {csgocrate::items::%loop-index%}
            message "&a%firstCapital({_item})% removed from the list!"

on inventory click:
    name of player's current inventory is "{@items-gui-name}" or "{@crate-gui-name}"
    cancel event
              
function firstCapital(t: object) :: string:
    set {_l::*} to split "%{_t}%" at ""
    set {_l::1} to {_l::1} in upper case
    return join {_l::*} with ""
  
on join:
    delete {csgocrate::opening::%player%}
  
on disconnect:
    delete {csgocrate::opening::%player%}
  
function openCSGOCrate(p: player, new: boolean):
    if {_new} is true:
        set {csgocrate::opening::%{_p}%} to true
    open chest with 3 rows named "{@crate-gui-name}" to {_p}
    loop 2 times:
        loop 3 times:
            set slot ((loop-number-2) - 1) * 9 + ((loop-number-1) - 1) * 8 of {_p}'s current inventory to black glass named ""
    loop 2 times:
        loop 2 times:
            loop 3 times:
                set slot (((loop-number-3) + ((loop-number-2) - 1) * 18) + ((loop-number-1) - 1) * 4) of {_p}'s current inventory to red glass named ""
    loop 2 times:
        set slot ((loop-number - 1) * 18) + 4 of {_p}'s current inventory to torch named ""
    if {_new} is false:
        stop
    loop 100 times:
        add random element of {csgocrate::items::*} to {_items::*}
    loop 10 times:
        add 0.15 seconds to {_times::*}
    loop 10 times:
        add "%loop-number/20+0.15% seconds" parsed as a timespan to {_times::*}
    set {_l::*} to {_items::*}
    loop {_times::*}:
        set {_l::*} to cycleList({_l::*})
        if name of {_p}'s current inventory is "{@crate-gui-name}":
            play sound "ENTITY_EXPERIENCE_ORB_PICKUP" to {_p} with volume 1 and pitch 3
            set {_i} to 0
            loop 7 times:
                set slot loop-number + 9 of {_p}'s current inventory to {_l::%loop-number%}
        wait loop-value
    if {_new}:
        delete {csgocrate::opening::%{_p}%}
    set {_f} to {_l::4}
    play sound "ENTITY_FIREWORK_BLAST" to {_p} with volume 1 and pitch 1
    loop 3 times:
        show mob spawner flames at {_p} to all players
    give {_f} to {_p}
    send "&aYou got &e%{_f}% &afrom a CSGO crate!" to {_p}
  
function cycleList(l: objects) :: objects:
    loop {_l::*}:
        set {_i} to loop-index parsed as a number + 1
        set {_out::%{_i}%} to loop-value
    set {_s} to size of {_out::*} + 1
    set {_out::1} to {_out::%{_s}%}
    delete {_out::%{_s}%}
    return {_out::*}
          
on right click:
    tool of player is player head
    if {csgocrate::opening::%player%} is set:
        openCSGOCrate(player, false)
        stop
    if {csgocrate::items::*} is not set:
        message "&cNo items defined!"
        stop
    remove 1 player head from tool of player
    openCSGOCrate(player, true)
Yes, there is still one. I can't remove heads with the command. They just don't disappear also: one question: Is it possible to modify this to create different crates? I don't want to have a skript for each crate :/ And: I don't know if this is fixable but if I add the head into the crate its kinda buggy when the spinning part is on. Sometimes there are steve heads and sometimes the head i added
 
Last edited:
Oh wow I just realised that I totally ignored this the last time I saw this. Well hold on I'm going to fix the bugs and add the multiple crates
 
Can you make me a toggle feature to toggle this feature here:
code_language.skript:
on left click:
    player is holding any pickaxe:
        player is sneaking
        cooldown "sellall" of player is finish:
            create cooldown "sellall" for player for 3 seconds
            make player execute "/sellall"
        else:
            send "&dPlease wait &d%cooldown ""sellall"" of player%"
I want the command to be "/togglesell" And whenever you do that you either turn it on or turn it off.
Can you do that?