#need help with payment skript!!
1 messages · Page 1 of 1 (latest)
!
?? anyone
could just use skbee https://skripthub.net/docs/?id=5617
should work prob
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
oh yeah it would trigger if you're doing it through something like that
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
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
could you give an example?
create a chest gui with a few rows, loop all your players, and set the slot (loop-index - 1) to the player's head (again, check the SkBee wiki https://www.github.com/ShaneBeee/SkBee/wiki)
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
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
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?
you're looping all players, which loop all of the players currently on the server. So, none of them are going to be offline
yes but when you dont parse it as an offline player it wont put the skull in because skript doesnt do that idk why
it will just be a steve skull
but you can use SkBee to do it.
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}
oh i see i didnt use the add nbt compound
See the wiki for help and more info
https://github.com/ShaneBeee/SkBee/wiki/NBT-Heads
it seems the whole loop-index part isnt working though?
huh
doesnt understand it when i have the whole -1 part and when i dont it says there is no loop index so
send the code again
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
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?
1.19.3 latest skript version
oh. let me do a quick test then.
latest version meaning 2.6.4?
and what addons do you have?
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
nothing shows up now for some reason
oh wait nevermind i know why
nevermind it works but it only shows 1 playert
it should be all players. Try using just the code I provided
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
still need help ^
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
set slots (integers between x and y) to z
well yea, but if you're gonna be overwriting glasspanes with skulls anyway, might as well stick to the numbered loop
im not overwriting glass panes with skulls tho?
im a little confused is what im saying
cuz that idea was scrapped b/c its a lil confusing, and idk how i would layout combining 2 items and making it still look ok
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
yeah im fine with the way i did it cuz thats besides the point
rn i just need to figure out why it only shows one player when i looped them all
Maybe drop the list and just loop all players. Pretty sure loop-inden still applies. And if it doesn’t, you can set a number variable before looping and adding 1 to it on each loop.
Also what kind of nbt is in the skullowner list?
Bc skull of player should get u the player’s head, and then u Can just rename it to select player
And yes it won’t persist for offline players. But noone in the loop Will be offline anyway
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
well u are recreating the gui for every loop so it wouldn't
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
that all finally works now so i just need to figure out how to get the player stored
in a var
yeah sorry uh its just getting the name of the player and setting it to that
on player join?
on join:
set {playerskulls::%player's uuid%} to player
set {playerskulls::%player's uuid%::skull} to skull of player
on quit:
delete {playerskulls::%player's uuid%}
And then for searching it:
loop {playerskulls::*}:
if {playerskulls::%loop-index%::skull} is clicked slot:
u can use the same list to add the skulls to the inv
but ofc make the vars memory