Solved Chat commands with skript

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

MCProHost

Active Member
Sep 17, 2017
80
0
0
28
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
 
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

{_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_language.skript:
on chat:
   set {_message} to message
   set {_firstchar::*} to {_message} split at ""
   if "%{_firstchar::1}%" = "!":
       cancel event
       set {_arguments::*} to {_message} split at " "
       
       #From here your own commands
       
       if {_arguments::1} = "!teleport":
           if {_arguments::2} is set:
               set {_player} to "%{_arguments::2}%" parsed as a offline player
               if {_player} is online:
                   teleport player to {_player}
               else:
                   message "&c%{_player}% is not online."
           else:
               message "&c!teleport <player>"
           stop
       message "&cUnknown command."
 
You can use:
code_language.skript:
on chat:
    cancel event
    if "%message%" contains "!teleport" or "!tp":
        loop all players:
            if "%message%" contains "%loop-player%":
                teleport player to loop-player
 
Status
Not open for further replies.