Solved [URGENT] Actionbar countdown

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

crownowner

Member
Aug 23, 2023
17
0
1
25
Category: Action Bar/Countdown

Suggested name: Countdown

What I want:

Make the countdown system in Skript (Actionbar for when the event starts, and then at the end it runs /gamestart | also it can be paused and says "Crownwars begins in... &c&lPAUSED." and stays there until its unpaused. Also a way to cancel/stop it.) The countdown is 1:30 seconds. I want it so when its unpaused to start where it was last paused. Also, the format is: "&#FFFFFE&lCrownwars &r&#FFFFFE begins in.. &c(time)"

Ideas for commands: /count start, /count pause, /count cancel|stop, and maybe /count unpause

Ideas for permissions: crown.count


When I'd like it by: A reasonable time
 
Here you go, a customizable Skript for you, if you got any doubts tell me :emoji_wink:
Code:
options:
    Prefix: &3&lCOUNT &8&l»
    Permission: crown.count
    NoPermissions: &cYou are not allowed to use this command.
    ABBeginsIn: &a&lCROWNWARS &abegins in
    ABPaused: &a&lCROWNWARS &ais currently &ePAUSED
    ABStartsNow: &a&lCROWNWARS STARTED!
    FinishCommand: /gamestart
    Timer: 90

command /count [<text>]:
    executable by: console and players
    permission: {@Permission}
    permission message: {@Prefix} {@NoPermissions}
    trigger:

        if arg 1 is not set:
            set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
            send "&8&l&m-----------&8&l| &3&lCOUNT &8&l|&m-----------"
            if {crown_count::status} is not set:
                send "%nl%&8&l» &7The timer is currently &cSTOPPED&7."
            if {crown_count::status} is 0:
                send "%nl%&8&l» &7The timer is currently &ePAUSED&7 at &e%{_timespan}%&7."
            if {crown_count::status} is 1:
                send "%nl%&8&l» &7The timer is currently &aRUNNING&7."
            send "%nl%&8&l» &b/count &astart &7- Starts the timer."
            send "&8&l» &b/count &epause &7- Pauses the timer."
            send "&8&l» &b/count &aresume &7- Resumes the timer."
            send "&8&l» &b/count &cstop &7- Stops the timer."
            send "&8&l&m-----------------------------"

        if arg 1 is "start":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &7There's a &ePAUSED &7timer, stop it with &b/count &cstop&7."
                if {crown_count::status} is 1:
                    send "{@Prefix} &7There's a &aRUNNING &7timer, stop it with &b/count &cstop&7."
            else:
                set {crown_count::status} to 1
                set {crown_count::timer} to {@Timer}
                set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
                send "{@Prefix} &aYou have started a timer successfully for &l%{_timespan}% &a✔"

        if arg 1 is "pause":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &aThere's already a timer &ePAUSED&7, resume it with &b/count &aresume&7."
                if {crown_count::status} is 1:
                    set {crown_count::status} to 0
                    send "{@Prefix} &aYou have paused the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "resume":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    set {crown_count::status} to 1
                    send "{@Prefix} &aYou have resumed the timer successfully &a✔"
                if {crown_count::status} is 1:
                    send "{@Prefix} &aThere's already a timer &aRUNNING&7, pause it with &b/count &apause&7."
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "stop":
            if {crown_count::status} is set:
                delete {crown_count::status}
                send "{@Prefix} &aYou have stopped the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

every second:
    set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
    if {crown_count::status} is 0:
        loop all players:
            send action bar "{@ABPaused}" to loop-player
    if {crown_count::status} is 1:
        if {crown_count::timer} is 0:
            delete {crown_count::status}
            make console execute command "{@FinishCommand}"
            loop all players:
                send action bar "{@ABStartsNow}" to loop-player
        else:
            remove 1 from {crown_count::timer}
            loop all players:
                send action bar "{@ABBeginsIn} &a%{_timespan}%..." to loop-player
 
Here you go, a customizable Skript for you, if you got any doubts tell me :emoji_wink:
Code:
options:
    Prefix: &3&lCOUNT &8&l»
    Permission: crown.count
    NoPermissions: &cYou are not allowed to use this command.
    ABBeginsIn: &a&lCROWNWARS &abegins in
    ABPaused: &a&lCROWNWARS &ais currently &ePAUSED
    ABStartsNow: &a&lCROWNWARS STARTED!
    FinishCommand: /gamestart
    Timer: 90

command /count [<text>]:
    executable by: console and players
    permission: {@Permission}
    permission message: {@Prefix} {@NoPermissions}
    trigger:

        if arg 1 is not set:
            set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
            send "&8&l&m-----------&8&l| &3&lCOUNT &8&l|&m-----------"
            if {crown_count::status} is not set:
                send "%nl%&8&l» &7The timer is currently &cSTOPPED&7."
            if {crown_count::status} is 0:
                send "%nl%&8&l» &7The timer is currently &ePAUSED&7 at &e%{_timespan}%&7."
            if {crown_count::status} is 1:
                send "%nl%&8&l» &7The timer is currently &aRUNNING&7."
            send "%nl%&8&l» &b/count &astart &7- Starts the timer."
            send "&8&l» &b/count &epause &7- Pauses the timer."
            send "&8&l» &b/count &aresume &7- Resumes the timer."
            send "&8&l» &b/count &cstop &7- Stops the timer."
            send "&8&l&m-----------------------------"

        if arg 1 is "start":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &7There's a &ePAUSED &7timer, stop it with &b/count &cstop&7."
                if {crown_count::status} is 1:
                    send "{@Prefix} &7There's a &aRUNNING &7timer, stop it with &b/count &cstop&7."
            else:
                set {crown_count::status} to 1
                set {crown_count::timer} to {@Timer}
                set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
                send "{@Prefix} &aYou have started a timer successfully for &l%{_timespan}% &a✔"

        if arg 1 is "pause":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &aThere's already a timer &ePAUSED&7, resume it with &b/count &aresume&7."
                if {crown_count::status} is 1:
                    set {crown_count::status} to 0
                    send "{@Prefix} &aYou have paused the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "resume":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    set {crown_count::status} to 1
                    send "{@Prefix} &aYou have resumed the timer successfully &a✔"
                if {crown_count::status} is 1:
                    send "{@Prefix} &aThere's already a timer &aRUNNING&7, pause it with &b/count &apause&7."
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "stop":
            if {crown_count::status} is set:
                delete {crown_count::status}
                send "{@Prefix} &aYou have stopped the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

every second:
    set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
    if {crown_count::status} is 0:
        loop all players:
            send action bar "{@ABPaused}" to loop-player
    if {crown_count::status} is 1:
        if {crown_count::timer} is 0:
            delete {crown_count::status}
            make console execute command "{@FinishCommand}"
            loop all players:
                send action bar "{@ABStartsNow}" to loop-player
        else:
            remove 1 from {crown_count::timer}
            loop all players:
                send action bar "{@ABBeginsIn} &a%{_timespan}%..." to loop-player
damn, nice. I was actually doing a project like this but I didn't know how to pause it.
 
Here you go, a customizable Skript for you, if you got any doubts tell me :emoji_wink:
Code:
options:
    Prefix: &3&lCOUNT &8&l»
    Permission: crown.count
    NoPermissions: &cYou are not allowed to use this command.
    ABBeginsIn: &a&lCROWNWARS &abegins in
    ABPaused: &a&lCROWNWARS &ais currently &ePAUSED
    ABStartsNow: &a&lCROWNWARS STARTED!
    FinishCommand: /gamestart
    Timer: 90

command /count [<text>]:
    executable by: console and players
    permission: {@Permission}
    permission message: {@Prefix} {@NoPermissions}
    trigger:

        if arg 1 is not set:
            set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
            send "&8&l&m-----------&8&l| &3&lCOUNT &8&l|&m-----------"
            if {crown_count::status} is not set:
                send "%nl%&8&l» &7The timer is currently &cSTOPPED&7."
            if {crown_count::status} is 0:
                send "%nl%&8&l» &7The timer is currently &ePAUSED&7 at &e%{_timespan}%&7."
            if {crown_count::status} is 1:
                send "%nl%&8&l» &7The timer is currently &aRUNNING&7."
            send "%nl%&8&l» &b/count &astart &7- Starts the timer."
            send "&8&l» &b/count &epause &7- Pauses the timer."
            send "&8&l» &b/count &aresume &7- Resumes the timer."
            send "&8&l» &b/count &cstop &7- Stops the timer."
            send "&8&l&m-----------------------------"

        if arg 1 is "start":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &7There's a &ePAUSED &7timer, stop it with &b/count &cstop&7."
                if {crown_count::status} is 1:
                    send "{@Prefix} &7There's a &aRUNNING &7timer, stop it with &b/count &cstop&7."
            else:
                set {crown_count::status} to 1
                set {crown_count::timer} to {@Timer}
                set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
                send "{@Prefix} &aYou have started a timer successfully for &l%{_timespan}% &a✔"

        if arg 1 is "pause":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &aThere's already a timer &ePAUSED&7, resume it with &b/count &aresume&7."
                if {crown_count::status} is 1:
                    set {crown_count::status} to 0
                    send "{@Prefix} &aYou have paused the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "resume":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    set {crown_count::status} to 1
                    send "{@Prefix} &aYou have resumed the timer successfully &a✔"
                if {crown_count::status} is 1:
                    send "{@Prefix} &aThere's already a timer &aRUNNING&7, pause it with &b/count &apause&7."
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

        if arg 1 is "stop":
            if {crown_count::status} is set:
                delete {crown_count::status}
                send "{@Prefix} &aYou have stopped the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."

