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.

I Can't Get A Player To Be Forced To Execute A Command.

Discussion in 'Skript' started by Fadik2003, Jul 22, 2017.

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

    Fadik2003 Member

    Joined:
    Jul 22, 2017
    Messages:
    1
    Likes Received:
    0
    Can you please hep me ? So I am having trouble with getting a player to be forced to execute a command that is triggered by an event or a loop so for example I have an NPC and I coded a script to where an event is triggered when this specific NPC is clicked here is my block of code :

    on right click on player:
    if name of clicked player is "&e&lCommand":
    cancel the event

    I just don't know what to add next to make it so that when that player or NPC is rightclicked the player who rightclicked is gonna be forced to execute a specific command, I tried:

    make player execute command "/command1"


    But it keeps giving me an error in the chat when I save and try to reload the script. But when I remove this specific line of code it stops giving me the problem so that's how i made sure that it wasn't something else, and also I know that the first block of code I gave has no errors by making it so that it opens a gui and formats some item in, I just can't get it to force a player to execute a specific command can someone please help me with that, thank you so much for reading my Thread.
    --- Double Post Merged, Jul 22, 2017, Original Post Date: Jul 22, 2017 ---
    In the thread above in the first block of code, I tried to make the lines spaced out same as in my text editor but it keeps putting them back together.
     
  2. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    2,183
    Likes Received:
    232
    If you click the little box with a plus sign next to the video button on the default text editor here, you can insert code.

    Anyways, I'm assuming you're using Citizens for npc stuffs, in which case SkRayFall has npc clicking events, which you should use instead of "on right click on player:"

    Code (Skript):
    1.  
    2. on npc right click:
    3.     if citizen is named "&e&lCommand":
    4.         make player execute command "/command1"
    5.         cancel the event
    6.  
     
Thread Status:
Not open for further replies.

Share This Page

Loading...