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!
It's using sign:
How to use it?
What is it good for?!
If you have lot of players on your server, you can search for peoples easly with this system
you can search for things in list variables
Other:
You need to have ProtocolLib in your plugin folder!
Sorry for the mistakes in the text, my english is not that good! :/
And because im a very nice guy so, Im sharing the code with you and you can build it into your skript!
It's using sign:
code_language.skript:
function SignSearch(lines: strings, player: player):
set {_loc} to location of {_player}
set {_block} to type of block at {_loc}
set block at {_loc} to sign
loop {_lines::*}:
(loop-index parsed as int) < 5
set line (loop-index parsed as int) of block at {_loc} to "%colored loop-value%"
wait a tick
set {_packet} to new play_server_open_sign_editor packet
set location pinfo 0 of {_packet} to {_loc}
send {_player} packet {_packet}
set block at {_loc} to {_block}
command /signsearch <player>:
trigger:
set {usingsign.%player%} to true
set {_lines::*} to "", "/\/\/\/\", "Enter your" and "search!"
SignSearch({_lines::*},arg)
on packet event play_client_update_sign:
if {usingsign.%player%} is true:
set {_lines::*} to string array pinfo 0 of event-packet
message "You searched for: %{_lines::1}%"
set {usingsign.%player%} to false
stop
- 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_language.skript:
loop all players:
if loop-player's is equal to {_lines::1}:
message "the player is online"
you can search for things in list variables
code_language.skript:
loop {yourvariable::*}:
if loop-value is equal to {_lines::1}:
message "Yeah I FOUND IT"
Other:
You need to have ProtocolLib in your plugin folder!
Sorry for the mistakes in the text, my english is not that good! :/