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!

  2. LOOKING FOR A VERSION OF SKRIPT??:

    You can always check our our Wiki for downloads and any other information about Skript!

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

Solved Invalid Characters

Discussion in 'Skript' started by DieserTicket, Jun 16, 2019.

Thread Status:
Not open for further replies.
  1. DieserTicket

    DieserTicket Member

    Joined:
    Feb 11, 2019
    Messages:
    9
    Likes Received:
    0
    Can someone tell me how to forbid all invalid characters in skript?
    Like this: %²}}\%➦⬇✺✈➧➲▀

    i could do this:
    if arg-1 contains "➦" or "⬇" or "✺" or "✈" or "➧" or "➲" or "▀":
    message "Nope" to player
    stop

    but i want to forbid ALL invalid characters. How is that possible in skript?

    like this:
    if arg-1 contains invalid characters:
    message "Nope" to player
    stop

    How can i do this?

     
  2. Best Answer:
    Post #11 by DieserTicket, Jun 20, 2019
  3. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,286
    Likes Received:
    72
    Medals:
    You could make a list of all allowed characters and replace those in a local variable which contains the message with "". If the local variable is "" after you've replaced the allowed characters, then the message is allowed. If it isn't "", it contains characters that aren't allowed.
     
  4. DieserTicket

    DieserTicket Member

    Joined:
    Feb 11, 2019
    Messages:
    9
    Likes Received:
    0
    Could you make an example for me?
     
  5. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,286
    Likes Received:
    72
    Medals:
    nope
     
  6. Runakai1

    Runakai1 Well-Known Member

    Joined:
    Apr 27, 2018
    Messages:
    396
    Likes Received:
    20
    You could use regex matches
     
  7. T

    TubeVillager Active Member

    Joined:
    Jan 29, 2019
    Messages:
    28
    Likes Received:
    1
    if arg-1 doesn't contain "a" or "b" or "c" or *go on like this with all characters that are ALLOWED*
    stop
     
  8. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,286
    Likes Received:
    72
    Medals:
    If you do that you will need to type every allowed character in the message for the message to be allowed...
     
  9. T

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,286
    Likes Received:
    72
    Medals:
    upload_2019-6-17_19-28-28.png

    Code (Text):
    1. command /test <string>:
    2.     trigger:
    3.         if arg-1 doesn't contain "a" or "b":
    4.             message "no contain"
    5.         else:
    6.             message "yes contain (%arg-1%)"
    doesn't work for me
     
  10. T

    TubeVillager Active Member

    Joined:
    Jan 29, 2019
    Messages:
    28
    Likes Received:
    1
    oh yeah haha nevermind then. sorry i didnt see that.
     
  11. S

    SpLayzDK Member

    Joined:
    Jun 15, 2019
    Messages:
    9
    Likes Received:
    0
    You can manually make a variable / list ingame with all forbidden words:

    command /addforbiddenword [<text>]:
    permission: djawdj
    trigger:
    if arg-1 is set:
    add arg-1 to {forbidwords::*}
     
  12. DieserTicket

    DieserTicket Member

    Joined:
    Feb 11, 2019
    Messages:
    9
    Likes Received:
    0
    Code (Text):
    1.                     set {_c} to "%arg-2%"
    2.                     loop {allowed.characters::*}
    3.                         remove "%loop-value%" from {_c}
    4.                     if {_c} is not "":
    5.                         message "{@Prefix} &7Invalid Character!"
    6.                         stop
     
Thread Status:
Not open for further replies.
Loading...