Solved 1 Kit Per Life?

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

JustADev

Well-Known Member
Apr 8, 2017
379
9
18
22
How do I make it so that players can only use 1 kit per life?
I have tried this but it doesnt work....

Someone help me? would appresh

CODE:
code_language.skript:
on join:
    clear player's inventory
    set slot 0 of player to nether star named "&cKits &7(Right Click)"
    set slot 4 of player to emerald named "&6Perks &7(Right Click)"
    
on right click with nether star:
    if name of player's tool is "&cKits &7(Right Click)":
        make player execute command "/kit"
        
        
        
on right click with emerald:
    if name of player's tool is "&6Perks &7(Right Click)":
        make player execute command "/perks"
        
        
        
command /kit [<text>]:
    trigger:
    #phyco
        if arg-1 is not set:
            wait 2 ticks
            open chest with 5 rows named "&cKits Menu" to player
            play "ITEM_PICKUP" to player at volume 1.5
            format gui slot 10 of player with diamond sword named "&e&nKnight" with lore "||&e★ &fClass &7&l» &fKnight||&e★ &fStatus &7&l» &a&lUNLOCKED||||&7Click to Select" to run player command "/kit Pvp" with left click
        else:
    #pyro
        if argument 1 is "pyro":
            clear player's inventory
            give player a wooden sword named "Flaming Sword"
            give player 1 fire charge named "Flame Bomb"
            equip player with all leather armor
            dye player's helmet (100, 0, 0)
            dye player's chestplate (100, 0, 0)
            dye player's leggings (100, 0, 0)
            dye player's boots (100, 0, 0)
            set {Class.%player%} to "Pyro"
        else:
        if argument 1 is "Pvp":
            if {HasKit.%player%} is "False":
            set {HasKit.%player%} to "True"
            close player's inventory
            clear player's inventory
            give player a diamond sword
            give player 10 golden apples
            give player 34 mushroom stews
            equip player with all iron armor
            play "SUCCESSFUL_HIT" to player at volume 1.2
            send "&8[&cKit&8] &7You have selected the &cPvp Kit"
            set {Class.%player%} to "Pvp"
        Else:
            send "&8[&cKit&8] &7You have already selected a kit"
            
            
            
#        if argument 1 is not "tank", "knight", "pyro", "magician", "scout", "Pvp", or "phyco":
#            message "<red>Invalid class. Valid classes are tank, knight, pyro, magician, and phyco."
            
#            dye player's boots (100, 0, 0)
    
    
on death of player:
    set {Class.%victim%} to "None"
    set {HasKit.%victim%} to "False"
 
Wait like this?

CODE:
code_language.skript:
on respawn:
    clear player's inventory
    set slot 0 of player to nether star named "&cKits &7(Right Click)"
    set slot 4 of player to emerald named "&6Perks &7(Right Click)"
    
on right click with nether star:
    if name of player's tool is "&cKits &7(Right Click)":
        make player execute command "/kit"
        
        
        
on right click with emerald:
    if name of player's tool is "&6Perks &7(Right Click)":
        make player execute command "/perks"
        
        
        
command /kit [<text>]:
    trigger:
    #phyco
        if arg-1 is not set:
            wait 2 ticks
            open chest with 5 rows named "&cKits Menu" to player
            play "ITEM_PICKUP" to player at volume 1.5
            format gui slot 10 of player with diamond sword named "&e&nKnight" with lore "||&e★ &fClass &7&l» &fKnight||&e★ &fStatus &7&l» &a&lUNLOCKED||||&7Click to Select" to run player command "/kit Pvp" with left click
        else:
    #pyro
        if argument 1 is "pyro":
            clear player's inventory
            give player a wooden sword named "Flaming Sword"
            give player 1 fire charge named "Flame Bomb"
            equip player with all leather armor
            dye player's helmet (100, 0, 0)
            dye player's chestplate (100, 0, 0)
            dye player's leggings (100, 0, 0)
            dye player's boots (100, 0, 0)
            set {Class.%player%} to "Pyro"
        else:
        if argument 1 is "Pvp":
            if {Class.%player%} isn't set:
            set {Class.%player%} to "Pvp"
            close player's inventory
            clear player's inventory
            give player a diamond sword
            give player 10 golden apples
            give player 34 mushroom stews
            equip player with all iron armor
            play "SUCCESSFUL_HIT" to player at volume 1.2
            send "&8[&cKit&8] &7You have selected the &cPvp Kit"
        Else:
            if {Class.%player%} is set:
            send "&8[&cKit&8] &7You have already selected a kit"
            close player's inventory
            
            
            
#        if argument 1 is not "tank", "knight", "pyro", "magician", "scout", "Pvp", or "phyco":
#            message "<red>Invalid class. Valid classes are tank, knight, pyro, magician, and phyco."
            
#            dye player's boots (100, 0, 0)
    
    
on death of player:
    delete {Class.%victim%}
    set {HasKit.%victim%} to "False"
 
Wait like this?

CODE:
code_language.skript:
on respawn:
    clear player's inventory
    set slot 0 of player to nether star named "&cKits &7(Right Click)"
    set slot 4 of player to emerald named "&6Perks &7(Right Click)"
   
on right click with nether star:
    if name of player's tool is "&cKits &7(Right Click)":
        make player execute command "/kit"
       
       
       
on right click with emerald:
    if name of player's tool is "&6Perks &7(Right Click)":
        make player execute command "/perks"
       
       
       
