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.

Count command occurences

Discussion in 'Skript' started by Vaw, Mar 24, 2017.

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

    Vaw Member

    Joined:
    Mar 22, 2017
    Messages:
    4
    Likes Received:
    0
    I'm hoping to find a way for a certain action to occur if several players run a command within a certain amount of time. For example, if three players did /voteday within five minutes of each other, console would run the command /time set 0.
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    Hmm... its more than request?

    always here, hope its working fine. Not tested because im alone for ever.

    Code (Skript):
    1. command /voteday:
    2.     trigger:
    3.         set {_time} to difference between {VoteDay} and now
    4.         if {VoteDay} is less than 5 minutes:#If already vote passed. he need wait next 5 minutes to start again
    5.             send "&cSorry. but vote has already passed. you need wait a little."
    6.         else:
    7.             if {VotePlayer::%player%} is set:
    8.                 send "&cYou can't vote 2x times!"
    9.                 stop
    10.             if {VoteCount} is not set:
    11.                 set {_a} to 60#60 seconds have people time, for vote.
    12.             add 1 to {VoteCount}
    13.             set {VotePlayer::%player%}
    14.             broadcast "%player% vote for day!"
    15.             if {VoteCount} is more than or equal to 3:#Need 3 People to get vote day.
    16.                 broadcast "Vote for day won!"
    17.                 make console execute command "/time set 0"
    18.                 delete {VotePlayer::*}
    19.                 delete {VoteCount}
    20.                 set {VoteDay} to now
    21.             else:
    22.                 broadcast "&8&l""&e/voteday&8&l"" &6to vote! %3 - {VoteCount}% Vote need!"
    23.             while {_a} is not 0:
    24.                 subtract 1 from {_a}
    25.                 wait a seconds
    26.             if {VoteCount} is set:
    27.                 broadcast "&c&lVote for day is failed. Not enough people to vote!"
    28.                 delete {VotePlayer::*}
    29.                 delete {VoteCount}
    30.                 set {VoteDay} to now
     
Thread Status:
Not open for further replies.

Share This Page

Loading...