#Players in GUI

1 messages · Page 1 of 1 (latest)

dreamy lynx
#

I'm trying to make a skript in which if i type "/staff add <player> <role>", every time i type just /staff a GUI will open with the heads of the players added as staff and the item's name must be player's name and the lore must be the player's role.

shrewd agate
#

ok, good luck!

dreamy lynx
#

I wrote because i need help...

silk scarab
#

thats nice

#

but we cant help you

#

unless you explain your issue

#

and show your code

hollow moth
#

we aren't here to write it for you

#

you have to code some shit

#

Then you need to actually have an issue

dreamy lynx
#

the problem is that it's too complicated and I don't even know what to put in the code

command /staff [<text>] [<offlineplayer>] [<string>]: permission: {@permadmin} permission message: {@noperm} aliases: /staffutils, /managestaff trigger:

hollow moth
#

well you'll need a gui

#

created

#

then check if the first slot

#

has an item in it

#

then if not then set slot 1 to thingy

#

then set an item with %arg-2%

#

then add lore like Rank: %arg-3%

#

then save the gui / inventory

#

then load it whenver it opens

dreamy lynx
#

`command /staff [<text>] [<offlineplayer>] [<string>]:
permission: {@permadmin}
permission message: {@noperm}
aliases: /staffutils, /managestaff
trigger:
if arg-1 isn't set:
openStaff(player)

function openStaff(p: player):
set {_gui} to a new chest inventory with 6 rows named "Lista Staff"
open {_gui} to {_p}`

silk scarab
#

there you go

#

progress

dreamy lynx
#

the problem is how to fill the gui

silk scarab
#

set the slots

#

set slot s of {_GUI} to ...

dreamy lynx
#

but how do I add a player with the /staff add command, it would mean modifying the code every time a player is added

shrewd agate
#

nope

dreamy lynx
silk scarab
#

how to add the player?

#

use the argument

dreamy lynx
#

no which slot should I put since every time I add a player it must also be added to the gui

silk scarab
#

ohh, the gui displays staff members?

young nymph
#

use a list variable to store the players you added when using the add argument

silk scarab
#

add their skulls (or whatever to display) to a list, then loop that and fill the gui

dreamy lynx
#

command /staff [<text>] [<offlineplayer>] [<string>]: permission: {@permadmin} permission message: {@noperm} aliases: /staffutils, /managestaff trigger: if arg-1 isn't set: openStaff(player, arg-2, arg-3) if arg-1 is "add": if {staff::*} doesn't contain arg-2: if arg-2 is set: if arg-2 is online: if arg-3 is set: add arg-2 to {staff::*}

after writing this, what is the action I need to add in the function to be able to add the player to the gui?

silk scarab
#

umm

#
  1. shouldnt you check if arg-2 is set before you add?
  2. no need to check if they are online, is there?
  3. you should add their UUID, because they might change their usernames
  4. what's the point of arg-3?
#

as for adding them to the gui, loop the list

#

then you can set slot loop-iteration

dreamy lynx
#

I check if he is online just to edit the message for when he is offline more easily

silk scarab
#

that wont work

#

you are redefining the gui each loop

dreamy lynx
#

`command /staff [<text>] [<offlineplayer>] [<string>]:
permission: {@permadmin}
permission message: {@noperm}
aliases: /staffutils, /managestaff
trigger:
if arg-1 isn't set:
openStaff(player, arg-2, arg-3)
if arg-1 is "add":
if {staff::} doesn't contain arg-2:
if arg-2 is set:
if arg-2 is online:
if arg-3 is set:
add arg-2's uuid to {staff::
}

function openStaff(p: player, v: player, c: text):
loop {staff::*}:
set {_gui} to a new chest inventory with 6 rows named "Lista Staff"
set slot loop-value of {_GUI} to skull of {_v} parsed as offline player named "&f%{_v}%" with lore "&3Ruolo &8» &b%{_c}%"
open {_gui} to {_p}`

silk scarab
#

and opening it each loop

silk scarab
#

you want the loop to only format, not define and open

dreamy lynx
#

I don't have the slightest idea how to do this please

silk scarab
#
loop ...
  ...
