cancel cooldown

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

FireRoz

Active Member
May 28, 2020
133
6
18
hey,
I wanna make it so Moderators will be able to bypass chat cooldown.
here's my code:
Code:
command /slowchat [<number>]:
  permission: slowchat
  permission message: &cYou do not have access to this command.
  trigger:
    if arg-1 is not set:
      send "&cUsage: /slowchat <cooldown in seconds>"
    if arg-1 is set:
      set {slowchat} to "%arg-1% seconds" parsed as timespan
      loop all players:
        if loop-player has permission "slowchat":
          send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
          send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
      
on chat:
  set {chat} to difference between {chat.%player%} and now
  if {chat} is less than {slowchat}:
    cancel event
    message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    stop
    set {chat.%player%} to now
 
in your on chat event, just add something similar to this at the very start such as this
Code:
on chat:
    if player has permission "xyz":
        stop
    #do rest
 
in your on chat event, just add something similar to this at the very start such as this
Code:
on chat:
    if player has permission "xyz":
        stop
    #do rest
doesn't work :/.
Members can still bypass chat cooldown
 
Without looking at your code, i'll write an example of what i would do
Code:
on chat:
    if {slowchat} > 0:
         if player has permission "mod":
             stop
         set {_chat} to now
         if (difference between {chat::%player's uuid%} and now) < {slowchat}:
             cancel event
             send "&c[!] You have been halted by slowchat!"
             stop
         set {chat::%player's uuid%} to now
 
Last edited:
Without looking at your code, i'll write an example of what i would do
Code:
on chat:
    if {slowchat} is true:
         if player has permission "mod":
             stop
         set {_chat} to now
         if (difference between {chat::%player's uuid%} and now) < {slowchat}:
             cancel event
             send "&c[!] You have been halted by slowchat!"
             stop
         set {chat::%player's uuid%} to now
Too many errors.
& when I try & fix those errors, it will not work
 
Code:
on chat:
  set {chat} to difference between {chat.%player%} and now
  if {chat} is less than {slowchat}:
    sender does not have permission "your.perm.here"
    cancel event
    message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    stop
    set {chat.%player%} to now
 
hey,
I wanna make it so Moderators will be able to bypass chat cooldown.
here's my code:
Code:
command /slowchat [<number>]:
  permission: slowchat
  permission message: &cYou do not have access to this command.
  trigger:
    if arg-1 is not set:
      send "&cUsage: /slowchat <cooldown in seconds>"
    if arg-1 is set:
      set {slowchat} to "%arg-1% seconds" parsed as timespan
      loop all players:
        if loop-player has permission "slowchat":
          send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
          send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
    
on chat:
  set {chat} to difference between {chat.%player%} and now
  if {chat} is less than {slowchat}:
    cancel event
    message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    stop
    set {chat.%player%} to now
If I was to do this, I would do it like this:

Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
            send "&aYou've set the chat cooldown to %arg-1% second(s)" to player

On chat:
    if {_timer} >= {slowchat}:
        set {_timer} to 0
        loop {slowchat} times:
            add 1 to {_timer}
            wait 1 second
    else:
        send "Wait %{_timer}% seconds"
 
If I was to do this, I would do it like this:

Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
            send "&aYou've set the chat cooldown to %arg-1% second(s)" to player

On chat:
    if {_timer} >= {slowchat}:
        set {_timer} to 0
        loop {slowchat} times:
            add 1 to {_timer}
            wait 1 second
    else:
        send "Wait %{_timer}% seconds"
Pro = alt
owner = main
That's what happens when anyone tries to spam
https://imgur.com/a/vUqZfEz
Also, I can't fix it because from "on chat" I don't understand anything
[doublepost=1605077531,1605077437][/doublepost]
Code:
on chat:
  set {chat} to difference between {chat.%player%} and now
  if {chat} is less than {slowchat}:
    sender does not have permission "your.perm.here"
    cancel event
    message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    stop
    set {chat.%player%} to now
Members can still spam.
what is it with this bypass cooldown it's like cursed
 
Pro = alt
owner = main
That's what happens when anyone tries to spam
https://imgur.com/a/vUqZfEz
Also, I can't fix it because from "on chat" I don't understand anything
[doublepost=1605077531,1605077437][/doublepost]
Members can still spam.
what is it with this bypass cooldown it's like cursed
Try this:
Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
            send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
 
On chat:
    if {timer::%player%} <= 0:
        set {timer::%player%} to {slowchat}
        loop {slowchat}+1 times:
            remove 1 from {timer::%player%}
            wait 1 second
    else:
        send "Wait %{timer::%player%}% seconds" to player
 
Try this:
Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
            send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
 
On chat:
    if {timer::%player%} <= 0:
        set {timer::%player%} to {slowchat}
        loop {slowchat}+1 times:
            remove 1 from {timer::%player%}
            wait 1 second
    else:
        send "Wait %{timer::%player%}% seconds" to player
does not work
 
does not work
Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &7%player% &6&lhas set the chat cooldown to &a%arg-1% &7second(s)" to loop-player
            send "&7You've set the chat cooldown to &a%arg-1% &7second(s)" to player
 
On chat:
    if {timer::%player%} < 1:
        set {timer::%player%} to {slowchat}
        while {timer::%player%} > 0:
            wait 1 second
            remove 1 from {timer::%player%}
    else:
        cancel event
        send "Wait %{timer::%player%}% seconds" to player
this works, I tested it.
 
Code:
command /slowchat [<number>]:
    permission: slowchat
    permission message: &cYou do not have access to this command.
    trigger:
        if arg-1 is not set:
            send "&cUsage: /slowchat <cooldown in seconds>"
        if arg-1 is set:
            set {slowchat} to arg-1
            loop all players:
                if loop-player has permission "slowchat":
                    send "&D[STAFF] &7%player% &6&lhas set the chat cooldown to &a%arg-1% &7second(s)" to loop-player
            send "&7You've set the chat cooldown to &a%arg-1% &7second(s)" to player
 
On chat:
    if {timer::%player%} < 1:
        set {timer::%player%} to {slowchat}
        while {timer::%player%} > 0:
            wait 1 second
            remove 1 from {timer::%player%}
    else:
        cancel event
        send "Wait %{timer::%player%}% seconds" to player
this works, I tested it.
I'm using 1.8.
it doesn't work if iset slowchat to 1 second, I won't be able to type no matter wat.
 
Status
Not open for further replies.