Custom Command In World

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

Hey

Member
Feb 21, 2017
1
0
0
23
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?
 
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?
Mmm... if the command does not have an argument, try the "on Command" event.
code_language.skript:
on command "/fight":
    sender = player
    player's world is "spawn":
        cancel event
        #do stuff#
    player's world isn't "spawn":
        uncancel event
I have not tried it, but I have an idea that something like that could be.
 
Mmm... if the command does not have an argument, try the "on Command" event.
code_language.skript:
on command "/fight":
    sender = player
    player's world is "spawn":
        cancel event
        #do stuff#
    player's world isn't "spawn":
        uncancel event
I have not tried it, but I have an idea that something like that could be.
Why would you do that in an on command? It's better to add it to the existing command
 
Maybe this is right:
Code:
command /fight:
    trigger:
        if player's world is "spawn":
            execute console command "you permission command here"
            message "your message here"
        else:
            message "you can't use this command in this world"
 
Code:
options:
    world: "spawn"

command /fly:
    executable by: players
    trigger:
        if the player's world isn't {@world}:
            send message "Unknown command. Type ""/help"" for help." to the player
        else:
            if the player can't fly:
                allow flight to the player
                send message "You can now fly!" to the player
            else:
                disallow flight to the player
                send message "You can't fly anymore!" to the player
 
  • Like
Reactions: tomorrow0325
Status
Not open for further replies.