1. 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!

  2. LOOKING FOR A VERSION OF SKRIPT?

    You can always check out our Wiki for downloads and any other information about Skript!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Voting system

Discussion in 'Skript' started by Aralwen, Aug 22, 2018.

Thread Status:
Not open for further replies.
  1. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    It still doesn't work :/

    Code (Skript):
    1. command /debug:
    2.     trigger:
    3.         set {ActualVote} to player
    4.         set {ActualVote}'s max health to 10
    5.         set {_health} to {ActualVote}'s health / 2
    6.         set {_player} to {ActualVote}
    7.         damage {_player} by {_health} hearts
    8.         send "&aDebug: %{ActualVote}% - %{_health}%"
    I also tried set {_player} to {ActualVote} parsed as a offline player
     
  2. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    Code (Skript):
    1. command /openvote:
    2.     description: Open the votes
    3.     trigger:
    4.        
    5.         {Voting} = false
    6.        
    7.         set {Voting} to true
    8.         delete {Vote::*}
    9.         delete {VoteList::*}
    10.         broadcast "&aThe votes are open for two minutes! Use &a&l/vote PSEUDO"
    11.        
    12.         wait 2 minutes
    13.        
    14.         if {VoteList::*} is not set:
    15.             broadcast "&cNobody voted!"
    16.         else:
    17.             loop {VoteList::*}:
    18.                
    19.                 if {_player} is not set:
    20.                     set {_player} to loop-index
    21.                 else if {VoteList::%loop-index%} > {VoteList::%{_player}%}:
    22.                     set {_player} to loop-index
    23.                    
    24.             add {_player} to {_players::*}
    25.                    
    26.             loop {VoteList::*}:
    27.                 {VoteList::%loop-index%} = {VoteList::%{_player}%}
    28.                 add loop-index to {_players::*}
    29.                
    30.         if (size of {_players::*}) > 1:
    31.             # tie between 2 or more players
    32.         else:
    33.             # only 1 top player
    34.                        
    35.         set {Voting} to false
    36.  
    37.  
    38. command /vote [<player>]:
    39.     description: Vote a player
    40.     trigger:
    41.         if {Voting} = true:
    42.             if {Vote::%player's uuid%} is not set:
    43.                 set {Vote::%player's uuid%} to now
    44.                 add 1 to {VoteList::%arg-player%}
    45.                 send "&aYour vote has been counted"
    46.             else:
    47.                 send "&cYou have already voted."
    48.         else:
    49.             send "&cThe votes are not open yet"
     
    • Agree Agree x 1
  3. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Hello, thanks for your help, but TPGamesNL proposal works, the only last problem I have now is that I can not put damage to the most voted player by a variable :/ ( #17 / #21 )
     
  4. jaylawl

    jaylawl Active Member

    Joined:
    Jan 29, 2017
    Messages:
    173
    Likes Received:
    31
    rip i didnt realise :|
     
    • Funny Funny x 1
  5. TPGamesNL

    Supporter Addon Developer Dev Programme

    Joined:
    Jan 20, 2018
    Messages:
    1,500
    Likes Received:
    107
    Medals:
    Try
    Code (Skript):
    1. set {_player} to "%{ActualVote}%" parsed as a player
     
  6. Aralwen

    Aralwen Active Member

    Joined:
    May 26, 2017
    Messages:
    164
    Likes Received:
    14
    Problem solved : damage "%{ActualVote}%" parsed as player by {_health}
    Thank you for your help, have a nice day :emoji_slight_smile:
     
    • Friendly Friendly x 1
Thread Status:
Not open for further replies.

Share This Page

Loading...