Discord Thread I litterally dont have a solution for this, it seems so simple tho... (inventory name problems)

  • 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 community!

    Now, what are you waiting for? Join the community now!

This thread came from the skUnity Discord. You can't reply to it here but if you join the skUnity Discord, you'll be able to post a reply there. The thread link is part of the thread's message.
Status
Not open for further replies.

skUnity Discord

Site Manager
Aug 5, 2023
12,749
1
0
The skUnity Discord
discord.gg
code:
code_language.skript:
vb
on inventory close:
    if name of event-inventory contains "Choose your class":
        classgui(player)

function:
vb
function classgui(p: player):
    set {ingui::%uuid of {_p}%} to {_p}'s uuid    
    if team of {_p} is {r} or {b}:
        if team of {_p} is {r}:
            set {_guinamecolor} to "&4&l"
        else:
            if team of {_p} is {b}:
                set {_guinamecolor} to "&1&l"    
            else:
                set {_guinamecolor} to "&f&l"        
        set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
the code is supposed to not let the player close the "class gui" inventory. this code works the first time they close the inventory, but once they close it a second time, nothing happens. its like the inventory name ins't "Choose your class" after classgui(player) runs

Posted by: cybong_gaming from the skUnity Discord. View the thread on skUnity Discord here
 
why not just do
code_language.skript:
on inventory close:
  if name of event-inventory contains "Choose your class":
    cancel event

Posted by: nylhus from the skUnity Discord.
 
code:
code_language.skript:
vb
on inventory close:
    if name of event-inventory contains "Choose your class":
        classgui(player)

function:
vb
function classgui(p: player):
    set {ingui::%uuid of {_p}%} to {_p}'s uuid    
    if team of {_p} is {r} or {b}:
        if team of {_p} is {r}:
            set {_guinamecolor} to "&4&l"
        else:
            if team of {_p} is {b}:
                set {_guinamecolor} to "&1&l"    
            else:
                set {_guinamecolor} to "&f&l"        
        set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
the code is supposed to not let the player close the "class gui" inventory. this code works the first time they close the inventory, but once they close it a second time, nothing happens. its like the inventory name ins't "Choose your class" after classgui(player) runs

Posted by: vic0333 from the skUnity Discord.
 
code_language.skript:
    if team of {_p} is {r} or {b}:
        if team of {_p} is {r}:
            set {_guinamecolor} to "&4&l"
        else:
            if team of {_p} is {b}:
                set {_guinamecolor} to "&1&l"    
            else:
                set {_guinamecolor} to "&f&l"what is this??
if team = r:
  stuff
else if team = b:
  other stuff
else:
  other other stuff
^

Posted by: x8ight from the skUnity Discord.
 
Team functions don't just work with names, it's copied from other code and just modified based off its structure, I'm not really sharing my code with anyone else so I'm not really trying to organize it if it works already
On inventory close is not a cancelable event

Posted by: cybong_gaming from the skUnity Discord.
 
The problem isn't the contents it's the name
I'll apply the solutions, and see if anything works brb
okay, applied suggestions in my own way. function is not gone and it just straight up opens the inventory
code_language.skript:
vb
on inventory close:
    if name of event-inventory contains "Choose your class":
        set {ingui::%uuid of player%} to player's uuid    
        if team of player is {r}:
            set {_guinamecolor} to "&4&l"
        if team of player is {b}:
            set {_guinamecolor} to "&1&l"    
        else:
            set {_guinamecolor} to "&f&l"        
        set {_classgui} to a new chest inventory with 1 row with name "%{_guinamecolor}%Choose your class"
        open {_classgui} to player
but its not working still, heres the order of events:
when the inventory is first opened, it functions correctly.
i then closed the inventory and it reapeared as planned but {_guinamecolor} was "&f&l" now even though my team was {r}
then i closed the inventory a second time and nothing happened
im very confused cuz it doesnt look like anything wrong should be happeneing in the code

Posted by: cybong_gaming from the skUnity Discord.
 
wtf do you mean
what
everyone just says "debugg"
wtf do you mean
im sorry im mad and i have a headache
ive made all kinds of commands to list every peace of metadata, every uuid in every list, and every team
ive used an alt to check every custom command everytime my main makes a movement
or clicks a button
its like when it reopens the gui name is no longer "choose your class"
k i made a new thread your free to go 8ight

Posted by: cybong_gaming from the skUnity Discord.
 
Status
Not open for further replies.