help with create kit in side the game

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

Feb 24, 2017
191
7
0
23
foroendertheth.foroactivo.com
Just give me an example explaining everything please and thanks
code_language.skript:
ELROMPEDIENTES
Member
Code (Skript):
function leather(p: player):
    clear {_p}
    set helmet of {_p} to leather helmet
    set chestplate of {_p} to leather chestplate
    set leggings of {_p} to leather leggings
    set boots of {_p} to leather boots
    dye {_p}'s helmet red
    dye {_p}'s leggings lime
    dye {_p}'s chestplate lime
    dye {_p}'s boots red
command /kit [<text>]:
    trigger:
        if arg 1 is "lether":
            leather(player)
        if arg 1 is "create":
            #now how do I make that all items in the player's inventory
            #create a function like leather and a new
            #if arg 1 is "kit that the player crate in game"
            #execute the function that creates in game with the name of the kit
            #name of kit(player)
        else:
            send "kit lether"
            player has permission "kitpvp.admin"
            send "kit create"
 
Last edited:
Here you go
code_language.skript:
function createKit(p:player,name:text):
    message "&7Creating kit %{_name}%..." to {_p}
    set {_count} to 0
    loop 36 times:
        set {kit.%{_name}%.%{_count}%.slot} to slot {_count} of {_p}'s inventory
        add 1 to {_count}
    set {kit.%{_name}%.helmet} to {_p}'s helmet
    set {kit.%{_name}%.chestplate} to {_p}'s chestplate
    set {kit.%{_name}%.leggings} to {_p}'s leggings
    set {kit.%{_name}%.boots} to {_p}'s boots
    add {_name} to {kit.list::*}
    message "&7The kit %{_name}% has been created!" to {_p}


To get a kit use this
code_language.skript:
function getKit(p:player,name:text):
    clear {_p}'s inventory
    set {_count} to 0
    loop 36 times:
        set slot {_count} of {_p}'s inventory to {kit.%{_name}%.%{_count}%.slot}
        add 1 to {_count}
    set {_p}'s helmet to {kit.%{_name}%.helmet}
    set {_p}'s chestplate to {kit.%{_name}%.chestplate}
    set {_p}'s leggings to {kit.%{_name}%.leggings}
    set {_p}'s boots to {kit.%{_name}%.boots}