inventory GUI

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

Qurao

New Member
Jul 10, 2020
7
0
1
23
I have a code, but it doesn't work and gives an error:


[15:36:04 ERROR]: [Skript] In 1.13+ you cannot get the title name of an inventory outside of an InventoryClickEvent, Only if this inventory has an InventoryHolder may it be used in this state.



Code:


on rightclick on player:
if {rpname.%clicked entity%} is set:
if player is sneaking:
open chest with 1 row named "&c%{rpname.%clicked entity%}%" to player
set {gui.%player%} to "%clicked entity%"
wait 1 tick
set slot 0 of player's current inventory to player head named "&9Описание игрока"
set slot 1 of player's current inventory to gold nugget named "&9Торговля"
set slot 2 of player's current inventory to chest named "&9Посмотреть инвентарь игрока"
set slot 3 of player's current inventory to gold ingot named "&9Посмотреть денежное состояние игрока"
set slot 4 of player's current inventory to gold block named "&9Передать деньги игроку"
else:
send "§6%{rpname.%clicked entity%}%:§3%{rpdesc.%clicked entity%}%" to player
on inventory click:
if inventory name of player's current inventory is {gui.%player%}:
if clicked slot is 0:
close inventory of player
execute player command "/card %{gui.%player%}%"
if clicked slot is 1:
close inventory of player
execute player command "/trade %{gui.%player%}%"
if clicked slot is 2:
close inventory of player
execute player command "/steal %{gui.%player%}%"
if clicked slot is 3:
close inventory of player
execute player command "/checkbal %{gui.%player%}%"
if clicked slot is 4:
close inventory of player
send "Для передачи денег игроку используйте команду /pay <Денежная сумма> %{gui.%player%}%"
 
Please click the plus button when making a topic/reply and click code.
Then I can see the indenting and it will make it easier for me to help you.
 
I have a code, but it doesn't work and gives an error:


[15:36:04 ERROR]: [Skript] In 1.13+ you cannot get the title name of an inventory outside of an InventoryClickEvent, Only if this inventory has an InventoryHolder may it be used in this state.



Code:


on rightclick on player:
if {rpname.%clicked entity%} is set:
if player is sneaking:
open chest with 1 row named "&c%{rpname.%clicked entity%}%" to player
set {gui.%player%} to "%clicked entity%"
wait 1 tick
set slot 0 of player's current inventory to player head named "&9Описание игрока"
set slot 1 of player's current inventory to gold nugget named "&9Торговля"
set slot 2 of player's current inventory to chest named "&9Посмотреть инвентарь игрока"
set slot 3 of player's current inventory to gold ingot named "&9Посмотреть денежное состояние игрока"
set slot 4 of player's current inventory to gold block named "&9Передать деньги игроку"
else:
send "§6%{rpname.%clicked entity%}%:§3%{rpdesc.%clicked entity%}%" to player
on inventory click:
if inventory name of player's current inventory is {gui.%player%}:
if clicked slot is 0:
close inventory of player
execute player command "/card %{gui.%player%}%"
if clicked slot is 1:
close inventory of player
execute player command "/trade %{gui.%player%}%"
if clicked slot is 2:
close inventory of player
execute player command "/steal %{gui.%player%}%"
if clicked slot is 3:
close inventory of player
execute player command "/checkbal %{gui.%player%}%"
if clicked slot is 4:
close inventory of player
send "Для передачи денег игроку используйте команду /pay <Денежная сумма> %{gui.%player%}%"

Although, in the parser your code do not get an error, try this:
code_language.skript:
on inventory click:
    if "%event.getView().getTitle()%" = {gui.%player%}:
        if clicked slot is 0:
            close inventory of player
            execute player command "/card %{gui.%player%}%"
        if clicked slot is 1:
            close inventory of player
            execute player command "/trade %{gui.%player%}%"
        if clicked slot is 2:
            close inventory of player
            execute player command "/steal %{gui.%player%}%"
        if clicked slot is 3:
            close inventory of player
            execute player command "/checkbal %{gui.%player%}%"
        if clicked slot is 4:
            close inventory of player
            send "Для передачи денег игроку используйте команду /pay <Денежная сумма> %{gui.%player%}%"
You need skript-mirror to do this.
[doublepost=1595116889,1595116786][/doublepost]And can you send a screenshot of the error directly?
 
Although, in the parser your code do not get an error, try this:
code_language.skript:
on inventory click:
    if "%event.getView().getTitle()%" = {gui.%player%}:
        if clicked slot is 0:
            close inventory of player
            execute player command "/card %{gui.%player%}%"
        if clicked slot is 1:
            close inventory of player
            execute player command "/trade %{gui.%player%}%"
        if clicked slot is 2:
            close inventory of player
            execute player command "/steal %{gui.%player%}%"
        if clicked slot is 3:
            close inventory of player
            execute player command "/checkbal %{gui.%player%}%"
        if clicked slot is 4:
            close inventory of player
            send "Для передачи денег игроку используйте команду /pay <Денежная сумма> %{gui.%player%}%"
You need skript-mirror to do this.
[doublepost=1595116889,1595116786][/doublepost]And can you send a screenshot of the error directly?
I tried to upload skript-mirror to the server, but as I understand it does not support 1.15.2. I am using Paper 1.15.2.

Error while loading the server (appears very many times):


[12:57:52] [Server thread/ERROR]: [Skript] 1 log handler was not stopped properly! (at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1501)) [if you're a server admin and you see this message please file a bug report at https://github.com/bensku/skript/issues if there is not already one]
[doublepost=1595153631][/doublepost]
Although, in the parser your code do not get an error, try this:
code_language.skript:
on inventory click:
    if "%event.getView().getTitle()%" = {gui.%player%}:
        if clicked slot is 0:
            close inventory of player
            execute player command "/card %{gui.%player%}%"
        if clicked slot is 1:
            close inventory of player
            execute player command "/trade %{gui.%player%}%"
        if clicked slot is 2:
            close inventory of player
            execute player command "/steal %{gui.%player%}%"
        if clicked slot is 3:
            close inventory of player
            execute player command "/checkbal %{gui.%player%}%"
        if clicked slot is 4:
            close inventory of player
            send "Для передачи денег игроку используйте команду /pay <Денежная сумма> %{gui.%player%}%"
You need skript-mirror to do this.
[doublepost=1595116889,1595116786][/doublepost]And can you send a screenshot of the error directly?
Of course the error code is:
SG81-vs-lHI.jpg
 
I tried to upload skript-mirror to the server, but as I understand it does not support 1.15.2. I am using Paper 1.15.2.

Error while loading the server (appears very many times):


[12:57:52] [Server thread/ERROR]: [Skript] 1 log handler was not stopped properly! (at ch.njol.skript.lang.SkriptParser.parse_i(SkriptParser.java:1501)) [if you're a server admin and you see this message please file a bug report at https://github.com/bensku/skript/issues if there is not already one]
[doublepost=1595153631][/doublepost]
Of course the error code is:
SG81-vs-lHI.jpg
From what you tell me, then the problem would be the version you use. Or if this is not the error, it could be the value of the variable (%clicked entity%) at the time you check the inventory name.
 
Status
Not open for further replies.