How to cancel a command-tab event

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

TigerPvPzzz

Active Member
Feb 24, 2017
109
2
0
25
Hello there.

I wonder how i can cancel a "Command-Tab" event, so players can't tab a specifired command in chat.
 
You can use packets for that. With Skellett it should be:

code_language.skript:
options:

    blocked-commands: "/bukkit", "/version" and "/plugins"

on packet:
    if event-string is "PacketPlayInTabComplete":
        if "%packet field ""a""%" is {@blocked-commands}:
            cancel event

And with MundoSK:

code_language.skript:
options:
    blocked-commands: "/bukkit", "/version" and "/plugins"

on packet play_client_tab_complete:
    if string pinfo 0 of event-packet is {@blocked-commands}:
        cancel event

You could also register the PlayerTabCompleteEvent with Skellett's custom event and then use the method expression for get the command and cancel the event.
 
You can use packets for that. With Skellett it should be:

code_language.skript:
options:

    blocked-commands: "/bukkit", "/version" and "/plugins"

on packet:
    if event-string is "PacketPlayInTabComplete":
        if "%packet field ""a""%" is {@blocked-commands}:
            cancel event

And with MundoSK:

code_language.skript:
options:
    blocked-commands: "/bukkit", "/version" and "/plugins"

on packet play_client_tab_complete:
    if string pinfo 0 of event-packet is {@blocked-commands}:
        cancel event

You could also register the PlayerTabCompleteEvent with Skellett's custom event and then use the method expression for get the command and cancel the event.
Hey, thanks for trying to help me. - But i dont understand it, i can give a example.

I have a command "/EnchantUnbreakable" and then i have a GUI people, can execute the command in. But i dont want player's to "Tab" the command in chat.
 
Hey, thanks for trying to help me. - But i dont understand it, i can give a example.

I have a command "/EnchantUnbreakable" and then i have a GUI people, can execute the command in. But i dont want player's to "Tab" the command in chat.
Instead of use a command, you should use something like a function for it so it can't be executed unless it is from the GUI. Could you show me the command?
 
Instead of use a command, you should use something like a function for it so it can't be executed unless it is from the GUI. Could you show me the command?

Player is holding a diamond helmet:
Open chest with 3 rows named "&aEnchant din &3Hjelm" to player
Wait 3 ticks
Format slot 0 of player with light blue glass pane named " " to be unstealable
Format slot 1 of player with white glass pane named " " to be unstealable
Format slot 2 of player with light blue glass pane named " " to be unstealable
Format slot 3 of player with white glass pane named " " to be unstealable
Format slot 4 of player with light blue glass pane named " " to be unstealable
Format slot 5 of player with white glass pane named " " to be unstealable
Format slot 6 of player with light blue glass pane named " " to be unstealable
Format slot 7 of player with white glass pane named " " to be unstealable
Format slot 8 of player with light blue glass pane named " " to be unstealable
Format slot 9 of player with white glass pane named " " to be unstealable
Format slot 10 of player with light blue glass pane named " " to be unstealable
Format slot 11 of player with white glass pane named " " to be unstealable
Format slot 12 of player with shiny diamond helmet named "&3Hunger God" with lore "&aKlik her for at enchant din hjelm med &3Hunger God || &c$500 || &3Hunger God &a= &7Giver dig fuld &aMad permanent || &7når du har hjelmen på" to close then run [ execute player command "/EnchantHungergod"]
Format slot 13 of player with white glass pane named " " to be unstealable
Format slot 14 of player with shiny Diamond helmet named "&3Unbreakable" with lore "&aKlik her for at enchant din hjelm med &3Unbreakable || &c$1000 || &3Unbreakable &a= &7Gør så dit armor ikke kan gå i stykker." to close then run [ execute player command "/enchantUnbreakable"]
Format slot 15 of player with white glass pane named " " to be unstealable
Format slot 16 of player with light blue glass pane named " " to be unstealable
Format slot 17 of player with white glass pane named " " to be unstealable
Format slot 18 of player with light blue glass pane named " " to be unstealable
Format slot 19 of player with white glass pane named " " to be unstealable
Format slot 20 of player with light blue glass pane named " " to be unstealable
Format slot 21 of player with white glass pane named " " to be unstealable
Format slot 22 of player with light blue glass pane named " " to be unstealable
Format slot 23 of player with white glass pane named " " to be unstealable
Format slot 24 of player with light blue glass pane named " " to be unstealable
Format slot 25 of player with white glass pane named " " to be unstealable
Format slot 26 of player with light blue glass pane named " " to be unstealable

Its Danish, but i think you get the point.
 
I meant the "/enchantunbreakable" command, not the actual GUI code. And the next time you should use codeblocks. Here is how to use them.

[CODE]Your code here[/CODE]

Will be showed as:
Code:
Your code here


A tip:
You shouldn't use skQuery's format slot, it's known to be buggy due to many reasons and that's why I recommend you use TuSKe's GUI Manager which is very similar to the format slot but this GUI Manager isn't as buggy as the skQuery's format slot and has more features/customization than the skQuery's format slot, here is a tutorial for it.
If you don't want to use that, you can use the inventory click event + the set slot which should be good enough to do GUIs.
 
Status
Not open for further replies.