#need help with payment skript!!

1 messages · Page 1 of 1 (latest)

lucid iron
#

still need help w this!

lucid iron
#

!

lucid iron
#

?? anyone

spark iron
#

should work prob

lucid iron
#

oh my gosh thank you!

#

couldnt find that in the docs for some reason but thanks

#

so it seems the problem with that event is that it isnt actually triggering

#
    set {selectedplayer.%player%} to name of event-slot
    wait 0.1 seconds
    close player's inventory
    wait 0.1 seconds
    open chest inventory with 3 rows with name "&cSend Money" to player
    set slot 0,1,2,3,4,5,6,7,8,9,10,11,13,15,16,17,18,19,20,21,23,24, 25 and 26 of player's current inventory to black stained glass pane named " "
    set slot 22 of player's current inventory to red stained glass pane with name "&cCancel Transaction" with lore "&7Returns to the previous menu."
    set slot 12 of player's current inventory to skull of ("%{selectedplayer.%player%}%" parsed as an offline player) with name "&7Sending money to &e%{selectedplayer.%player%}%&7."```
#

it doesnt actually close the inventory or open a new one so im guessing the event isnt triggering

spark iron
#

oh yeah it would trigger if you're doing it through something like that

#

just make an on inventory click in the anvil inventory

lucid iron
# spark iron just make an on inventory click in the anvil inventory
    if name of player's current inventory contains "&eSelect Player":
        set {selectedplayer.%player%} to name of event-slot
        wait 0.1 seconds
        close player's inventory
        wait 0.1 seconds
        open chest inventory with 3 rows with name "&cSend Money" to player
        set slot 0,1,2,3,4,5,6,7,8,9,10,11,13,15,16,17,18,19,20,21,23,24, 25 and 26 of player's current inventory to black stained glass pane named " "
        set slot 22 of player's current inventory to red stained glass pane with name "&cCancel Transaction" with lore "&7Returns to the previous menu."
        set slot 12 of player's current inventory to skull of ("%{selectedplayer.%player%}%" parsed as an offline player) with name "&7Sending money to &e%{selectedplayer.%player%}%&7."```
#

i assume u mean like that

#

unless im misinterpreting

#

cuz that just doesnt wait for the player to select

#

it just goes straight to opening the next gui

steel shoal
#

you could just make a gui that has all the players as their heads (requires SkBee) instead of a text gui. then you can just get the player by the item name

steel shoal
lucid iron
# steel shoal create a chest gui with a few rows, loop all your players, and set the slot `(lo...
if event-item is player head named "&eSelect Player":
            loop all players:
                open chest inventory with 5 rows with name "&eSelect Player" to player
                set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43, and 44 of player's current inventory to black stained glass pane named " "
                set slot (loop-index - 1) of player's current inventory to skull of (loop-player parsed as an offline player) with name "%loop-player%"```
not too farmiliar with loops so im not sure if i did something wrong but it doesnt understand this
steel shoal
#

you did. you definitely don't want to create a gui every time you loop a player

#

create the gui, then loop all players, then open the gui to the player

lucid iron
lucid iron
# steel shoal create the gui, *then* loop all players, *then* open the gui to the player
            open chest inventory with 5 rows with name "&eSelect Player" to player
            set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43, and 44 of player's current inventory to black stained glass pane named " "
            loop all players:
                set slot (loop-index - 1) of player's current inventory to skull of (loop-player parsed as an offline player) with name "%loop-player%"```
#

is there formatting i need to do when referencing loop index or something?

steel shoal
#

you're looping all players, which loop all of the players currently on the server. So, none of them are going to be offline

lucid iron
#

it will just be a steve skull

steel shoal
#

but you can use SkBee to do it.

lucid iron
#

ahhh i see i think

#

actually no i dont

steel shoal
#

Then you just need to apply some nbt to the item: set {_i} to a player head set {_n} to nbt compound of {_i} add nbt compound from "{SkullOwner:""%loop-player%""}" to {_n} set slot (loop-index - 1) of player's current inventory to {_i}

lucid iron
#

oh i see i didnt use the add nbt compound

steel shoal
lucid iron
#

it seems the whole loop-index part isnt working though?

steel shoal
#

huh

lucid iron
#

doesnt understand it when i have the whole -1 part and when i dont it says there is no loop index so

steel shoal
#

send the code again

lucid iron
#
            open chest inventory with 5 rows with name "&eSelect Player" to player
            set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43, and 44 of player's current inventory to black stained glass pane named " "
            loop all players:
                set {_i} to a player head
                set {_n} to nbt compound of {_i}
                add nbt compound from "{SkullOwner:""%loop-player%""}" to {_n}
                set slot (loop-index - 1) of player's current inventory to {_i}```
