Solved Countdown formatted?

  • 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.

NewbyZ

Member
Jan 26, 2017
75
2
0
25
Any way to convert 300 seconds to 5:00?
(To put in a countdown variable)
And then continue with 4:59, 4:58 ...
 
Any way to convert 300 seconds to 5:00?
(To put in a countdown variable)
And then continue with 4:59, 4:58 ...
Just do differnce:

code_language.skript:
command /Countdown:
 trigger:
  set {Cooldown::Min} to 4
  set {CoolDown::Sec} to 59
  while {Cooldown::Min} is not -1:
   subtract 1 from {CoolDown::Sec}
   if {CoolDown::sec} is less than or equal to -1:
    subtract 1 from {Cooldown::min}
    set {CoolDown::sec} to 59
   wait a seconds
   if {CoolDown::sec} is less than or equal to 9:
    broadcast "%{Cooldown::Min}%:0%{Cooldown::sec}%"
   else:
    broadcast "%{Cooldown::Min}%:%{Cooldown::sec}%"
  broadcast "DO SOMETHINGS AFTER COUNTDOWN ITS AT 0:00"

i know, there is no "4:00", i have update the code.

upload_2017-7-9_19-51-15.png




#Edit

Maybe better code?

code_language.skript:
command /Countdown:
 trigger:
  set {Cooldown::Min} to 0
  set {CoolDown::Sec} to 59
  while {Cooldown::Min} is not -1:
   if {CoolDown::sec} is less than or equal to -1:
    subtract 1 from {Cooldown::min}
    set {CoolDown::sec} to 59
   {CoolDown::Min} is not -1
   if {CoolDown::sec} is less than or equal to 9:
    broadcast "%{Cooldown::Min}%:0%{Cooldown::sec}%"
   else:
    broadcast "%{Cooldown::Min}%:%{Cooldown::sec}%"
   wait 10 ticks
   subtract 1 from {CoolDown::Sec}
  broadcast "DO SOMETHINGS! <3"
 
Last edited by a moderator:
  • Like
Reactions: NewbyZ
Status
Not open for further replies.