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.

cancel cooldown

Discussion in 'Skript' started by FireRoz, Nov 10, 2020.

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

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    hey,
    I wanna make it so Moderators will be able to bypass chat cooldown.
    here's my code:
    Code (Text):
    1. command /slowchat [<number>]:
    2.   permission: slowchat
    3.   permission message: &cYou do not have access to this command.
    4.   trigger:
    5.     if arg-1 is not set:
    6.       send "&cUsage: /slowchat <cooldown in seconds>"
    7.     if arg-1 is set:
    8.       set {slowchat} to "%arg-1% seconds" parsed as timespan
    9.       loop all players:
    10.         if loop-player has permission "slowchat":
    11.           send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
    12.           send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
    13.      
    14. on chat:
    15.   set {chat} to difference between {chat.%player%} and now
    16.   if {chat} is less than {slowchat}:
    17.     cancel event
    18.     message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    19.     stop
    20.     set {chat.%player%} to now
     
  2. Ankoki

    Supporter

    Joined:
    Nov 5, 2020
    Messages:
    55
    Likes Received:
    11
    in your on chat event, just add something similar to this at the very start such as this
    Code (Text):
    1. on chat:
    2.     if player has permission "xyz":
    3.         stop
    4.     #do rest
     
  3. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    doesn't work :/.
    Members can still bypass chat cooldown
     
  4. Ankoki

    Supporter

    Joined:
    Nov 5, 2020
    Messages:
    55
    Likes Received:
    11
    Without looking at your code, i'll write an example of what i would do
    Code (Text):
    1. on chat:
    2.     if {slowchat} > 0:
    3.          if player has permission "mod":
    4.              stop
    5.          set {_chat} to now
    6.          if (difference between {chat::%player's uuid%} and now) < {slowchat}:
    7.              cancel event
    8.              send "&c[!] You have been halted by slowchat!"
    9.              stop
    10.          set {chat::%player's uuid%} to now
     
    #4 Ankoki, Nov 10, 2020
    Last edited: Nov 10, 2020
  5. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    Too many errors.
    & when I try & fix those errors, it will not work
     
  6. Ankoki

    Supporter

    Joined:
    Nov 5, 2020
    Messages:
    55
    Likes Received:
    11
    I put this in the parser and it was parsed with no errors, send them and i'll help fix them:emoji_slight_smile:

    EDIT: I found 1 thing as i thought slowchat was a boolean, changed it and should work:emoji_slight_smile:
     
  7. TenToTu Sho

    TenToTu Sho Member

    Joined:
    Dec 30, 2019
    Messages:
    20
    Likes Received:
    2
    Code (Text):
    1. on chat:
    2.   set {chat} to difference between {chat.%player%} and now
    3.   if {chat} is less than {slowchat}:
    4.     sender does not have permission "your.perm.here"
    5.     cancel event
    6.     message "&cYou're on chat cooldown &4(&f%{slowchat}%&4)"
    7.     stop
    8.     set {chat.%player%} to now
     
  8. Fyriiee

    Fyriiee Member

    Joined:
    Sep 30, 2020
    Messages:
    26
    Likes Received:
    0
    If I was to do this, I would do it like this:

    Code (Text):
    1. command /slowchat [<number>]:
    2.     permission: slowchat
    3.     permission message: &cYou do not have access to this command.
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&cUsage: /slowchat <cooldown in seconds>"
    7.         if arg-1 is set:
    8.             set {slowchat} to arg-1
    9.             loop all players:
    10.                 if loop-player has permission "slowchat":
    11.                     send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
    12.             send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
    13.  
    14. On chat:
    15.     if {_timer} >= {slowchat}:
    16.         set {_timer} to 0
    17.         loop {slowchat} times:
    18.             add 1 to {_timer}
    19.             wait 1 second
    20.     else:
    21.         send "Wait %{_timer}% seconds"
     
  9. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    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
    --- Double Post Merged, Nov 11, 2020, Original Post Date: Nov 11, 2020 ---
    Members can still spam.
    what is it with this bypass cooldown it's like cursed
     
  10. Fyriiee

    Fyriiee Member

    Joined:
    Sep 30, 2020
    Messages:
    26
    Likes Received:
    0
    Try this:
    Code (Text):
    1. command /slowchat [<number>]:
    2.     permission: slowchat
    3.     permission message: &cYou do not have access to this command.
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&cUsage: /slowchat <cooldown in seconds>"
    7.         if arg-1 is set:
    8.             set {slowchat} to arg-1
    9.             loop all players:
    10.                 if loop-player has permission "slowchat":
    11.                     send "&D[STAFF] &e%player% &6&lhas set the chat cooldown to &e%arg-1% &6&lsecond(s)" to loop-player
    12.             send "&aYou've set the chat cooldown to %arg-1% second(s)" to player
    13.  
    14. On chat:
    15.     if {timer::%player%} <= 0:
    16.         set {timer::%player%} to {slowchat}
    17.         loop {slowchat}+1 times:
    18.             remove 1 from {timer::%player%}
    19.             wait 1 second
    20.     else:
    21.         send "Wait %{timer::%player%}% seconds" to player
     
  11. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    does not work
     
  12. Fyriiee

    Fyriiee Member

    Joined:
    Sep 30, 2020
    Messages:
    26
    Likes Received:
    0
    Code (Text):
    1. command /slowchat [<number>]:
    2.     permission: slowchat
    3.     permission message: &cYou do not have access to this command.
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&cUsage: /slowchat <cooldown in seconds>"
    7.         if arg-1 is set:
    8.             set {slowchat} to arg-1
    9.             loop all players:
    10.                 if loop-player has permission "slowchat":
    11.                     send "&D[STAFF] &7%player% &6&lhas set the chat cooldown to &a%arg-1% &7second(s)" to loop-player
    12.             send "&7You've set the chat cooldown to &a%arg-1% &7second(s)" to player
    13.  
    14. On chat:
    15.     if {timer::%player%} < 1:
    16.         set {timer::%player%} to {slowchat}
    17.         while {timer::%player%} > 0:
    18.             wait 1 second
    19.             remove 1 from {timer::%player%}
    20.     else:
    21.         cancel event
    22.         send "Wait %{timer::%player%}% seconds" to player
    this works, I tested it.
     
  13. FireRoz

    FireRoz Active Member

    Joined:
    May 28, 2020
    Messages:
    134
    Likes Received:
    5
    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.
     
Thread Status:
Not open for further replies.

Share This Page

Loading...