Inventory Search Skript

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

Swirly

Member
Aug 5, 2018
16
0
1
23
Category: Skript

Suggested name: Pat Down Skript

Spigot/Skript Version: Latest

What I want:
A skript where if you do /search and looking at a player they can either accept or deny the request if they accept the player who did /search can see and take items from their inventory.

Ideas for commands:
/search when facing the player
On the recieving end could either open chat and click on accept or deny or just have them as commands.


Ideas for permissions:
search.police or something like that.

When I'd like it by: A week tops maybe.
 
This should probably work although I have not tested it

AppleScript:
command /search:
    permission: search.police
    trigger:
        if player's target is a player:
            set {searching::%player's uuid%} to uuid of player's target
            send "Do you consent to %player% searching you?"
            send formatted "&a<cmd:consent %player%>Yes</cmd>   &c<cmd:reject %player%>No</cmd>" to player's target

command /consent <player>:
    trigger:
        if {searching::%arg-1's uuid%} is player's uuid:
            open player's inventory to arg-1
            send "%arg-1% is now searching your inventory"
            delete {searching::%arg-1's uuid%}

command /reject <player>:
    trigger:
        if {searching::%arg-1's uuid%} is player's uuid:
            send "%arg-1% was denided from searching your inventory"
            delete {searching::%arg-1's uuid%}
 
  • Like
Reactions: DannyDaMannyy
This should probably work although I have not tested it

AppleScript:
command /search:
    permission: search.police
    trigger:
        if player's target is a player:
            set {searching::%player's uuid%} to uuid of player's target
            send "Do you consent to %player% searching you?"
            send formatted "&a<cmd:consent %player%>Yes</cmd>   &c<cmd:reject %player%>No</cmd>" to player's target

command /consent <player>:
    trigger:
        if {searching::%arg-1's uuid%} is player's uuid:
            open player's inventory to arg-1
            send "%arg-1% is now searching your inventory"
            delete {searching::%arg-1's uuid%}

command /reject <player>:
    trigger:
        if {searching::%arg-1's uuid%} is player's uuid:
            send "%arg-1% was denided from searching your inventory"
            delete {searching::%arg-1's uuid%}
this wouldn't work and would cause a dupe glitch
 
opening a player's inventory to another player doesn't make it connected to the actual player's inventory, it creates a new virtual inventory with a copy of the player's, which means that you just effectively duplicated his entire inventory