command /kit [<text>]:
    trigger:
    #phyco
        if arg-1 is not set:
            wait 2 ticks
            open chest with 5 rows named "&cKits Menu" to player
            play "ITEM_PICKUP" to player at volume 1.5
            format gui slot 10 of player with diamond sword named "&e&nKnight" with lore "||&e★ &fClass &7&l» &fKnight||&e★ &fStatus &7&l» &a&lUNLOCKED||||&7Click to Select" to run player command "/kit Pvp" with left click
        else:
    #pyro
        if argument 1 is "pyro":
            clear player's inventory
            give player a wooden sword named "Flaming Sword"
            give player 1 fire charge named "Flame Bomb"
            equip player with all leather armor
            dye player's helmet (100, 0, 0)
            dye player's chestplate (100, 0, 0)
            dye player's leggings (100, 0, 0)
            dye player's boots (100, 0, 0)
            set {Class.%player%} to "Pyro"
        else:
        if argument 1 is "Pvp":
            if {Class.%player%} isn't set:
            set {Class.%player%} to "Pvp"
            close player's inventory
            clear player's inventory
            give player a diamond sword
            give player 10 golden apples
            give player 34 mushroom stews
            equip player with all iron armor
            play "SUCCESSFUL_HIT" to player at volume 1.2
            send "&8[&cKit&8] &7You have selected the &cPvp Kit"
        Else:
            if {Class.%player%} is set:
            send "&8[&cKit&8] &7You have already selected a kit"
            close player's inventory
           
           
           
#        if argument 1 is not "tank", "knight", "pyro", "magician", "scout", "Pvp", or "phyco":
#            message "<red>Invalid class. Valid classes are tank, knight, pyro, magician, and phyco."
           
#            dye player's boots (100, 0, 0)
   
   
on death of player:
    delete {Class.%victim%}
    set {HasKit.%victim%} to "False"
Pretty much yea :emoji_slight_smile:
 
in your GUI Trigger, you need to set the variable there i think. Because you have only set the variable in the "pvp" thingy.
 
I did do that,but still not working

CODE:

code_language.skript:
on respawn:
    clear player's inventory
    set slot 0 of player to nether star named "&cKits &7(Right Click)"
    set slot 4 of player to emerald named "&6Perks &7(Right Click)"
    
on right click with nether star:
    if name of player's tool is "&cKits &7(Right Click)":
        make player execute command "/kit"
        
        
        
on right click with emerald:
    if name of player's tool is "&6Perks &7(Right Click)":
        make player execute command "/perks"
        
        
        
command /kit [<text>]:
    trigger:
    #phyco
        if arg-1 is not set:
            wait 2 ticks
            open chest with 5 rows named "&cKits Menu" to player
            play "ITEM_PICKUP" to player at volume 1.5
            format gui slot 10 of player with diamond sword named "&e&nKnight" with lore "||&e★ &fClass &7&l» &fKnight||&e★ &fStatus &7&l» &a&lUNLOCKED||||&7Click to Select" to run player command "/kit Pvp" with left click
        else:
        if argument 1 is "Pvp":
            if {Class.%player%} is not set:
            set {Class.%player%} to "Pvp"
            close player's inventory
            clear player's inventory
            give player a diamond sword
            give player 10 golden apples
            give player 34 mushroom stews
            equip player with all iron armor
            play "SUCCESSFUL_HIT" to player at volume 1.2
            send "&8[&cKit&8] &7You have selected the &cPvp Kit"
        Else:
            if {Class.%player%} is set:
            play "VILLAGER_NO" to player at volume 0.8
            send "&8[&cKit&8] &7You have already selected a kit"
            close player's inventory
            
            
            
#        if argument 1 is not "tank", "knight", "pyro", "magician", "scout", "Pvp", or "phyco":
#            message "<red>Invalid class. Valid classes are tank, knight, pyro, magician, and phyco."
            
#            dye player's boots (100, 0, 0)
    
    
on death of player:
    delete {Class.%victim%}
    set {HasKit.%victim%} to "False"
[doublepost=1501517280,1501517232][/doublepost]Can u send me code example?
 
code_language.skript:
command /kit:
    trigger:
        if {kit::%uuid of player%} isn't set:
            set {kit::%uuid of player%} to "TEST"
            message "Kit selected"
            stop
        else:
            message "You already have a kit."
            stop

on death of player:
    delete {kit::%uuid of player%}
 
Code:
command /kit [<text>]:
    trigger:
        If {Class.%player%} is not set:
        #phyco
            if arg-1 is not set:
                wait 2 ticks
                open chest with 5 rows named "&cKits Menu" to player
                play "ITEM_PICKUP" to player at volume 1.5
                format gui slot 10 of player with diamond sword named "&e&nKnight" with lore "||&e★ &fClass &7&l» &fKnight||&e★ &fStatus &7&l» &a&lUNLOCKED||||&7Click to Select" to run player command "/kit Pvp" with left click
            else:
        #pyro
            if argument 1 is "pyro":
                clear player's inventory
                give player a wooden sword named "Flaming Sword"
                give player 1 fire charge named "Flame Bomb"
                equip player with all leather armor
                dye player's helmet (100, 0, 0)
                dye player's chestplate (100, 0, 0)
                dye player's leggings (100, 0, 0)
                dye player's boots (100, 0, 0)
                set {Class.%player%} to "Pyro"
            else:
            if argument 1 is "Pvp":
                set {Class.%player%} to "Pvp"
                close player's inventory
                clear player's inventory
                give player a diamond sword
                give player 10 golden apples
                give player 34 mushroom stews
                equip player with all iron armor
                play "SUCCESSFUL_HIT" to player at volume 1.2
                send "&8[&cKit&8] &7You have selected the &cPvp Kit"
        Else:
            Send "&8[&cKit&8] /7You have already selected a kit"
 
Status
Not open for further replies.