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!

Dismiss Notice
This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Solved Anti command spam

Discussion in 'Requests' started by Buzdrev, Jun 4, 2017.

  1. Buzdrev

    Buzdrev Member

    Joined:
    Feb 25, 2017
    Messages:
    23
    Likes Received:
    0
    Hi there, I need simple skript which will block all command spam.

     
  2. Best Answer:
    Post #6 by ShaneBee, Jun 6, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    how long you want the cooldown to be?
     
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    or this:
    Code (Skript):
    1. on command:
    2.     if {Command::%player%} is "%full command%":
    3.         send "You spamming this commands!"
    4.         cancel event
    5.     else:
    6.         set {Command::%player%} to "%full command%"

    else cooldown:

    Code (Skript):
    1. on command:
    2.     if {CoolDown::%player%} is not set:
    3.         set {CoolDown::%player%} to now
    4.         stop
    5.     if difference between {CoolDown::%player%} and now is less than 5 seconds:#<= here changeable
    6.         send "Stop spamming commands."
    7.         cancel event
    8.     else:
    9.         set {CoolDown::%player%} to now
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Code (Skript):
    1. on command:
    2.   if player has permission "skript.command.waiting.bypass":
    3.     stop
    4.   if {lastusedcommand::%player%} is set:
    5.     set {_timespan} to difference between {lastusedcommand.%player%} and now
    6.     if {_timespan} is less than 1 minute:
    7.       cancel event.
    8.       message "You can't use commands so fast!"
    9.       stop
    10.   set {lastusedcommand::%player%} to now
     
    #4 ShaneBee, Jun 4, 2017
    Last edited by a moderator: Jun 4, 2017
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    I want to use this type of blocking spam:

    on command:
    if {Command::%player%} is "%full command%":
    send "You spamming this commands!"
    cancel event
    else:
    set {Command::%player%} to "%full command%"

    But I want to block the spam on the third try to write same command.
    So the players would be able to write same command only two times.
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    234
    Then easy add:

    Code (Skript):
    1. on command:
    2.     if {Command::%player%} is "%full command%":
    3.         if {CommandCount::%player%} is more than or equal to 2:
    4.             send "You spamming this commands!"
    5.             cancel event
    6.         else:
    7.             add 1 to {CommandCount::%player%}
    8.     else:
    9.         set {Command::%player%} to "%full command%"
    10.         set {CommandCount::%player%} to 1
     

Share This Page

Loading...