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.

Solved Remove random item from player inventory and add it to your own

Discussion in 'Skript' started by midniqhts, Oct 28, 2021.

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

    midniqhts Member

    Joined:
    Oct 28, 2021
    Messages:
    1
    Likes Received:
    0
    Can anyone help me with a code that takes a random item from a specified player's inventory and add it to your own?
     
  2. Best Answer:
    Post #2 by Natalciuu, Oct 29, 2021
  3. Natalciuu

    Natalciuu Member

    Joined:
    Nov 12, 2020
    Messages:
    20
    Likes Received:
    0
    This should work.

    Code (Text):
    1. command /removeitem <player>:
    2.     trigger:
    3.         set {_items::*} to all items of argument's inventory
    4.         set {_item} to random item out of {_items::*}
    5.         remove {_item} from arg-1's inventory
    6.         give player 1 of {_item}
    7.         send "&7Took &c%{_item}% &7from %argument%'s inventory."
     
  4. Allan Noyd

    Allan Noyd Member

    Joined:
    Apr 29, 2021
    Messages:
    33
    Likes Received:
    0
    Code (Text):
    1. command /pickpocket <player>:
    2.     trigger:
    3.         loop items of argument-player:
    4.             chance of 1%:
    5.                 set {_loot} to loop-item
    6.                 remove loop-item from argument-player
    7.                 give {_loot} to command sender
     
Thread Status:
Not open for further replies.

Share This Page

Loading...