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.

Custom Command In World

Discussion in 'Skript' started by Hey, Jul 14, 2019.

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

    Hey Member

    Joined:
    Feb 21, 2017
    Messages:
    1
    Likes Received:
    0
    I'm trying to make a custom command /fight only activate in the world spawn, I got it to activate but it works in all other worlds also. The command gives players 2 permissions and displays a message. I'm new to skript so I don't really know how to make it work.

    command /fight:
    trigger:
    if player is in "spawn":

    That's what I used, but like I said it works in ALL worlds. Is there a way to fix this?
     
  2. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    406
    Likes Received:
    14
    Mmm... if the command does not have an argument, try the "on Command" event.
    Code (Skript):
    1.  
    2. on command "/fight":
    3.     sender = player
    4.     player's world is "spawn":
    5.         cancel event
    6.         #do stuff#
    7.     player's world isn't "spawn":
    8.         uncancel event
    9.  
    I have not tried it, but I have an idea that something like that could be.
     
  3. TPGamesNL

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,310
    Likes Received:
    73
    Medals:
    Why would you do that in an on command? It's better to add it to the existing command
     
  4. couger44

    Supporter

    Joined:
    Feb 19, 2017
    Messages:
    406
    Likes Received:
    14
    ...? I do not understand.
     
  5. TPGamesNL

    TPGamesNL Well-Known Member

    Joined:
    Jan 20, 2018
    Messages:
    1,310
    Likes Received:
    73
    Medals:
    It's better to add the condition for the player's world to the command code, there is no need for a seperate trigger.
     
  6. tomorrow0325

    tomorrow0325 Member

    Joined:
    Aug 1, 2017
    Messages:
    1
    Likes Received:
    0
    Maybe this is right:
    Code (Text):
    1. command /fight:
    2.     trigger:
    3.         if player's world is "spawn":
    4.             execute console command "you permission command here"
    5.             message "your message here"
    6.         else:
    7.             message "you can't use this command in this world"
     
  7. Skriptex

    Skriptex Member

    Joined:
    Jul 9, 2019
    Messages:
    4
    Likes Received:
    1
    Code (Text):
    1. options:
    2.     world: "spawn"
    3.  
    4. command /fly:
    5.     executable by: players
    6.     trigger:
    7.         if the player's world isn't {@world}:
    8.             send message "Unknown command. Type ""/help"" for help." to the player
    9.         else:
    10.             if the player can't fly:
    11.                 allow flight to the player
    12.                 send message "You can now fly!" to the player
    13.             else:
    14.                 disallow flight to the player
    15.                 send message "You can't fly anymore!" to the player
     
    • Like Like x 1
Thread Status:
Not open for further replies.
Loading...