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.

GUI Skript - Internal Error

Discussion in 'Skript' started by itz_mw2004, Feb 10, 2021.

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

    itz_mw2004 Member

    Joined:
    Feb 10, 2021
    Messages:
    1
    Likes Received:
    0
    command /punish <player>:
    permission: punish.mc
    trigger:
    open virtual chest with size 3 named "&6Mega&fCraft Punishment" to player
    format gui slot 0 of player with diamond axe named "&4Ban" to run:
    ban arg-1

    [​IMG]

    I am trying to make a punishment gui for my server but whenever I try and run the skript it comes up with an internal error, however when reloading the skript it does not show any errors

    Yes I do have tuske installed
     
  2. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Don't use "format slot" to create GUIs, just Skript will do.
    Code (Text):
    1. command /punish <player>:
    2.     permission: punish.mc
    3.     trigger:
    4.         set {_menu} to chest with 3 rows named "&6Mega&fCraft Punishment"
    5.         set slot 0 of {_menu} to diamond axe named "&4Ban"
    6.         set metadata value "toBan" of player to arg-1
    7.         open {_menu} to player
    8.  
    9. on inventory click:
    10.     name of event-inventory is "&6Mega&fCraft Punishment"
    11.     cancel event
    12.     if name of event-slot is "&4Ban":
    13.         set {_player} to metadata value "toBan" of player
    14.         ban {_player}
     
    • Like Like x 1
  3. Jakkeren

    Supporter

    Joined:
    Mar 23, 2017
    Messages:
    63
    Likes Received:
    3
    Code (Text):
    1. name of event-inventory is "&6Mega&fCraft Punishment"
    This will spam your console after minecraft 1.13.

    Code (Text):
    1. In 1.13+ you cannot get the title name of an inventory outside of an InventoryClickEvent. Only if this inventory has an InventoryHolder may it be used in this state.
    Check out this thread on how to properly manage which GUI your players currently are using without having to get the name of it
     
    • Like Like x 1
  4. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    That sucks, I wasn’t aware of this. I’ve been using Skript on 1.12 for years so I might be a little outdated on some matters
     
  5. Jakkeren

    Supporter

    Joined:
    Mar 23, 2017
    Messages:
    63
    Likes Received:
    3
    Definitely. However it's much more clean and efficient to set a variable to your current inventory and checking for it, rather than actually checking for the name.

    Used get-inventory-name a lot in the past as well, but I guess you learn something new every day :emoji_stuck_out_tongue:
    --- Double Post Merged, Feb 11, 2021, Original Post Date: Feb 11, 2021 ---
    Internal errors often have to do with your skript- and or addon version being off. What version is your server, and what version of skript are you running?
     
  6. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Yeah, the only problem is having to code the deletion of the variable, like when the inventory closes and etc
     
  7. Jakkeren

    Supporter

    Joined:
    Mar 23, 2017
    Messages:
    63
    Likes Received:
    3
    I managed to do it in a simple and effective way:
    Code (Text):
    1. on inventory close:
    2.      {var::%player%} is set:
    3.           clear {var::%player%}
     
  8. PatoFrango

    PatoFrango Active Member

    Joined:
    Jul 12, 2017
    Messages:
    240
    Likes Received:
    14
    Skript stop event too (and I think quit as well since inventory close doesnt get called when a player disconnects). But yeah, I remembered I could just assign a string to a {gui::%player%} variable as the menu’s “id” and then check the variable for that ID
     
Thread Status:
Not open for further replies.

Share This Page

Loading...