Arqade Asked on August 22, 2020
I want to be able to detect if a certain word in chat is said like:
Console: Please say yes to be teleported or no to remain
Player1: yes
Player1 teleported to [insert random coordinates here]
Something that would monitor the chat for a certain word.
Unfortunately there is simply no way, currently, to test for what players say in chat.
There is however an alternative which is quite similar; using /tellraw along with the new (1.8 snapshots only so far) /trigger command. This would allow you to create a message in chat that looks something like this:
Would you like to be teleported? [Yes]
And would actually work when you clicked the [Yes] button.
First you'll need to create an objective (lets say, Objective1) with type "trigger". Then, you'll need to use /scoreboard players enable Player1 Objective1
to allow Player1 to use /trigger Objective1
. You'll need to do this each time you ask the player if they want to teleport.
Then, to display the actual clickable message, run something like this in a command block:
/tellraw Player1 {"text":"Do you wish to be teleported? ","extra":[{"text":"[Yes]","clickEvent":{"action":"run_command","value":"/trigger Objective1 set 1"}}]}
This sets their Objective1 score to 1, and from there you can simply do something like /tp @a[score_Objective1_min=1] Coordinates
.
Here's a site that's quite useful for generating tellraw commands; there is a lot you can do with them but the syntax can initially be very confusing: http://ezekielelin.com/minecraft/tellraw/
Answered by SirBenet on August 22, 2020
Even simpler than the above, again made with the very useful tool ezekielelin's tellraw generator If you put this into a command block all you need to do is change the [target player] and x, y, z and add/ remove the x and y rotation
tellraw @a {"text":"","extra":[{"text":"Do you want to be teleported?"},{"text":"[Yes]","clickEvent":{"action":"run_command","value":"/tp [target player] <x> <y> <z> [<y-rot> <x-rot>]"}}]}
Answered by Tedjam on August 22, 2020
It is possible by using /tellraw command
Create tellraw commands here: http://minecraftjson.com/
Answered by user97586 on August 22, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP