How do i compare a message with a list

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

Dylan Bruner

New Member
Jan 16, 2020
5
0
0
23
I am making a word filter and would like to be able to add words from ingame but im getting a error
[doublepost=1579217806,1579217768][/doublepost]variables:
{warn} = 0
{words} = "text"
on chat:
if message contains {%words%}:
cancel event
send "Please don't curse" to player
add 1 to {warn.%player%}
if {warn.%player%} is "3":
execute console command "/tempmute %player% 1h swearing"
send "&4 You have been muted for cursing {warn.%player%} times"

command /cadd <text>:
trigger:
add arg-1 to {words}
[doublepost=1579217891][/doublepost]My error is: Can't understand this expression: words (word filter.sk, line 6: if message contains {%words%})
 
use this, you can add the swears to {words::*} i am in school rn so i cant
Code:
on chat:
    if message contains {words::*}:
        cancel event
        send "Please don't curse" to player
        add 1 to {warn.%player's uuid%}
        if {warn.%player's uuid%} is "3":
            execute console command "/tempmute %player% 1h swearing"
            send "&4 You have been muted for cursing {warn.%player's uuid%} times"
 
use this, you can add the swears to {words::*} i am in school rn so i cant
Code:
on chat:
    if message contains {words::*}:
        cancel event
        send "Please don't curse" to player
        add 1 to {warn.%player's uuid%}
        if {warn.%player's uuid%} is "3":
            execute console command "/tempmute %player% 1h swearing"
            send "&4 You have been muted for cursing {warn.%player's uuid%} times"
That won't actually work because skript checks if thebmessagt contains every single value. Loop the list and check if the message contains the loop-value
 
That won't actually work because skript checks if thebmessagt contains every single value. Loop the list and check if the message contains the loop-value
so this?
Code:
on chat:
    loop {words::*}:
        if message contains "%loop-value%":
            cancel event
            send "Please don't curse" to player
            add 1 to {warn.%player's uuid%}
            if {warn.%player's uuid%} is "3":
                execute console command "/tempmute %player% 1h swearing"
                send "&4 You have been muted for cursing {warn.%player's uuid%} times"
 
How would I make an command to add words to the list or words? I I know how to make a list of blocked words in skript but i want to be able to do

/cadd add/remove word

Could I use this

Code (Text):
  1. on chat:
  2. if message contains {words::*}:
  3. cancel event
  4. send "Please don't curse" to player
  5. add 1 to {warn.%player's uuid%}
  6. if {warn.%player's uuid%} is "3":
  7. execute console command "/tempmute %player% 1h swearing"
  8. send "&4 You have been muted for cursing {warn.%player's uuid%} times
  9. command /cadd <text>
  10. Trigger:
  11. add arg-1 to {words}

Not sure what's with the formating
 
How would I make an command to add words to the list or words? I I know how to make a list of blocked words in skript but i want to be able to do

/cadd add/remove word

Could I use this

Code (Text):
  1. on chat:
  2. if message contains {words::*}:
  3. cancel event
  4. send "Please don't curse" to player
  5. add 1 to {warn.%player's uuid%}
  6. if {warn.%player's uuid%} is "3":
  7. execute console command "/tempmute %player% 1h swearing"
  8. send "&4 You have been muted for cursing {warn.%player's uuid%} times
  9. command /cadd <text>
  10. Trigger:
  11. add arg-1 to {words}
here
Code:
on chat:
    loop {words::*}:
        if message contains "%loop-value%":
            cancel event
            send "Please don't curse" to player
            add 1 to {warn.%player's uuid%}
            if {warn.%player's uuid%} is "3":
                execute console command "/tempmute %player% 1h swearing"
                send "&4 You have been muted for cursing {warn.%player's uuid%} times"
command cadd <text>:
    permission: admin.cadd
    trigger:
        if arg-text is set:
            add arg-text to {words::*}
[doublepost=1579272189,1579271894][/doublepost]oops forgot to add "remove swears" command
Code:
on chat:
    loop {words::*}:
        if message contains "%loop-value%":
            cancel event
            send "Please don't curse" to player
            add 1 to {warn.%player's uuid%}
            if {warn.%player's uuid%} is "3":
                execute console command "/tempmute %player% 1h swearing"
                send "&4 You have been muted for cursing {warn.%player's uuid%} times"
command cadd <text>:
    permission: admin.cadd
    trigger:
        if arg-text is set:
            add arg-text to {words::*}
command cremove <text>:
    permission: admin.cremove
    trigger:
        if arg-text is set:
            if {words::*} contains arg-text:
                remove arg-tet from {words::*}
 
Status
Not open for further replies.