1
Testfor command blocks
Hey, I have a question about testfor command blocks.
I currently have one that detects players in a certain scoreboard group. If the testfor is true, I want it to say a certain message that I already have planned out, and if the testfor is false I would like it to say a different msg.
How would I go about making it so it can say two different messages based on it being true or false?
Thanks
I currently have one that detects players in a certain scoreboard group. If the testfor is true, I want it to say a certain message that I already have planned out, and if the testfor is false I would like it to say a different msg.
How would I go about making it so it can say two different messages based on it being true or false?
Thanks
7
If anyone knows an answer, let me know!
Anyone able to help?
It seems I should provide a little more information :). Here is the commands I need to be hooked up on a true/false basis:
/testfor @a[score_PlayerHelper_min=1]
if the test for is true, I need this command block to run:
/tellraw @a[r=30] ["",{"text":"Server: ","color":"gold","bold":true},{"text":"If you need help getting started, ","color":"gray","bold":false},{"selector":"@ascore_PlayerHelper_min=1]","color":"gold"},{"text":" is a player helper. I will let them know you need some help getting started!","color":"gray"}]
and if it is false, this command blocks needs to run:
/tellraw @p ["",{"text":"Server: ","color":"gold","bold":true},{"text":"There are no player helpers online at the moment :(. Try to see if ","color":"gray","bold":false},{"text":"/warp helphub or /faq","color":"gold"},{"text":"can answer your questions! :D","color":"gray"}]
[p]So, now I just need one of the two messages to run if the testfor is true or false.[/p]
/testfor @a[score_PlayerHelper_min=1]
if the test for is true, I need this command block to run:
/tellraw @a[r=30] ["",{"text":"Server: ","color":"gold","bold":true},{"text":"If you need help getting started, ","color":"gray","bold":false},{"selector":"@ascore_PlayerHelper_min=1]","color":"gold"},{"text":" is a player helper. I will let them know you need some help getting started!","color":"gray"}]
and if it is false, this command blocks needs to run:
/tellraw @p ["",{"text":"Server: ","color":"gold","bold":true},{"text":"There are no player helpers online at the moment :(. Try to see if ","color":"gray","bold":false},{"text":"/warp helphub or /faq","color":"gold"},{"text":"can answer your questions! :D","color":"gray"}]
[p]So, now I just need one of the two messages to run if the testfor is true or false.[/p]
You can negate tests with =!
So: /tell @a[team=!red] Let's destroy those red teamers!
This would sent out a message to all players except those within the red team.
So: /tell @a[team=!red] Let's destroy those red teamers!
This would sent out a message to all players except those within the red team.
Yes, that is exactly what I want it to do; different messages based on true or false. I'm not sure how to do two different outputs, can you possibly show me?
Depends if you want it to be multiplayer compatible.
if you do then try something like this:
if you do then try something like this:
/tell @a[score_example_min=1] hello there friend, this is an example massage.you could have two outputs and invert one of them. But this all depends on how these messages will be displayed. Is it just saying it once in chat when it detects a player then as soon as it detects no players it says the other message just once?