every second:
    set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
    if {crown_count::status} is 0:
        loop all players:
            send action bar "{@ABPaused}" to loop-player
    if {crown_count::status} is 1:
        if {crown_count::timer} is 0:
            delete {crown_count::status}
            make console execute command "{@FinishCommand}"
            loop all players:
                send action bar "{@ABStartsNow}" to loop-player
        else:
            remove 1 from {crown_count::timer}
            loop all players:
                send action bar "{@ABBeginsIn} &a%{_timespan}%..." to loop-player
Amazing, works fine!

Just a quick question, I was wondering if you can add to play a sound on the time when theres 32 seconds left?
 
Amazing, works fine!

Just a quick question, I was wondering if you can add to play a sound on the time when theres 32 seconds left?
Here you go, I added you new options for the sound notification, last 2 lines of code are those who add the sound notification:
Code:
options:
    Prefix: &3&lCOUNT &8&l»
    Permission: crown.count
    NoPermissions: &cYou are not allowed to use this command.
    ABBeginsIn: &a&lCROWNWARS &abegins in
    ABPaused: &a&lCROWNWARS &ais currently &ePAUSED
    ABStartsNow: &a&lCROWNWARS STARTED!
    FinishCommand: /gamestart
    Timer: 90
    NotifyAt: 32
    NotifySound: random.orb
    SoundPitch: 0.1
command /count [<text>]:
    executable by: console and players
    permission: {@Permission}
    permission message: {@Prefix} {@NoPermissions}
    trigger:
        if arg 1 is not set:
            set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
            send "&8&l&m-----------&8&l| &3&lCOUNT &8&l|&m-----------"
            if {crown_count::status} is not set:
                send "%nl%&8&l» &7The timer is currently &cSTOPPED&7."
            if {crown_count::status} is 0:
                send "%nl%&8&l» &7The timer is currently &ePAUSED&7 at &e%{_timespan}%&7."
            if {crown_count::status} is 1:
                send "%nl%&8&l» &7The timer is currently &aRUNNING&7."
            send "%nl%&8&l» &b/count &astart &7- Starts the timer."
            send "&8&l» &b/count &epause &7- Pauses the timer."
            send "&8&l» &b/count &aresume &7- Resumes the timer."
            send "&8&l» &b/count &cstop &7- Stops the timer."
            send "&8&l&m-----------------------------"
        if arg 1 is "start":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &7There's a &ePAUSED &7timer, stop it with &b/count &cstop&7."
                if {crown_count::status} is 1:
                    send "{@Prefix} &7There's a &aRUNNING &7timer, stop it with &b/count &cstop&7."
            else:
                set {crown_count::status} to 1
                set {crown_count::timer} to {@Timer}
                set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
                send "{@Prefix} &aYou have started a timer successfully for &l%{_timespan}% &a✔"
        if arg 1 is "pause":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &aThere's already a timer &ePAUSED&7, resume it with &b/count &aresume&7."
                if {crown_count::status} is 1:
                    set {crown_count::status} to 0
                    send "{@Prefix} &aYou have paused the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
        if arg 1 is "resume":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    set {crown_count::status} to 1
                    send "{@Prefix} &aYou have resumed the timer successfully &a✔"
                if {crown_count::status} is 1:
                    send "{@Prefix} &aThere's already a timer &aRUNNING&7, pause it with &b/count &apause&7."
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
        if arg 1 is "stop":
            if {crown_count::status} is set:
                delete {crown_count::status}
                send "{@Prefix} &aYou have stopped the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
