Cooldown to prevent msg 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!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

iMinePixels

Member
Mar 12, 2024
22
1
1
23
I would like some help. I am wanting a cooldown for the pvp message to the attacker so they cannot sit there and spam their chat.
I've tried following a post called cooldowns for dummies, but it just wasn't working out.

Code:
on damage of player:
    victim is a player
    attacker is a player
    if world of victim is not "spawn":
        cancel event
        play sound "ENTITY_VILLAGER_NO" to attacker
        send "&7PVP is not enabled here!" to attacker
 
Code:
options:
    cooldown: 5 seconds

cooldowns: map

on damage of player:
    victim is a player
    attacker is a player
    if world of victim is not "spawn":
        cancel event
        play sound "ENTITY_VILLAGER_NO" to attacker
        if {cooldowns::%attacker%} is not set:
            send "&7PVP is not enabled here!" to attacker
            set {cooldowns::%attacker%} to now
        else:
            if {cooldowns::%attacker%} > now - {@cooldown}:
                stop
            send "&7PVP is not enabled here!" to attacker
            set {cooldowns::%attacker%} to now


Try this