#

i havent touched skript in well over a year so it may be my fault but on the other hand i cant think of a reason why it wouldnt be understanding the expression

#

loop-index is a thing im pretty sure and its involved in the loop and it wouldnt be an issue with me parsing it as a number so idk

steel shoal
#

loop all players should have a loop-index. The index would of course start at 1 so the first player in the loop would be 1. What is your server version and Skript version?

steel shoal
#

oh. let me do a quick test then.

#

latest version meaning 2.6.4?

#

and what addons do you have?

steel shoal
# lucid iron 1.19.3 latest skript version

this is interesting. I'm getting the same error as you, running different software. I'm still using Paper, but running 1.18.2 with Skript 2.6.4 and am getting the same error as you. So, because of this, you'll need to do something else. set {_list::*} to all players loop {_list::*}:
In this one /\, you can use loop-value for the player, but loop-index still doesn't work the way I originally suggested, BUT you can set a variable {_num} to the loop-index and it works just fine.

#

This is the code I tested with command /test: trigger: set {_gui} to a new chest inventory with 5 rows named "&eSelect Player" set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43 and 44 of {_gui} to {@guiFiller} set {_list::*} to all players loop {_list::*}: set {_num} to loop-index set {_i} to a player head named "%loop-value%" set {_n} to nbt compound of {_i} add nbt compound from "{SkullOwner:""%loop-value%""}" to {_n} set slot ({_num} - 1) of {_gui} to {_i} open {_gui} to player

lucid iron
#

nothing shows up now for some reason

#

oh wait nevermind i know why

#

nevermind it works but it only shows 1 playert

steel shoal
#

it should be all players. Try using just the code I provided

lucid iron
#

i did

#

it is all players

#
            set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43 and 44 of {_gui} to black stained glass pane named " "
            set {_list::*} to all players
            loop {_list::*}:
                set {_num} to loop-index
                set {_i} to a player head
                set {_n} to nbt compound of {_i}
                add nbt compound from "{SkullOwner:""%loop-value%""}" to {_n}
                set slot ({_num} + 12) of {_gui} to {_i}
            open {_gui} to player```
#

only thing i changed was slot for correct spacing and the gui filler

lucid iron
#

still need help ^

steady flume
#

Returning to the anvil

#

And the text would be
Repair name of player’s inventory

#

Or rename text or whatever the Second link said

#

Oh and instead of setting slots 0-44. Why not just loop 45 times? And if you have a list of all players you can get Them with loop-number

mental crane
#

set slots (integers between x and y) to z

steady flume
lucid iron
#

im a little confused is what im saying

lucid iron
steady flume
# lucid iron wdym?

So u say
Loop 45 times: (or however many in a row u need set to the same thing)
Set slot (loop-number - 1) to some item

lucid iron
#

rn i just need to figure out why it only shows one player when i looped them all

steady flume
#

And yes it won’t persist for offline players. But noone in the loop Will be offline anyway

lucid iron
# steady flume Maybe drop the list and just loop all players. Pretty sure loop-inden still appl...

im assuming u mean something like this?

            set {_spval} to 10
            loop all players:
                set {_gui} to a new chest inventory with 5 rows named "&eSelect Player"
                set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43 and 44 of {_gui} to {@gf} named " "
                set {_i} to a player head
                set {_n} to nbt compound of {_i}
                add nbt compound from "{SkullOwner:""%loop-value%""}" to {_n}
                set slot {_spval} of {_gui} to {_i}
                add 1 to {_spval}
            open {_gui} to player```
#

b/c that still doesnt work

steady flume
#
            set {_spval} to 10
            set {_gui} to a new chest inventory with 5 rows named "&eSelect Player"
            loop all players:
                set slot 0,1,2,3,4,5,6,7,8,9,17,18,26,27,35,36,37,38,39,40,41,42,43 and 44 of {_gui} to {@gf} named " "
                set {_head} to (skull of loop-player) named "&eSelect Player
                set slot {_spval} of {_gui} to skull of loop-player
                add 1 to {_spval}
            open {_gui} to player
#

u didnt answer abt the nbt stuff, so i left it out for this example

lucid iron
#

that all finally works now so i just need to figure out how to get the player stored

#

in a var

lucid iron
steady flume
#

u can use the same list to add the skulls to the inv

lucid iron
#

i see

#

thank you

steady flume
#

but ofc make the vars memory