every second:
    set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
    if {crown_count::status} is 0:
        loop all players:
            send action bar "{@ABPaused}" to loop-player
    if {crown_count::status} is 1:
        if {crown_count::timer} is 0:
            delete {crown_count::status}
            make console execute command "{@FinishCommand}"
            loop all players:
                send action bar "{@ABStartsNow}" to loop-player
        else:
            remove 1 from {crown_count::timer}
            loop all players:
                send action bar "{@ABBeginsIn} &a%{_timespan}%..." to loop-player
                if {crown_count::timer} is {@NotifyAt}:
                    play raw sound "random.orb" at loop-player with pitch {@SoundPitch} volume 10
 
Here you go, I added you new options for the sound notification, last 2 lines of code are those who add the sound notification:
Code:
options:
    Prefix: &3&lCOUNT &8&l»
    Permission: crown.count
    NoPermissions: &cYou are not allowed to use this command.
    ABBeginsIn: &a&lCROWNWARS &abegins in
    ABPaused: &a&lCROWNWARS &ais currently &ePAUSED
    ABStartsNow: &a&lCROWNWARS STARTED!
    FinishCommand: /gamestart
    Timer: 90
    NotifyAt: 32
    NotifySound: random.orb
    SoundPitch: 0.1
command /count [<text>]:
    executable by: console and players
    permission: {@Permission}
    permission message: {@Prefix} {@NoPermissions}
    trigger:
        if arg 1 is not set:
            set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
            send "&8&l&m-----------&8&l| &3&lCOUNT &8&l|&m-----------"
            if {crown_count::status} is not set:
                send "%nl%&8&l» &7The timer is currently &cSTOPPED&7."
            if {crown_count::status} is 0:
                send "%nl%&8&l» &7The timer is currently &ePAUSED&7 at &e%{_timespan}%&7."
            if {crown_count::status} is 1:
                send "%nl%&8&l» &7The timer is currently &aRUNNING&7."
            send "%nl%&8&l» &b/count &astart &7- Starts the timer."
            send "&8&l» &b/count &epause &7- Pauses the timer."
            send "&8&l» &b/count &aresume &7- Resumes the timer."
            send "&8&l» &b/count &cstop &7- Stops the timer."
            send "&8&l&m-----------------------------"
        if arg 1 is "start":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &7There's a &ePAUSED &7timer, stop it with &b/count &cstop&7."
                if {crown_count::status} is 1:
                    send "{@Prefix} &7There's a &aRUNNING &7timer, stop it with &b/count &cstop&7."
            else:
                set {crown_count::status} to 1
                set {crown_count::timer} to {@Timer}
                set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
                send "{@Prefix} &aYou have started a timer successfully for &l%{_timespan}% &a✔"
        if arg 1 is "pause":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    send "{@Prefix} &aThere's already a timer &ePAUSED&7, resume it with &b/count &aresume&7."
                if {crown_count::status} is 1:
                    set {crown_count::status} to 0
                    send "{@Prefix} &aYou have paused the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
        if arg 1 is "resume":
            if {crown_count::status} is set:
                if {crown_count::status} is 0:
                    set {crown_count::status} to 1
                    send "{@Prefix} &aYou have resumed the timer successfully &a✔"
                if {crown_count::status} is 1:
                    send "{@Prefix} &aThere's already a timer &aRUNNING&7, pause it with &b/count &apause&7."
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
        if arg 1 is "stop":
            if {crown_count::status} is set:
                delete {crown_count::status}
                send "{@Prefix} &aYou have stopped the timer successfully &a✔"
            else:
                send "{@Prefix} &7There's no timer running, start one with &b/count &astart&7."
every second:
    set {_timespan} to "%{crown_count::timer}% seconds" parsed as timespan
    if {crown_count::status} is 0:
        loop all players:
            send action bar "{@ABPaused}" to loop-player
    if {crown_count::status} is 1:
        if {crown_count::timer} is 0:
            delete {crown_count::status}
            make console execute command "{@FinishCommand}"
            loop all players:
                send action bar "{@ABStartsNow}" to loop-player
        else:
            remove 1 from {crown_count::timer}
            loop all players:
                send action bar "{@ABBeginsIn} &a%{_timespan}%..." to loop-player
                if {crown_count::timer} is {@NotifyAt}:
                    play raw sound "random.orb" at loop-player with pitch {@SoundPitch} volume 10
It's perfect! Thank you so much :emoji_slight_smile: