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

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

NeptunePlayz

Member
Apr 23, 2017
13
0
0
36
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.
[doublepost=1570868784,1570859322][/doublepost]Can anyone help me?
[doublepost=1570945659][/doublepost]Anyone?
 
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:.
[doublepost=1570959883,1570959839][/doublepost]I'm on my phone right now, but if you want me to explain the adding id method, let me know.
 
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:.
[doublepost=1570959883,1570959839][/doublepost]I'm on my phone right now, but if you want me to explain the adding id method, let me know.
Can you show some example code for it?
 
i think i can help u but can you send the code i'm so confuse
Code:
command /apply:
    trigger:
        give 1 book and quill to player

command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aWorks"
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"

command /applications:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        open chest with 5 rows named "&aApplications" to player
 
Something like this ? you can do improvement, and this skript need tuske for the guis
Code:
command /apply:
    trigger:
        give 1 book and quill to player
 
command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aSent!"
            set {player.application::%player%} to player
            
            remove player's tool from player
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"
 
command /applications:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        open virtual chest with 5 rows named "&aApplications" to player
        set {_slot} to 0
        loop 9 * 5 times:
            format gui slot {_slot} of player with black glass pane named " "
            add 1 to {_slot}
        set {_slot} to 0
        loop {player.application::*}:
            format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
            add 1 to {_slot}
            
on gui click:
    close player's inventory
    give slot event-number of event-inventory to player
 
Something like this ? you can do improvement, and this skript need tuske for the guis
Code:
command /apply:
    trigger:
        give 1 book and quill to player
 
command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aSent!"
            set {player.application::%player%} to player
           
            remove player's tool from player
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"
 
command /applications:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        open virtual chest with 5 rows named "&aApplications" to player
        set {_slot} to 0
        loop 9 * 5 times:
            format gui slot {_slot} of player with black glass pane named " "
            add 1 to {_slot}
        set {_slot} to 0
        loop {player.application::*}:
            format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
            add 1 to {_slot}
           
on gui click:
    close player's inventory
    give slot event-number of event-inventory to player
The code doesn't seem to be working for some reason, no errors, but it doesn't add the item in the gui.
 
The code doesn't seem to be working for some reason, no errors, but it doesn't add the item in the gui.
Sorry i missing something
Code:
command /apply:
    trigger:
        give 1 book and quill to player
 
command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aSent!"
            set {player.application::%player%} to player
            set {book.application::%player%} to player's tool
            remove player's tool from player
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"
 
command /applications:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        open virtual chest with 5 rows named "&aApplications" to player
        set {_slot} to 0
        loop 9 * 5 times:
            format gui slot {_slot} of player with black glass pane named " "
            add 1 to {_slot}
        set {_slot} to 0
        loop {player.application::*}:
            format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
            add 1 to {_slot}
          
on gui click:
    close player's inventory
    give slot event-number of event-inventory to player
 
Sorry i missing something
Code:
command /apply:
    trigger:
        give 1 book and quill to player
 
command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aSent!"
            set {player.application::%player%} to player
            set {book.application::%player%} to player's tool
            remove player's tool from player
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"
 
command /applications:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        open virtual chest with 5 rows named "&aApplications" to player
        set {_slot} to 0
        loop 9 * 5 times:
            format gui slot {_slot} of player with black glass pane named " "
            add 1 to {_slot}
        set {_slot} to 0
        loop {player.application::*}:
            format gui slot {_slot} of player with {book.application::%loop-value%} to run gui event
            add 1 to {_slot}
         
on gui click:
    close player's inventory
    give slot event-number of event-inventory to player
and what about middle clicking to remove the application?
 
and what about middle clicking to remove the application?
let me know if get any error
Code:
on gui click:
    if event-type is "left" click:
        close player's inventory
        give slot event-number of event-inventory to player
    if event-type is "middle" click:
        format gui slot event-number of player with black glass pane named " "
[doublepost=1571146940,1571146685][/doublepost]variable is still a thing its not gonna work let me thinki
 
let me know if get any error
Code:
on gui click:
    if event-type is "left" click:
        close player's inventory
        give slot event-number of event-inventory to player
    if event-type is "middle" click:
        format gui slot event-number of player with black glass pane named " "
[doublepost=1571146940,1571146685][/doublepost]variable is still a thing its not gonna work let me thinki
Yeah, "There's no type in gui click event"
 
So
Left click to give
middle click to delete


Code:
command /apply:
    trigger:
        give 1 book and quill to player
 
command /sendapply:
    trigger:
        if player's tool is written book:
            send "&aSent!"
            set {player.application::%player%} to player
            set {book.application::%player%} to player's tool
            remove player's tool from player
        else if player's tool is book and quill:
            send "&cYou need to sign your application!"
        else:
            send "&cYou can't send any random item!"
 
command /applications [<text>] [<player>]:
    permission: apps.see
    aliases: /apps, /applies
    trigger:
        if arg 1 is not set:
            open virtual chest with 5 rows named "&aApplications" to player
            set {_slot} to 0
            loop 9 * 5 times:
                format gui slot {_slot} of player with black glass pane named " "
                add 1 to {_slot}
            set {_slot} to 0
            loop {player.application::*}:
                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
                format gui slot {_slot} of player with {book.application::%loop-index%} to run player command "/applications delete %{player.application::%loop-index%}%" with "middle" click
                add 1 to {_slot}
        else if arg 1 is "delete" :
            if arg 2 is set:
                delete {player.application::%arg 2%}
                delete {book.application::%arg 2%}
                make player execute command "/apps"
        else if arg 1 is "give":
            if arg 2 is set:
                if {book.application::%arg 2%} is set:
                    give {book.application::%arg 2%} to player
 
Status
Not open for further replies.