An exemple of trigger use:
scoreboard objectives add question trigger
scoreboard players enable @a question
/tellraw @a ["",{"text":"Do you think it will help you ? ","color":"gold","bold":"true"},{"text":"Yes","color":"green","bold":"true","clickEvent":{"action":"run_command","value":"/trigger question set 1"}},{"text":" ","color":"none","bold":"false"},{"text":"No","color":"red","bold":"true","clickEvent":{"action":"run_command","value":"/trigger question set 2"}}]
execute @a[score_question=1] ~ ~ ~ tell @p You answered Yes
execute @a[score_question_min=2] ~ ~ ~ tell @p You answered No
For this problem, you don't actually need to modify the players score when they are offline (which is possible, but finicky), you should be able to change their score as soon as they log back in.
First, create a scoreboard objective of type stat.leaveGame
:
scoreboard objectives add quits stat.leaveGame
You should then have two command blocks on some kind of clock, one activated after another. In the block that is activated first, put this command:
scoreboard players set @a[score_quits_min=1] timer -1
Then, in the one that is activated second:
scoreboard players set @a[score_quits_min=1] quits 0
The quits
score increments when the player leaves. So, when they log back on, it will be at 1 and their timer score will be set to -1. Their quits
score then has to be set back to 0, so that it can be used for the next logout and also so that timer isn't repeatedly set to -1,
Best Answer
Only operators can see command output from players.
If the victim of the prank is an operator (has access to cheat commands), they will see an output message. If you demote them to a regular player, they will not see it in the chat.
If for any reason you cannot or don't want to demote a player, you can give yourself a command block, set the
commandBlockOutput
gamerule to false:And now, if you run your command through the command block, no one will be able to see the output in chat. However, the
/give
and/gamerule
commands you did will still be visible in chat.