How to make GUI that will be only accessable by one player (mod meant to be used for multiplayer)

Started by Gamemaster2022 on Tue, 07/06/2021 - 15:51

Topic category: Help with modding (Java Edition)

Last seen on 19:08, 22. Jul 2021
Joined Apr 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to make GUI that will be only accessable by one player (mod meant to be used for multiplayer)
Tue, 07/06/2021 - 15:51

Hello, I am trying to make GUI that will be only available for one player. I mean when are two players joined to server and one from them will click on a block with GUI. It will open to him but if other player try to click on it like the first player it will do nothing. It is the same effect like vanilla villager GUI - if trade one player, the other one can not - on the same villager.

 

I am not afraid of coding. Every idea is welcome. Thanks

Last seen on 09:11, 4. Aug 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
You can make a variable…
Thu, 07/08/2021 - 07:21

You can make a variable called GUIopened and set it to false by default and in the gui triggers add a when gui opens and when gui closes

 

In when gui opens set the variable to true

In when gui closes set it to false

And whereever u put the procedure to open it add a if guiopened = true