Player voting

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

GToTheG

Member
Jan 26, 2017
35
0
8
Hello,

Should this code work? - It doesn't give any errors, but just want to make sure it does pick the user with the most votes.
I wasn't able to troubleshoot it.

{_voteplayer} should be the most voted player, when the loop is done.

Code:
            set {_no} to 0
            loop {VoteList::*}:
                if loop-value is higher than {_no}:
                    set {_vote} to loop-value
                    set {_no} to loop-value
                    set {_voteplayer} to loop-index parsed as player

Code:
command /vote [<player>]:
    description: Vote a player
    trigger:
        if {Vote::%player's uuid%} is not set:
            set {Vote::%player's uuid%} to now
            add 1 to {VoteList::%arg-player%}
        else:
            send "&cYou have already voted."
 
Status
Not open for further replies.