Help.. again :P

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

FinalPlayer024

Active Member
Oct 19, 2017
94
4
0
29
How can I give to all online players some items by opening a GUI and putting items in?
I think it's possible using "Trade" as an example, without the "Accept/Cancel trade" buttons, directly adding items in (loop)players' inventories
 
1. What do you actually want?
2. Can you show some code?
3. Have you even looked on the documentation website?

And what has 'giving selected items to all players' to do with 'trading' ??

I don't know which question you want to get answered. Be specific or describe you're situation, so I can answer your question.

Or are you wanting to continue on a previous thread? If so, can you show it?
 
This... ?
code_language.skript:
loop all players:
    open chest with 1 rows named "Giveall" to loop-player
    set slot 0 of loop-player to paper named "A normal name"
 
1. What do you actually want?
2. Can you show some code?
3. Have you even looked on the documentation website?

And what has 'giving selected items to all players' to do with 'trading' ??

I don't know which question you want to get answered. Be specific or describe you're situation, so I can answer your question.

Or are you wanting to continue on a previous thread? If so, can you show it?
A sort of

code_language.skript:
command /giveall:
  trigger:
    open chest with 6 rows named "Give all" to executor
    format slot 0 of executor with stone named "Click to give" to run [make executor execute command "/rungive"]
   
#All the items I put here should be given to all online players, like
command /rungive:
  trigger:
    loop all players:
#Give all items in the previous gui to all the players
      give (I think by looping a variable list) to loop-player
      stop
 
I should loop all slots, add the item of it to a variable and loop them to give the items.
I'm also not a big fan of format slot, but I think this should help:
code_language.skript:
command /giveall:
    trigger:
        open chest with 6 rows named "Give all" to executor
        format slot 0 of executor with stone named "Click to give" to run [make executor execute command "/rungive"]
    
command /rungive:
    trigger:
        if inventory name of player's current inventory is "Give all":
            set {_x::*} to all integers between 0 and 53
            loop {_x::*}:
                slot loop-value of player's current inventory is not air
                set slot loop-value of player's current inventory to air  # you can remove this if you want to.
                add slot loop-value of player's current inventory to {_items::*}
            wait 1 tick
            loop all players:
                loop {_items::*}:
                    give loop-value-2 to "%loop-player-1%" parsed as player
            message "You've successfully given %size of {_items::*}% items to all players!" to player
        else:
            message "Error! You need to be in the /giveall menu." to player

*Untested code*

I also recommend to use something else than a command or to
let it only be executed by the console. Just so your players don't get annoyed.
 
Status
Not open for further replies.