When player have 3 warns, mute player for 5 mins

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

Endas

Member
Jun 22, 2020
10
0
1
44
Help someone please...


command /warn <text> <text>:
trigger:
add 1 to {warns.%arg-1%.warn}
add 1 to {warn.%arg-1%}
broadcast " &a&l%arg-1% &2got warn &a%arg-2%"

every 1 tick in "world":
loop all players:
if {warn.%loop-player%} is 5:
add 300 to {mute.%loop-player%}
wait 300 seconds
set {warn.%loop-player%} to 0

every 1 second in "world":
loop all players:
if {mute.%loop-player%} is more than 0:
remove 1 from {mute.%loop-player%}
else:
delete {mute.%loop-player%}
 
think this should do it. [HAVENT TESTED]

command /warn <text> <text>:
trigger:
add 1 to {warns.%arg-1%.warn}
add 1 to {warn.%arg-1%}
if {warns.%arg-1%.warn} is 3:
set {muted.%player%} to true
broadcast " &a&l%arg-1% &2got warned &a%arg-2%"

every 1 tick in "world":
loop all players:
if {muted.%player%} is true:
add 300 to {mute.%loop-player%}
wait 300 seconds
set {muted.%player%} to false

every 1 second in "world":
loop all players:
if {mute.%loop-player%} is more than 0:
remove 1 from {mute.%loop-player%}
else:
delete {mute.%loop-player%}
 
*by the way, none of these contain the actual being muted part:


Code:
on chat:
    if {mute.%player%} is true:
        cancel event
 
think this should do it. [HAVENT TESTED]

command /warn <text> <text>:
trigger:
add 1 to {warns.%arg-1%.warn}
add 1 to {warn.%arg-1%}
if {warns.%arg-1%.warn} is 3:
set {muted.%player%} to true
broadcast " &a&l%arg-1% &2got warned &a%arg-2%"

every 1 tick in "world":
loop all players:
if {muted.%player%} is true:
add 300 to {mute.%loop-player%}
wait 300 seconds
set {muted.%player%} to false

every 1 second in "world":
loop all players:
if {mute.%loop-player%} is more than 0:
remove 1 from {mute.%loop-player%}
else:
delete {mute.%loop-player%}

I do not think there is such thing as "delete {variablegoeshere}".
I have tried this skript, and it seems to look good. Just a way to cancel chats based on variables.

Code:
on chat:
  if {warn.%player%} is 3:
    cancel event
    send "&4&lMUTE&f > You've been silenced."
    wait 5 minutes
    set {warn.%player%} to 0

Make sure you add 1 to {warn.%arg-1%} if you're putting an argument in your command :emoji_grinning:
Also, arguments are formatted like [<text>] in your command.
 
I do not think there is such thing as "delete {variablegoeshere}".
I have tried this skript, and it seems to look good. Just a way to cancel chats based on variables.

Code:
on chat:
  if {warn.%player%} is 3:
    cancel event
    send "&4&lMUTE&f > You've been silenced."
    wait 5 minutes
    set {warn.%player%} to 0

Make sure you add 1 to {warn.%arg-1%} if you're putting an argument in your command :emoji_grinning:
Also, arguments are formatted like [<text>] in your command.
1. Yes, "delete {variable}" exists :emoji_wink: as well as "clear {variable}"
2. No, not this way. This would turn on every time you (don't) send a message. That means he would get 3 warns and nothing would happen. Then, he would chat and it will start, wait for 5 minutes and set the number of warns to 0. He may try to send millions of messages and there would be millions of waitings. That means he could try to send message after 4 minutes, another counting would start, meanwhile in 1 minute he would have the number of warns to 0, the he could get another warn (so he has 1 warnings) BUT then the second counting would stop and he would have 0 again instead of one. It is just completely wrong. I would rather use this:

Code:
command /warn:
    #...
    trigger:
        #...
        add 1 to {warns.%arg-1%.warn}
        if {warns.%arg-1%.warn} is 3:
            set {muted.%player%} to true
            wait 5 minutes
            clear {muted.%player%}
            remove 3 from {warns.%arg-1%.warn}
        #...
 
Status
Not open for further replies.