1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

On inventory help

Discussion in 'Skript' started by varboosted, May 19, 2020 at 6:41 PM.

  1. varboosted

    varboosted Member

    Joined:
    Apr 20, 2020
    Messages:
    10
    Likes Received:
    1
    Hello there is a skript that can do like this example:

    on inventory:
    if name of event-item is "&5&lKIT SELECTOR":
    send "&aPlayer didn't select a kit" to victim
    disable damage
    wait 1 minute
    enable damage
     
  2. Viktor Tim Aggerholm

    Supporter

    Joined:
    Dec 29, 2019
    Messages:
    182
    Likes Received:
    11
    Be more speficic. What do you want done?
     
  3. varboosted

    varboosted Member

    Joined:
    Apr 20, 2020
    Messages:
    10
    Likes Received:
    1
    I have an FFA game that when you respawn you need to select a kit, so i want to disable damage if you have a golden sword called "kit selector" and after 30 sec of not selecting a kit enable damage
     
  4. Viktor Tim Aggerholm

    Supporter

    Joined:
    Dec 29, 2019
    Messages:
    182
    Likes Received:
    11
    this should disable damage when a player is choosing a kit (not tested)
    Code (Text):
    1. on respawn:
    2.     set {invaluable::%player%} to 30
    3.     open chest with 1 row named "Your GUI name" to player
    4.     set slot 0 of player's current inventory to diamond "kit diamond" with lore "get your diamonds here!"
    5.  
    6. on inventory click:
    7.     if name of player's current inventory is "Your GUI name":
    8.         cancel event
    9.         if clicked slot is 0:
    10.             set {invaluable::%loop-player%} to 0
    11.             execute console command "kit diamond %player%"
    12.  
    13. on damage:
    14.     if name of player's current inventory is "Your GUI name":
    15.         if {invaluable::%player%} is > 0:
    16.             cancel event
    17.             send "%victim% is in the middle of choosing a kit" to attacker
    18.            
    19. every second:
    20.     loop all players:
    21.         if {invaluable::%loop-player%} > 0:
    22.             remove 1 from {invaluable::%loop-player%}
     
  5. varboosted

    varboosted Member

    Joined:
    Apr 20, 2020
    Messages:
    10
    Likes Received:
    1
    I don't need to create a server selector since i already have upload_2020-5-23_16-43-32.png


    So when someone died he is teleporting to random location at the map so i want that no one will be able to damage him, and if someone is trying to damage him so he will recieve a message "&a&lThis player has not selected a kit", and after 30 seconds everyone can damage him for no AFK's in the map
     
  6. Viktor Tim Aggerholm

    Supporter

    Joined:
    Dec 29, 2019
    Messages:
    182
    Likes Received:
    11
    this should do the trick
    Code (Text):
    1. options:
    2.     min.x: -500
    3.     max.x: 500
    4.     min.z: -500
    5.     max.z: 500
    6.     avoid: air or water block or lava block
    7.  
    8.  
    9. on death:
    10.     set {_loc::new} to location at random number between {@min.x} and {@max.x}, 0, random number between {@min.z} and {@max.z}
    11.     loop blocks above {_loc::new}:
    12.         if loop-block and block above loop-block are air:
    13.             if block under loop-block is not {@avoid}:
    14.                 set {_loc::new} to location of loop-block
    15.                 teleport player to {_loc::new}
    16.                 set {invaluable::%player%} to 30
    17.                 if light level at player <= 2:
    18.                     set block at player to ground torch
    19.  
    20. on damage:
    21.     if name of victims's current inventory is "Your GUI name":
    22.         if {invaluable::%player%} is > 0:
    23.             cancel event
    24.             send "%victim% is in the middle of choosing a kit" to attacker
    25.          
    26. every second:
    27.     loop all players:
    28.         if {invaluable::%loop-player%} > 0:
    29.             remove 1 from {invaluable::%loop-player%}
     
Loading...