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.

Solved execute player command issue

Discussion in 'Skript' started by FallingCatus, Jun 29, 2017.

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

    FallingCatus Active Member

    Joined:
    Jun 29, 2017
    Messages:
    37
    Likes Received:
    0
    Hey so i am completely new a using Skript so my project will be very simple to most and probably very common, I am making a simple punish/ban GUI plugin and i have 2 separate Skript files for my tempban and permban GUIs and they both work perfect, what I'm having issues with is what I'm planning on being the "home" GUI that will open and have a choice within this GUI to open temp or perm bans.
    In my head i want it so that when you click the item to open the tempban GUI it will just run the command that i would use as if i was typing in chat to open that GUI but when i click the GUI closes fine but does not open the new GUI, This is the code...

    Thanks

    Code (Skript):
    1. command /ban [<offline player>] [<text>]:
    2.     permission: ban.use
    3.     permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
    7.         if arg-1 is set:
    8.             open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
    9.             wait 1 tick
    10.             format slot 0 of player with black glass pane named " " with lore " " to be unstealable
    11.             format slot 1 of player with black glass pane named " " with lore " " to be unstealable
    12.             format slot 2 of player with black glass pane named " " with lore " " to be unstealable
    13.             format slot 3 of player with black glass pane named " " with lore " " to be unstealable
    14.             format slot 4 of player with black glass pane named " " with lore " " to be unstealable
    15.             format slot 5 of player with black glass pane named " " with lore " " to be unstealable
    16.             format slot 6 of player with black glass pane named " " with lore " " to be unstealable
    17.             format slot 7 of player with black glass pane named " " with lore " " to be unstealable
    18.             format slot 8 of player with black glass pane named " " with lore " " to be unstealable
    19.             format slot 9 of player with black glass pane named " " with lore " " to be unstealable
    20.             format slot 10 of player with black glass pane named " " with lore " " to be unstealable
    21.             format slot 11 of player with yellow glass pane named "&e&lTemp Ban: &7%arg-1%" with lore "" to close then run [execute player command "/skript:tempban %arg-1%"]
    22.             format slot 12 of player with black glass pane named " " with lore " " to be unstealable
    23.             format slot 13 of player with black glass pane named " " with lore " " to be unstealable
    24.             format slot 14 of player with black glass pane named " " with lore " " to be unstealable
    25.             format slot 15 of player with red glass pane named "&c&lPerm Ban: &7%arg-1%" with lore " " to be unstealable
    26.             format slot 16 of player with black glass pane named " " with lore " " to be unstealable
    27.             format slot 17 of player with black glass pane named " " with lore " " to be unstealable
    28.             format slot 18 of player with black glass pane named " " with lore " " to be unstealable
    29.             format slot 19 of player with black glass pane named " " with lore " " to be unstealable
    30.             format slot 20 of player with black glass pane named " " with lore " " to be unstealable
    31.             format slot 21 of player with black glass pane named " " with lore " " to be unstealable
    32.             format slot 22 of player with black glass pane named " " with lore " " to be unstealable
    33.             format slot 23 of player with black glass pane named " " with lore " " to be unstealable
    34.             format slot 24 of player with black glass pane named " " with lore " " to be unstealable
    35.             format slot 25 of player with black glass pane named " " with lore " " to be unstealable
    36.             format slot 26 of player with black glass pane named " " with lore " " to be unstealable


     
  2. Best Answer:
    Post #10 by ShaneBee, Jun 30, 2017
  3. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Add a "wait 1 tick" after the gui closes, then run the command, I'm pretty sure it's because it's doing it to quickly.
     
    • Like Like x 1
  4. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Thanks Selvati for your reply, i had a gut feeling this may have been the issue but i cant seem to add the "wait 1 tick" without having errors, could you please give an example on where i would put it for it to delay the command?

    Thanks
     
  5. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Replace with

    Code (Skript):
    1. if arg-1 is set:
    2.             Wait 1 tick
    3.             open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
    4.             wait 1 tick
     
    • Like Like x 1
  6. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Thanks Lego Freak but that does not solve the problem i have, the problem is on line 21 for when the player clicks the item the next GUI will not open. so the tick delay needs to be from when the GUI closes and the /tempban command is run but i cant seem to do this without errors on reload.
     
  7. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Can you show what you have now?
     
  8. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    This is what it is after adding what you said...

    Code (Skript):
    1. command /punish [<offline player>] [<text>]:
    2.     permission: ban.use
    3.     permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    4.     trigger:
    5.         if arg-1 is not set:
    6.             send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
    7.         if arg-1 is set:
    8.             wait 1 tick
    9.             open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
    10.             wait 1 tick
    11.             format slot 0 of player with black glass pane named " " with lore " " to be unstealable
    12.             format slot 1 of player with black glass pane named " " with lore " " to be unstealable
    13.             format slot 2 of player with black glass pane named " " with lore " " to be unstealable
    14.             format slot 3 of player with black glass pane named " " with lore " " to be unstealable
    15.             format slot 4 of player with black glass pane named " " with lore " " to be unstealable
    16.             format slot 5 of player with black glass pane named " " with lore " " to be unstealable
    17.             format slot 6 of player with black glass pane named " " with lore " " to be unstealable
    18.             format slot 7 of player with black glass pane named " " with lore " " to be unstealable
    19.             format slot 8 of player with black glass pane named " " with lore " " to be unstealable
    20.             format slot 9 of player with black glass pane named " " with lore " " to be unstealable
    21.             format slot 10 of player with black glass pane named " " with lore " " to be unstealable
    22.             format slot 11 of player with yellow glass pane named "&e&lTemp Ban: &7%arg-1%" with lore "" to close then run [execute player command "/skript:tempban %arg-1%"]
    23.             format slot 12 of player with black glass pane named " " with lore " " to be unstealable
    24.             format slot 13 of player with black glass pane named " " with lore " " to be unstealable
    25.             format slot 14 of player with black glass pane named " " with lore " " to be unstealable
    26.             format slot 15 of player with red glass pane named "&c&lPerm Ban: &7%arg-1%" with lore " " to close then run [execute player command "/skript:ban %arg-1%"]
    27.             format slot 16 of player with black glass pane named " " with lore " " to be unstealable
    28.             format slot 17 of player with black glass pane named " " with lore " " to be unstealable
    29.             format slot 18 of player with black glass pane named " " with lore " " to be unstealable
    30.             format slot 19 of player with black glass pane named " " with lore " " to be unstealable
    31.             format slot 20 of player with black glass pane named " " with lore " " to be unstealable
    32.             format slot 21 of player with black glass pane named " " with lore " " to be unstealable
    33.             format slot 22 of player with black glass pane named " " with lore " " to be unstealable
    34.             format slot 23 of player with black glass pane named " " with lore " " to be unstealable
    35.             format slot 24 of player with black glass pane named " " with lore " " to be unstealable
    36.             format slot 25 of player with black glass pane named " " with lore " " to be unstealable
    37.             format slot 26 of player with black glass pane named " " with lore " " to be unstealable
    38.  
    The problem is with format slot 11 and 15. The command will not run so the delay of 1 tick needs to be after gui closes and before the command but i cant seem to get it to work.
     
  9. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Try this because sometimes double quotes are needed in order to make some text work.
    Code (Skript):
    1. to close then run [execute player command ""/skript:ban %arg-1%""]
    Also, to make your formatting not repetitive, this is a much faster way of formatting.
    Code (Skript):
    1.  
    2.         set {_n} to 0
    3.         loop 26 times:
    4.             if {_n} is 11:
    5.                 format slot 11 of player with yellow glass pane named "&e&lTemp Ban: &7%arg-1%" with lore "" to close then run [execute player command ""/skript:tempban %arg-1%""]
    6.             else if {_n} is 15:
    7.                 format slot 15 of player with red glass pane named "&c&lPerm Ban: &7%arg-1%" with lore " " to close then run [execute player command ""/skript:ban %arg-1%""]
    8.             else:
    9.                 format slot {_n} of player with black glass pane named " " with lore " " to be unstealable
    10.             add 1 to {_n}
     
    • Informative Informative x 1
  10. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Thanks very much White, sadly the double quotes did not not work and just showed errors on the reload :emoji_frowning: but the tip for keeping it more comapct and easier to write is great, Thank you for that :emoji_grinning: Im very new to this so tips like this are great! i am guessing there is no way to have it so i cant just add 1 tick before the command is run? like this...

    Code (Skript):
    1. format slot 11 of player with yellow glass pane named "&e&lTemp Ban: &7%arg-1%" with lore "" to close then wait 1 tick then run [execute player command "/skript:tempban %arg-1%"]
     
  11. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Don't think you can add wait a tick in format slot. The only way I know of is to add the wait tick in the command you created, which is /skript:tempban.
     
    • Like Like x 1
  12. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    White you are my god, thank you! im not sure why i never thought about adding the delay on the other skript file! i added 2 ticks before its looks for arg-1 and it now works perfect, Thank you very much!
     
  13. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Interesting... never thought that would fix it.
     
  14. ShaneBee

    Supporter + Addon Developer

    Joined:
    Sep 7, 2017
    Messages:
    1,811
    Likes Received:
    125
    Code (Skript):
    1. command /smpadmintempban [<offline player>] [<text>]:
    2.     permission: smpban.use
    3.     permission message: &c&lSMP&f&lAdmin &8> &aNice try! &7Only our staff have this permission.
    4.     trigger:
    5.         wait 1.5 tick
    6.         if arg-1 is not set:
    7.             send "&c&lSMP&f&lAdmin &r&8> &6/tempban &7<player>"
    8.         if arg-1 is set:
    9.             open chest with 5 rows named "&c&lSMP&f&lAdmin &6&lTemp: &r&a%arg-1%" to player
    10.             wait 1 tick
    yeah just added the delay after the trigger on the ban page skripts, anything less than 1.5 ticks and it wont open, Thanks again!
     
Thread Status:
Not open for further replies.
Loading...