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!

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

Skript Unique search system!

Discussion in 'Tutorials' started by loadka95, Aug 30, 2017.

  1. loadka95

    loadka95 Active Member

    Feb 24, 2017
    Likes Received:
    In the past week i was trying to create a nice search system in minecraft and i finally got it!
    And because im a very nice guy so, Im sharing the code with you and you can build it into your skript! :emoji_slight_smile:

    It's using sign:

    Code (Skript):
    1. function SignSearch(lines: strings, player: player):
    2.    set {_loc} to location of {_player}
    3.    set {_block} to type of block at {_loc}
    4.    set block at {_loc} to sign
    5.    loop {_lines::*}:
    6.       (loop-index parsed as int) < 5
    7.       set line (loop-index parsed as int) of block at {_loc} to "%colored loop-value%"
    8.    wait a tick
    9.    set {_packet} to new play_server_open_sign_editor packet
    10.    set location pinfo 0 of {_packet} to {_loc}
    11.    send {_player} packet {_packet}
    12.    set block at {_loc} to {_block}
    14. command /signsearch <player>:
    15.     trigger:
    16.         set {usingsign.%player%} to true
    17.         set {_lines::*} to "", "/\/\/\/\", "Enter your" and "search!"
    18.         SignSearch({_lines::*},arg)
    20. on packet event play_client_update_sign:
    21.     if {usingsign.%player%} is true:
    22.         set {_lines::*} to string array pinfo 0 of event-packet
    23.         message "You searched for: %{_lines::1}%"
    24.         set {usingsign.%player%} to false
    25.         stop
    How to use it?
    • If you want to search for something use the command /signsearch <player> (you can open the search sign for other people) then enter your search into the first line and click on the DONE button
    • You can get the lines under the on packet event, from {_lines::*}, then do whatever you want with it!

    What is it good for?!
    If you have lot of players on your server, you can search for peoples easly with this system
    Code (Skript):
    1.         loop all players:
    2.             if loop-player's is equal to {_lines::1}:
    3.                 message "the player is online"

    you can search for things in list variables
    Code (Skript):
    1.         loop {yourvariable::*}:
    2.             if loop-value is equal to {_lines::1}:
    3.                 message "Yeah I FOUND IT"


    You need to have ProtocolLib in your plugin folder!

    Sorry for the mistakes in the text, my english is not that good! :/
    noftaly, Uzumaki, Hollish and 2 others like this.
  2. ShaneBee

    Supporter + Addon Developer

    Sep 7, 2017
    Likes Received:
  3. PugaBear

    Addon Developer

    Jan 25, 2017
    Likes Received:
    I made a slight change to make sure that the sign does not break things such as plants:
    Code (Text):
    1. function packetSign(lines: strings, player: player):
    2.     loop blocks in radius 4 around location of {_player}:
    3.         if loop-block is air:
    4.             set {_loc} to location of loop-block
    5.             set block at {_loc} to sign
    6.             loop {_lines::*}:
    7.                 (loop-index parsed as int) < 5
    8.                 set line (loop-index parsed as int) of block at {_loc} to "%colored loop-value-2%"
    9.             wait a tick
    10.             set {_packet} to new play_server_open_sign_editor packet
    11.             set location pinfo 0 of {_packet} to {_loc}
    12.             send {_player} packet {_packet}
    13.             set block at {_loc} to air
    14.             stop
    15.     send "&4&lError: &cCould not place temporary sign" to {_player}
    Basically it just finds the nearest air block and uses that location for the sign, instead of the location of the player's feet.
  4. MrScopes

    MrScopes New Member

    Jan 7, 2018
    Likes Received:
    Thanks, I might use this.
  5. medivh

    medivh Member

    Jan 28, 2017
    Likes Received:
    doesn't work anymore?
  6. Hollish

    Hollish Member

    Feb 19, 2017
    Likes Received:
    This is awesome, thanks for sharing! :emoji_thumbsup:

Share This Page