open {_gui}```
silk scarab
dreamy lynx
#

but loop-iteration doesn't work

#

function openStaff(p: player, v: player, c: text): set {_gui} to a new chest inventory with 6 rows named "Lista Staff" loop {staff::*}: set slot loop-iteration of {_GUI} to skull of {_v} parsed as offline player named "&f%{_v}%" with lore "&3Ruolo &8» &b%{_c}%" open {_gui} to {_p}

silk scarab
delicate tapir
#

loop-iteration works for skript version 2.8.0+

silk scarab
#

also, you want skull of (loop-value parsed as offline player)

dreamy lynx
delicate tapir
#

well update

#

no reason not to

#

I recently updated from 2.7.3 to 2.8.0 and plan on upgdating to the latest version soon

#

I didnt have to change much

#

Only the with all flags hidden -> with all itemflags thing

shrewd agate
dreamy lynx
#

`command /staff [<text>] [<offlineplayer>] [<string>]:
permission: {@permadmin}
permission message: {@noperm}
aliases: /staffutils, /managestaff
trigger:
if arg-1 isn't set:
openStaff(player, arg-2, arg-3)
if arg-1 is "add":
if {staff::} doesn't contain arg-2:
if arg-2 is set:
if arg-2 is online:
if arg-3 is set:
add arg-2's uuid to {staff::
}

function openStaffGUI(p: player, v: player, c: text):
set {_gui} to a new chest inventory with 6 rows named "Lista Staff"
loop {staff::*}:
set slot loop-iteration of {_GUI} to (loop-value parsed as offline player) named "&f%loop-value%" with lore "&3Ruolo &8» &b%{_c}%"
open {_gui} to {_p}`

I did this but the gui doesn't even open

delicate tapir
#

Well you’re getting an error right?

#

With loop-iteration

#

Since you’re on 2.6.4

silk scarab
dreamy lynx
#

nonoi updated skript

silk scarab
#

i only highlighted the parsing part, you replace {_v} with that, not skull of {_v}

dreamy lynx
#

function openStaff(p: player, v: player, c: text): set {_gui} to a new chest inventory with 6 rows named "Lista Staff" loop {staff::*}: set slot loop-iteration of {_GUI} to (skull of loop-value parsed as offline player) named "&f%loop-value%" with lore "&3Ruolo &8» &b%{_c}%" open {_gui} to {_p}

it still doesn't open

silk scarab
#

look at your variables

#

they are different

#

one is uppercase..

dreamy lynx
#

Fixed but still won't open...

silk scarab
#

my eyes

#

not sure why the function needs 3 parameters

#

is the function being called?

#

add a broadcast in the function

dreamy lynx
#

function openStaff(p: player): set {_gui} to a new chest inventory with 6 rows named "Lista Staff" loop {staff::*}: set slot loop-iteration of {_gui} to (skull of loop-value parsed as offline player) named "&f%loop-value%" with lore "&3Ruolo &8» &b%{_c}%" open {_gui} to {_p} broadcast "prova"

does not send the broadcast.

silk scarab
#

show me the command you are running

#

as per your code, it cant have any arguments

dreamy lynx
#

a video?

silk scarab
#

or you know, just type it in

dreamy lynx
#

but the command does nothing, it doesn't type anything

silk scarab
#

if you execute the command with arguments, this section will not run

dreamy lynx
#

i know

#

if i execute the command with arguments, i add players, if i execute cmd without args, i open the gui

#

but the gui with /staff doesn't open

silk scarab
#

add a broadcast

#

see if the if statement is passed

dreamy lynx
#

yes is passed

silk scarab
#

send sk info

dreamy lynx
#

/sk info?

silk scarab
#

yes

delicate tapir
#

do /sk info & then send a screenshot

dreamy lynx
silk scarab
#

delete skquery

dreamy lynx
#

done

silk scarab
#

does it work now?

dreamy lynx
#

no, works only the broadcast...

#

`command /staff [<text>] [<offlineplayer>] [<string>]:
permission: {@permadmin}
permission message: {@noperm}
aliases: /staffutils, /managestaff
trigger:
if arg-1 isn't set:
openStaff(player)
broadcast "test"
if arg-1 is "add":
if {staff::} doesn't contain arg-2's uuid:
if arg-2 is set:
if arg-2 is online:
if arg-3 is set:
add arg-2's uuid to {staff::
}
set {ruolostaff::%arg-2's uuid%} to arg-3
send "&a%arg-2% aggiunto con successo come %arg-3%!"
if arg-1 is "remove":
if {staff::} contains arg-2's uuid:
if arg-2 is set:
if arg-2 is online:
remove arg-2's uuid from {staff::
}
send "&a%arg-2% rimosso con successo dallo staff!"

function openStaff(p: player):
set {_gui} to a new chest inventory with 6 rows named "Lista Staff"
loop {staff::*}:
set slot loop-iteration of {_gui} to (skull of loop-value parsed as offline player) named "&f%loop-value%" with lore "&3Ruolo &8» &b%{_c}%"
open {_gui} to {_p}`

silk scarab
#

skbee 1.15?

#

why dont you just update everything

dreamy lynx
#

because i'm working on 1.16.5 server

delicate tapir
#

uh

#

should probably also update your server

dreamy lynx
#

i can't, the mode must be 1.16.5

silk scarab
#

then good luck

dreamy lynx
#

uh