Discord Thread Cooldown Actionbar

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

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

skUnity Discord

Site Manager
Aug 5, 2023
12,755
1
0
The skUnity Discord
discord.gg
Hello so i have a Skript that basically adds Bliss SMP Gems and i wanna add an Actionbar if someone holds a Gem so i coded this but theres 2 Problems which i dont know how to fix 1. I tried formating the seconds to s but that doesent work and 2. i want the timer to count down not go up but i dont know how to do that any help is appreciated also this is a bit of a mess with all the variables but i dont wanna interupt anything thanks!

Posted by: shdraight from the skUnity Discord. View the thread on skUnity Discord here
 
Skript:
on player's held item change:
if name of player's tool is "&7&kk &7&lᴡɪɴᴅ ɢᴇᴍ &7&kk":
set {_waitedw1} to difference between {cooldown::%player's uuid%.wind1} and now
if {_waitedw1} is less than 45 seconds:
set {_showw1} to difference between {cooldown::%player's uuid%.wind1} and now
else:
set {_showw1} to "Ready!"
set {_waitedw2} to difference between {cooldown::%player's uuid%.wind2} and now
if {_waitedw2} is less than 35 seconds:
set {_showw2} to difference between {cooldown::%player's uuid%.wind2} and now
else:
set {_showw2} to "Ready!"
set {_waitedw3} to difference between {cooldown::%player's uuid%.wind3} and now
if {_waitedw3} is less than 80 seconds:
set {_showw3} to difference between {cooldown::%player's uuid%.wind3} and now
else:
set {_showw3} to "Ready!"
replace every "seconds" in {_showw1} with "s"
replace every "seconds" in {_showw2} with "s"
replace every "seconds" in {_showw3} with "s"
send actionbar "&7%{showw1}% &7| &7%{showw2}% &7| &7%{_showw3}%" to player
Skript:
code_language.skript:
on player's held item change:
  if name of player's tool is "&7&kk &7&lᴡɪɴᴅ ɢᴇᴍ &7&kk":
    set {_waitedw1} to difference between {cooldown::%player's uuid%.wind1} and now
    if {_waitedw1} is less than 45 seconds:
      set {_showw1} to difference between {cooldown::%player's uuid%.wind1} and now
    else:
      set {_showw1} to "Ready!"
    set {_waitedw2} to difference between {cooldown::%player's uuid%.wind2} and now
    if {_waitedw2} is less than 35 seconds:
      set {_showw2} to difference between {cooldown::%player's uuid%.wind2} and now
    else:
      set {_showw2} to "Ready!"
    set {_waitedw3} to difference between {cooldown::%player's uuid%.wind3} and now
    if {_waitedw3} is less than 80 seconds:
      set {_showw3} to difference between {cooldown::%player's uuid%.wind3} and now
    else:
      set {_showw3} to "Ready!"
    replace every "seconds" in {_showw1} with "s"
    replace every "seconds" in {_showw2} with "s"
    replace every "seconds" in {_showw3} with "s"
    send actionbar "&7%{_showw1}% &7| &7%{_showw2}% &7| &7%{_showw3}%" to player

Posted by: shdraight from the skUnity Discord.
 
code_language.skript:
function dajCD(p: player, v: text, t: text, s: timespan) :: boolean:
    if difference between {cooldown::%{_v}%::%{_p}%} and now is smaller than {_s}:
        remove difference between now and {cooldown::%{_v}%::%{_p}%} from {_s}
        set {_s} to "%{_s}%"
        replace all "seconds" and "second" with "s" in {_s}
        replace all "minute" and "minutes" with "m" in {_s}
        send actionbar "%{_t}% %{_s}%" to {_p}
        return false
    else:
        set {cooldown::%{_v}%::%{_p}%} to now
        send actionbar "&aReady!" to {_p}
        return true
on player's held item change:
    name of player's tool is "&7&kk &7&lᴡɪɴᴅ ɢᴇᴍ &7&kk"
    dajCD(player, "WindGem", "&aWait:&f", 80 seconds)
maybe I don't understand, but why so many conditions in your code

Posted by: _grifin_ from the skUnity Discord.
 
im very bad at skripting efficient my text always gets very lomh
<@418899084557156362
i decided to just do it like this the problem is that i also get an actionbar everytime i switch my tool not just with the gem:
code_language.skript:
on player's held item change:
  if player's tool is an amethyst shard:
    if name of player's tool is "&7&kk &7&lᴡɪɴᴅ ɢᴇᴍ &7&kk":
      if difference between {cooldown::%player's uuid%.wind1} and now is less than 45 seconds:
        set {_actionbarw1} to "Cooldown!"
      else:
        set {_actionbarw1} to "Ready!"
      if difference between {cooldown::%player's uuid%.wind2} and now is less than 35 seconds:
        set {_actionbarw2} to "Cooldown!"
      else:
        set {_actionbarw2} to "Ready!"
      if difference between {cooldown::%player's uuid%.wind3} and now is less than 80 seconds:
        set {_actionbarw3} to "Cooldown!"
      else:
        set {_actionbarw3} to "Ready!"
      send actionbar "&7%{_actionbarw1}% | %{_actionbarw2}% | %{_actionbarw3}%" to player

Posted by: shdraight from the skUnity Discord.
 
Status
Not open for further replies.