How do you get the percentage of who voted yes and no among all players?
Code:
variables:
{votisi::*} = 0
{votino::*} = 0
command /aprivoto:
trigger:
delete {votisi::*}
delete {votino::*}
set {voto::*} to "&e''&aTi sta piacendo il server?&e''"
broadcast "&6&lFra 30 secondi ci sarà una votazione! %{voto::*}%"
wait 30 seconds
loop all players:
make loop-player execute command "asajsgsyin2h67z62h2289g6nzm"
command /asajsgsyin2h67z62h2289g6nzm:
description: Vote a player
trigger:
open chest with 3 rows named "&a&lVotazione: %{voto::*}%" to player
wait 0 tick
format slot 11 of player with wool named "&a&lSì!" to close then run [execute player command "wp789120osia"]
format slot 12 of player with wool named "&c&lNo!" to close then run [execute player command "su88129nmsAM7S79A"]
command /wp789120osia:
trigger:
add 1 to {votisi::*}
send "&aHai votato ''&2Sì&a'' alla domanda %{voto::*}%&a!"
command /su88129nmsAM7S79A:
trigger:
add 1 to {votino::*}
send "&cHai votato ''&4No&c'' alla domanda %{voto::*}%&c!"
command /listavoti:
trigger:
if size of {votisi::*} is not 0 or 1:
send "&e%{votisi::*}% &7persone hanno votato &2Sì" to executor
else if size of {votisi::*} is 1:
send "&e1 &7persona ha votato &6Sì" to executor
else if size of {votisi::*} is 0:
send "&eNessuna persona ha votato &2Sì" to executor
if size of {votino::*} is not 0 or 1:
send "&e%{votino::*}% &7persone hanno votato &4No" to executor
else if size of {votino::*} is 1:
send "&e1 persona ha votato &4No" to executor
else if size of {votino::*} is 0:
send "&eNessuna persona ha votato &4No" to executor