Solved Anti command spam

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

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


else cooldown:

code_language.skript:
on command:
    if {CoolDown::%player%} is not set:
        set {CoolDown::%player%} to now
        stop
    if difference between {CoolDown::%player%} and now is less than 5 seconds:#<= here changeable
        send "Stop spamming commands."
        cancel event
    else:
        set {CoolDown::%player%} to now
 
code_language.skript:
on command:
  if player has permission "skript.command.waiting.bypass":
    stop
  if {lastusedcommand::%player%} is set:
    set {_timespan} to difference between {lastusedcommand.%player%} and now
    if {_timespan} is less than 1 minute:
      cancel event.
      message "You can't use commands so fast!"
      stop
  set {lastusedcommand::%player%} to now
 
Last edited by a moderator:
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.
 
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.

Then easy add:

code_language.skript:
on command:
    if {Command::%player%} is "%full command%":
        if {CommandCount::%player%} is more than or equal to 2:
            send "You spamming this commands!"
            cancel event
        else:
            add 1 to {CommandCount::%player%}
    else:
        set {Command::%player%} to "%full command%"
        set {CommandCount::%player%} to 1