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 out 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 Chat commands with skript

Discussion in 'Skript' started by MCProHost, Sep 20, 2017.

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

    MCProHost Active Member

    Joined:
    Sep 17, 2017
    Messages:
    80
    Likes Received:
    0
    I want to use ! Before every command, however I was wondering how I would do teleport commands or anything that needs an argument want heres what I have so far

    On chat:
    If message contains "!Teleport"
    Cancel the event
     
  2. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    {_arguments::1} = full command: example "!teleport"

    {_arguments::2} = argument 1
    {_arguments::3} = argument 2
    {_arguments::4} = argument 3
    {_arguments::5} = argument 4
    {_arguments::6} = argument 5

    etc

    Code (Skript):
    1.  
    2. on chat:
    3.    set {_message} to message
    4.    set {_firstchar::*} to {_message} split at ""
    5.    if "%{_firstchar::1}%" = "!":
    6.        cancel event
    7.        set {_arguments::*} to {_message} split at " "
    8.        
    9.        #From here your own commands
    10.        
    11.        if {_arguments::1} = "!teleport":
    12.            if {_arguments::2} is set:
    13.                set {_player} to "%{_arguments::2}%" parsed as a offline player
    14.                if {_player} is online:
    15.                    teleport player to {_player}
    16.                else:
    17.                    message "&c%{_player}% is not online."
    18.            else:
    19.                message "&c!teleport <player>"
    20.            stop
    21.        message "&cUnknown command."
    22.  
     
  3. MCProHost

    MCProHost Active Member

    Joined:
    Sep 17, 2017
    Messages:
    80
    Likes Received:
    0
    Thanks I'll try it when I get home
     
  4. MrPaTaToX

    MrPaTaToX Member

    Joined:
    Mar 13, 2017
    Messages:
    1
    Likes Received:
    0
    You can use:
    Code (Skript):
    1.  
    2. on chat:
    3.     cancel event
    4.     if "%message%" contains "!teleport" or "!tp":
    5.         loop all players:
    6.             if "%message%" contains "%loop-player%":
    7.                 teleport player to loop-player
    8.  
     
  5. Lego_freak1999

    Lego_freak1999 Well-Known Member

    Joined:
    Jan 26, 2017
    Messages:
    664
    Likes Received:
    45
    yes but if you do "lego_freak1999 !teleport" in chat it works to
     
    • Like Like x 1
  6. MCProHost

    MCProHost Active Member

    Joined:
    Sep 17, 2017
    Messages:
    80
    Likes Received:
    0
    Thanks Lego_Freak1999 your the best!
     
Thread Status:
Not open for further replies.

Share This Page

Loading...