Solved execute player command issue

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

FallingCatus

Member
Jun 29, 2017
38
0
6
33
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_language.skript:
command /ban [<offline player>] [<text>]:
    permission: ban.use
    permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    trigger:
        if arg-1 is not set:
            send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
        if arg-1 is set:
            open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
            wait 1 tick
            format slot 0 of player with black glass pane named " " with lore " " to be unstealable
            format slot 1 of player with black glass pane named " " with lore " " to be unstealable
            format slot 2 of player with black glass pane named " " with lore " " to be unstealable
            format slot 3 of player with black glass pane named " " with lore " " to be unstealable
            format slot 4 of player with black glass pane named " " with lore " " to be unstealable
            format slot 5 of player with black glass pane named " " with lore " " to be unstealable
            format slot 6 of player with black glass pane named " " with lore " " to be unstealable
            format slot 7 of player with black glass pane named " " with lore " " to be unstealable
            format slot 8 of player with black glass pane named " " with lore " " to be unstealable
            format slot 9 of player with black glass pane named " " with lore " " to be unstealable
            format slot 10 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 12 of player with black glass pane named " " with lore " " to be unstealable
            format slot 13 of player with black glass pane named " " with lore " " to be unstealable
            format slot 14 of player with black glass pane named " " with lore " " to be unstealable
            format slot 15 of player with red glass pane named "&c&lPerm Ban: &7%arg-1%" with lore " " to be unstealable
            format slot 16 of player with black glass pane named " " with lore " " to be unstealable
            format slot 17 of player with black glass pane named " " with lore " " to be unstealable
            format slot 18 of player with black glass pane named " " with lore " " to be unstealable
            format slot 19 of player with black glass pane named " " with lore " " to be unstealable
            format slot 20 of player with black glass pane named " " with lore " " to be unstealable
            format slot 21 of player with black glass pane named " " with lore " " to be unstealable
            format slot 22 of player with black glass pane named " " with lore " " to be unstealable
            format slot 23 of player with black glass pane named " " with lore " " to be unstealable
            format slot 24 of player with black glass pane named " " with lore " " to be unstealable
            format slot 25 of player with black glass pane named " " with lore " " to be unstealable
            format slot 26 of player with black glass pane named " " with lore " " to be unstealable
 
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_language.skript:
command /ban [<offline player>] [<text>]:
    permission: ban.use
    permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    trigger:
        if arg-1 is not set:
            send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
        if arg-1 is set:
            open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
            wait 1 tick
            format slot 0 of player with black glass pane named " " with lore " " to be unstealable
            format slot 1 of player with black glass pane named " " with lore " " to be unstealable
            format slot 2 of player with black glass pane named " " with lore " " to be unstealable
            format slot 3 of player with black glass pane named " " with lore " " to be unstealable
            format slot 4 of player with black glass pane named " " with lore " " to be unstealable
            format slot 5 of player with black glass pane named " " with lore " " to be unstealable
            format slot 6 of player with black glass pane named " " with lore " " to be unstealable
            format slot 7 of player with black glass pane named " " with lore " " to be unstealable
            format slot 8 of player with black glass pane named " " with lore " " to be unstealable
            format slot 9 of player with black glass pane named " " with lore " " to be unstealable
            format slot 10 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 12 of player with black glass pane named " " with lore " " to be unstealable
            format slot 13 of player with black glass pane named " " with lore " " to be unstealable
            format slot 14 of player with black glass pane named " " with lore " " to be unstealable
            format slot 15 of player with red glass pane named "&c&lPerm Ban: &7%arg-1%" with lore " " to be unstealable
            format slot 16 of player with black glass pane named " " with lore " " to be unstealable
            format slot 17 of player with black glass pane named " " with lore " " to be unstealable
            format slot 18 of player with black glass pane named " " with lore " " to be unstealable
            format slot 19 of player with black glass pane named " " with lore " " to be unstealable
            format slot 20 of player with black glass pane named " " with lore " " to be unstealable
            format slot 21 of player with black glass pane named " " with lore " " to be unstealable
            format slot 22 of player with black glass pane named " " with lore " " to be unstealable
            format slot 23 of player with black glass pane named " " with lore " " to be unstealable
            format slot 24 of player with black glass pane named " " with lore " " to be unstealable
            format slot 25 of player with black glass pane named " " with lore " " to be unstealable
            format slot 26 of player with black glass pane named " " with lore " " to be unstealable
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
Reactions: FallingCatus
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.
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
 
Replace with

code_language.skript:
if arg-1 is set:
            Wait 1 tick
            open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
            wait 1 tick

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.
 
Can you show what you have now?
This is what it is after adding what you said...

