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.

How do I give someone random items?

Discussion in 'Skript' started by usernamepassword, Jan 7, 2020.

Thread Status:
Not open for further replies.
  1. usernamepassword

    Joined:
    Jan 2, 2020
    Messages:
    3
    Likes Received:
    0
    Basically I want to give someone random items every 15 seconds?
    By random items i mean just, any item in the game?
    like stained glass, to golden apples?
    Please help..
     
  2. Runakai

    Moderator Supporter

    Joined:
    Apr 27, 2018
    Messages:
    494
    Likes Received:
    31
    Give random item out of all items to player
     
  3. Goose

    Supporter

    Joined:
    Nov 23, 2019
    Messages:
    419
    Likes Received:
    30
    Using Runakai's bit of code, this is what I made.

    Code (Text):
    1. every 15 seconds in "world": #change delay between items given
    2.     loop all players:
    3.         if {random.%loop-player%} is true:
    4.             give random item out of all items to loop-player
    5.         else:
    6.             stop
    7. # all this does is have the player start receiving items regardless if they disabled it before leaving or not
    8. on join:
    9.     set {random.%player%} to true
    10. # this is a command that allows the player to toggle receiving items
    11. command toggle:
    12.     trigger:
    13.         if {random.%player%} is true:
    14.             set {random.%player%} to false
    15.             send "&cYou will no longer receive items!"
    16.         else:
    17.             set {random.%player%} to true
    18.             send "&aYou will now receive items!"
     
Thread Status:
Not open for further replies.

Share This Page

Loading...