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.

Help me with Guis, putting a new item to the next available slot

Discussion in 'Skript' started by NeptunePlayz, Oct 12, 2019.

  1. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    There is not much more to say right here, because the thing I want to make is an apply script, so that you can do /apply to get a book and quill, I have already done that, but here is the tricky part, how I can type /sendapply, and it will send the book and quill to a GUI for admins or players with a specific permission. So that they can do /applies, /applications or /openapps to open that gui so they can click on a player's book, and then they will get it, and they can read it. And when the staff clicks it, it is not going to disappear, but it will also say a text message in the chat for accepting or denying, so that you can click on yes or no, and it will be put in /acceptedapplications or something like that and /rejectedapplications.
    --- Double Post Merged, Oct 12, 2019, Original Post Date: Oct 12, 2019 ---
    Can anyone help me?
    --- Double Post Merged, Oct 13, 2019 ---
    Anyone?
     
  2. DieHollander_

    DieHollander_ Well-Known Member

    Joined:
    Mar 25, 2018
    Messages:
    171
    Likes Received:
    12
    Use a list variable. When the user uses /sendapply, add the application to a list, like this: add {_application} to {applications::*}.
    Then, when the admins use /applications, loop the list. Everytime it loops, add 1 to {_id}.
    And then set slot {_id} to book and quild named "blablabla" with lore "%loop-value%" or something.
    I recommend adding an id to the list instead of the application, but I figured that's probably a little too hard for you :emoji_slight_smile:.
    --- Double Post Merged, Oct 13, 2019, Original Post Date: Oct 13, 2019 ---
    I'm on my phone right now, but if you want me to explain the adding id method, let me know.
     
  3. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    Can you show some example code for it?
     
  4. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    i think i can help u but can you send the code i'm so confuse
     
  5. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    Code (Text):
    1. command /apply:
    2.     trigger:
    3.         give 1 book and quill to player
    4.  
    5. command /sendapply:
    6.     trigger:
    7.         if player's tool is written book:
    8.             send "&aWorks"
    9.         else if player's tool is book and quill:
    10.             send "&cYou need to sign your application!"
    11.         else:
    12.             send "&cYou can't send any random item!"
    13.  
    14. command /applications:
    15.     permission: apps.see
    16.     aliases: /apps, /applies
    17.     trigger:
    18.         open chest with 5 rows named "&aApplications" to player
     
  6. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    Something like this ? you can do improvement, and this skript need tuske for the guis
    Code (Text):
    1. command /apply:
    2.     trigger:
    3.         give 1 book and quill to player
    4.  
    5. command /sendapply:
    6.     trigger:
    7.         if player's tool is written book:
    8.             send "&aSent!"
    9.             set {player.application::%player%} to player
    10.            
    11.             remove player's tool from player
    12.         else if player's tool is book and quill:
    13.             send "&cYou need to sign your application!"
    14.         else:
    15.             send "&cYou can't send any random item!"
    16.  
    17. command /applications:
    18.     permission: apps.see
    19.     aliases: /apps, /applies
    20.     trigger:
    21.         open virtual chest with 5 rows named "&aApplications" to player
    22.         set {_slot} to 0
    23.         loop 9 * 5 times:
    24.             format gui slot {_slot} of player with black glass pane named " "
    25.             add 1 to {_slot}
    26.         set {_slot} to 0
    27.         loop {player.application::*}:
    28.             format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
    29.             add 1 to {_slot}
    30.            
    31. on gui click:
    32.     close player's inventory
    33.     give slot event-number of event-inventory to player
    34.            
    35.            
    36.        
     
  7. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    The code doesn't seem to be working for some reason, no errors, but it doesn't add the item in the gui.
     
  8. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    Sorry i missing something
    Code (Text):
    1. command /apply:
    2.     trigger:
    3.         give 1 book and quill to player
    4.  
    5. command /sendapply:
    6.     trigger:
    7.         if player's tool is written book:
    8.             send "&aSent!"
    9.             set {player.application::%player%} to player
    10.             set {book.application::%player%} to player's tool
    11.             remove player's tool from player
    12.         else if player's tool is book and quill:
    13.             send "&cYou need to sign your application!"
    14.         else:
    15.             send "&cYou can't send any random item!"
    16.  
    17. command /applications:
    18.     permission: apps.see
    19.     aliases: /apps, /applies
    20.     trigger:
    21.         open virtual chest with 5 rows named "&aApplications" to player
    22.         set {_slot} to 0
    23.         loop 9 * 5 times:
    24.             format gui slot {_slot} of player with black glass pane named " "
    25.             add 1 to {_slot}
    26.         set {_slot} to 0
    27.         loop {player.application::*}:
    28.             format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
    29.             add 1 to {_slot}
    30.          
    31. on gui click:
    32.     close player's inventory
    33.     give slot event-number of event-inventory to player
     
  9. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    and what about middle clicking to remove the application?
     
  10. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    let me know if get any error
    Code (Text):
    1. on gui click:
    2.     if event-type is "left" click:
    3.         close player's inventory
    4.         give slot event-number of event-inventory to player
    5.     if event-type is "middle" click:
    6.         format gui slot event-number of player with black glass pane named " "
    --- Double Post Merged, Oct 15, 2019 at 2:42 PM, Original Post Date: Oct 15, 2019 at 2:38 PM ---
    variable is still a thing its not gonna work let me thinki
     
  11. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    Yeah, "There's no type in gui click event"
     
  12. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    what about making argument called "delete" on /application?
     
  13. N

    NeptunePlayz Member

    Joined:
    Apr 23, 2017
    Messages:
    8
    Likes Received:
    0
    good idea
     
  14. V

    Vorze Active Member

    Joined:
    Jul 10, 2017
    Messages:
    41
    Likes Received:
    2
    So
    Left click to give
    middle click to delete


    Code (Text):
    1. command /apply:
    2.     trigger:
    3.         give 1 book and quill to player
    4.  
    5. command /sendapply:
    6.     trigger:
    7.         if player's tool is written book:
    8.             send "&aSent!"
    9.             set {player.application::%player%} to player
    10.             set {book.application::%player%} to player's tool
    11.             remove player's tool from player
    12.         else if player's tool is book and quill:
    13.             send "&cYou need to sign your application!"
    14.         else:
    15.             send "&cYou can't send any random item!"
    16.  
    17. command /applications [<text>] [<player>]:
    18.     permission: apps.see
    19.     aliases: /apps, /applies
    20.     trigger:
    21.         if arg 1 is not set:
    22.             open virtual chest with 5 rows named "&aApplications" to player
    23.             set {_slot} to 0
    24.             loop 9 * 5 times:
    25.                 format gui slot {_slot} of player with black glass pane named " "
    26.                 add 1 to {_slot}
    27.             set {_slot} to 0
    28.             loop {player.application::*}:
    29.                 format gui slot {_slot} of player with {book.application::%loop-index%} to close then run player command "/applications give %{player.application::%loop-index%}%" with "left" click
    30.                 format gui slot {_slot} of player with {book.application::%loop-index%} to run player command "/applications delete %{player.application::%loop-index%}%" with "middle" click
    31.                 add 1 to {_slot}
    32.         else if arg 1 is "delete" :
    33.             if arg 2 is set:
    34.                 delete {player.application::%arg 2%}
    35.                 delete {book.application::%arg 2%}
    36.                 make player execute command "/apps"
    37.         else if arg 1 is "give":
    38.             if arg 2 is set:
    39.                 if {book.application::%arg 2%} is set:
    40.                     give {book.application::%arg 2%} to player
     
Loading...