I want players to have the ability every 5 minutes to create a vote to reset a game I am not good at command blocks so I made a really sloppy code that won't run anything but would hopefully give you some idea what I am trying to do.
#player_input is per player score board value
#player_input_all is setting player_input for all players
var cooldown = 0
var triggered = 0
var time = 60
var player_input
var yes = 0
var no = 0
if (cooldown == 0){
if( triggered = 1){
player_input_all = 0
#tell raw command here to allow input will set scoreboard value per selection
while(time >= 0){
time --
}
player_vote(player_input_all)
if (yes > no){
#will run command
}
}
cooldown = 300
}
cooldown --
var function player_vote(player_input){
if(player_input < 5){
if(player_input == 1){
var yes ++
player_input = 10
}
if(player_input = 2|| player_input = 0){
var no ++
player_input = 10
}
}
}
I want players to have the ability every 5 minutes to create a vote to reset a game I am not good at command blocks so I made a really sloppy code that won't run anything but would hopefully give you some idea what I am trying to do.
What are u in Command Block, Plugins, JavaScript
Making Map Taking suggestion from people and make them
Trying to make command block, the best way I could think to explain it was with code. xD
Well, I'll try to change your (uh... psuedocode?) to command...
(Exclude everything inside brackets, they are just annotation)
(Type these in chat before everything:)
/scoreboard objectives add vote_1 dummy
/scoreboard objectives add vote trigger
/scoreboard objectives add vote_final dummy
(Type/Activate these just before voting:)
/scoreboard objectives add vote_3 stat.playOneMinute
/scoreboard players enable @a vote
(Now, if players need to vote, ask them to type /trigger vote set (well, 1 to 3, NOT 0 to 2) )
(Repeating commands:)
/execute @a[score_vote_min=1,score_vote=1] ~ ~ ~ scoreboard players remove (the host's ign name, I.E. your name) vote_1 1
/execute @a[score_vote_min=2,score_vote=2] ~ ~ ~ scoreboard players add (the host's ign name, I.E. your name) vote_1 1
/execute @a[score_vote_min=3,score_vote=3] ~ ~ ~ scoreboard players remove (the host's ign name, I.E. your name) vote_1 1
/scoreboard players reset @a[score_vote_min=1,score_vote=3] vote
/execute @p[score_vote_3_min=6] ~ ~ ~ scoreboard players operation (your name) vote_final = (your name) vote_1
/execute @p[score_vote_3_min=6] ~ ~ ~ tellraw @a ["blah blah blah"]
/scoreboard objectives remove vote_3
Should be ok.
For those who vote a negative value or greater than 3, they simply don't want to vote.
I haven't tested it yet so it might not work. Tell us if there's any bug.