code_language.skript:
command /punish [<offline player>] [<text>]:
    permission: ban.use
    permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    trigger:
        if arg-1 is not set:
            send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
        if arg-1 is set:
            wait 1 tick
            open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
            wait 1 tick
            format slot 0 of player with black glass pane named " " with lore " " to be unstealable
            format slot 1 of player with black glass pane named " " with lore " " to be unstealable
            format slot 2 of player with black glass pane named " " with lore " " to be unstealable
            format slot 3 of player with black glass pane named " " with lore " " to be unstealable
            format slot 4 of player with black glass pane named " " with lore " " to be unstealable
            format slot 5 of player with black glass pane named " " with lore " " to be unstealable
            format slot 6 of player with black glass pane named " " with lore " " to be unstealable
            format slot 7 of player with black glass pane named " " with lore " " to be unstealable
            format slot 8 of player with black glass pane named " " with lore " " to be unstealable
            format slot 9 of player with black glass pane named " " with lore " " to be unstealable
            format slot 10 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 12 of player with black glass pane named " " with lore " " to be unstealable
            format slot 13 of player with black glass pane named " " with lore " " to be unstealable
            format slot 14 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 16 of player with black glass pane named " " with lore " " to be unstealable
            format slot 17 of player with black glass pane named " " with lore " " to be unstealable
            format slot 18 of player with black glass pane named " " with lore " " to be unstealable
            format slot 19 of player with black glass pane named " " with lore " " to be unstealable
            format slot 20 of player with black glass pane named " " with lore " " to be unstealable
            format slot 21 of player with black glass pane named " " with lore " " to be unstealable
            format slot 22 of player with black glass pane named " " with lore " " to be unstealable
            format slot 23 of player with black glass pane named " " with lore " " to be unstealable
            format slot 24 of player with black glass pane named " " with lore " " to be unstealable
            format slot 25 of player with black glass pane named " " with lore " " to be unstealable
            format slot 26 of player with black glass pane named " " with lore " " to be unstealable

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.
 
This is what it is after adding what you said...

code_language.skript:
command /punish [<offline player>] [<text>]:
    permission: ban.use
    permission message: &c&lSMP&f&lAdmin &8> &6Only staff have this permission.
    trigger:
        if arg-1 is not set:
            send "&c&lSMP&f&lAdmin &8> &6Command &7<player>"
        if arg-1 is set:
            wait 1 tick
            open chest with 3 rows named "&c&lSMP&f&lAdmin&7&l: &a&l%arg-1%" to player
            wait 1 tick
            format slot 0 of player with black glass pane named " " with lore " " to be unstealable
            format slot 1 of player with black glass pane named " " with lore " " to be unstealable
            format slot 2 of player with black glass pane named " " with lore " " to be unstealable
            format slot 3 of player with black glass pane named " " with lore " " to be unstealable
            format slot 4 of player with black glass pane named " " with lore " " to be unstealable
            format slot 5 of player with black glass pane named " " with lore " " to be unstealable
            format slot 6 of player with black glass pane named " " with lore " " to be unstealable
            format slot 7 of player with black glass pane named " " with lore " " to be unstealable
            format slot 8 of player with black glass pane named " " with lore " " to be unstealable
            format slot 9 of player with black glass pane named " " with lore " " to be unstealable
            format slot 10 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 12 of player with black glass pane named " " with lore " " to be unstealable
            format slot 13 of player with black glass pane named " " with lore " " to be unstealable
            format slot 14 of player with black glass pane named " " with lore " " to be unstealable
            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%"]
            format slot 16 of player with black glass pane named " " with lore " " to be unstealable
            format slot 17 of player with black glass pane named " " with lore " " to be unstealable
            format slot 18 of player with black glass pane named " " with lore " " to be unstealable
            format slot 19 of player with black glass pane named " " with lore " " to be unstealable
            format slot 20 of player with black glass pane named " " with lore " " to be unstealable
            format slot 21 of player with black glass pane named " " with lore " " to be unstealable
            format slot 22 of player with black glass pane named " " with lore " " to be unstealable
            format slot 23 of player with black glass pane named " " with lore " " to be unstealable
            format slot 24 of player with black glass pane named " " with lore " " to be unstealable
            format slot 25 of player with black glass pane named " " with lore " " to be unstealable
            format slot 26 of player with black glass pane named " " with lore " " to be unstealable

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.

Try this because sometimes double quotes are needed in order to make some text work.
code_language.skript:
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_language.skript:
        set {_n} to 0
        loop 26 times:
            if {_n} is 11:
                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%""]
            else if {_n} is 15:
                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%""]
            else:
                format slot {_n} of player with black glass pane named " " with lore " " to be unstealable
            add 1 to {_n}
 
Try this because sometimes double quotes are needed in order to make some text work.
code_language.skript:
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_language.skript:
        set {_n} to 0
        loop 26 times:
            if {_n} is 11:
                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%""]
            else if {_n} is 15:
                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%""]
            else:
                format slot {_n} of player with black glass pane named " " with lore " " to be unstealable
            add 1 to {_n}
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_language.skript:
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%"]
 
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_language.skript:
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%"]

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
Reactions: FallingCatus
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.
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!
 
Interesting... never thought that would fix it.
code_language.skript:
command /smpadmintempban [<offline player>] [<text>]:
    permission: smpban.use
    permission message: &c&lSMP&f&lAdmin &8> &aNice try! &7Only our staff have this permission.
    trigger:
        wait 1.5 tick
        if arg-1 is not set:
            send "&c&lSMP&f&lAdmin &r&8> &6/tempban &7<player>"
        if arg-1 is set:
            open chest with 5 rows named "&c&lSMP&f&lAdmin &6&lTemp: &r&a%arg-1%" to player
            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!
 
Status
Not open for further replies.