Voting System

  • 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 comminuty!

    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.

flocs

Member
Jun 26, 2020
1
0
0
19
Hello, I'm making a voting skript. Whenever I /vote after opening it, it tells me that the competition is not open. Any help appreciated, thanks

Code:
command /openvote:
    trigger:
        set {_openvote} to true
        clear {VoteList::*}
        broadcast "the votes are open for 10 seconds, /vote player"
        wait 10 seconds
        set {_sorted::*} to sorted {VoteList::*}
        set {_top} to last element out of {_sorted::*}
        if {_top} is not set:
            broadcast "Noone voted!"
            stop
        loop {VoteList::*}:
            loop-value is {_top}
            if {_p} is set:
                broadcast "Tie!"
                stop
            set {_p} to loop-index
        broadcast "Winner: %{_p}% with %{_top}% votes"
        delete {VoteList::*}
        delete {Voted::*}
        set {_openvote} to false




command /vote [<offline player>]:
    trigger:
        if {_openvote} is true:
            if "%{Voted::*}%" doesn't contain "%player%":
                add "%arg-1%" to {VoteList::*}
                send "voted for %arg-1%" 
                add player to {Voted::*}
            else:
                send "you already voted"               

        else:
            send "the competition is not open"
[doublepost=1594770023,1594760563][/doublepost]No matter, solved. Used a local variable, oops
 
Status
Not open for further replies.