Restore items on respawn if condition is met

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

    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.

Gerlif

New Member
Apr 23, 2017
8
0
0
Hey, so I'm trying to write a Skript that saves player inventories on death, but only if the player has a certain item in their inventory when dying.

How do I check if player drops contain a certain item? So far I've tried this, but its not working.

Code:
on death of player:
    if player has permission "admin.admin":
        set {deathdrops.%uuid of victim%::*} to drops
        if {deathdrops.%uuid of victim%::*} contains 1 bedrock:
            set {voidcrystalused.%uuid of player%} to true
            message "Inventory saved"
            clear drops

on respawn:
    if player has permission "admin.admin":
        if {voidcrystalused.%uuid of player%} is true:
            add {deathdrops.%uuid of player%::*} to player's inventory
            message "Inventory added"
            set {voidcrystalused.%uuid of player%} to false
 
Status
Not open for further replies.