Hey!
So I created a custom GUI on join of my server to display rules, you can either accept them or deny them, second one will lead to a kick. Now my problem: Even after I accepted the rules, the custom GUI still seems to be applying to my normal inventory, ender chests etc... it basically is like having the rule gui slots, but not knowing which one is which and sometimes I even get kicked because I clicked the slot defined with "Deny"... so here's my code:
So I created a custom GUI on join of my server to display rules, you can either accept them or deny them, second one will lead to a kick. Now my problem: Even after I accepted the rules, the custom GUI still seems to be applying to my normal inventory, ender chests etc... it basically is like having the rule gui slots, but not knowing which one is which and sometimes I even get kicked because I clicked the slot defined with "Deny"... so here's my code:
Code:
on join:
make player execute command "/serverrules"
command /serverrules:
trigger:
set metadata tag "serverrules" of player to chest inventory with 5 rows named "&e&l[Server-Rules]"
set slot 18 of metadata tag "serverrules" of player to book named "&4&lNO mods/hacks." with lore "&e&lThat give you an unfair advantage."
set slot 19 of metadata tag "serverrules" of player to book named "&4&lNO racial slur."
set slot 20 of metadata tag "serverrules" of player to book named "&4&lNO toxic behaviour."
set slot 21 of metadata tag "serverrules" of player to book named "&4&lDo not annoy the owners/helper!" with lore "&e&lDo /emsg <NameOfHelper/Owner for support!."
set slot 22 of metadata tag "serverrules" of player to book named "&4&lNO naked killing." with lore "&e&lExcept if the naked guy attacks first/has a piece of armour!"
set slot 23 of metadata tag "serverrules" of player to book named "&4&lNO begging for loot!" with lore "&e&lYou will get enough create keys at player goals!"
set slot 24 of metadata tag "serverrules" of player to book named "&4&lNO shulker box stealing!" with lore "&e&lIf the victim send proof of someone stealing, the thief will get jailed!"
set slot 25 of metadata tag "serverrules" of player to book named "&4&lNO spamming in chat."
set slot 26 of metadata tag "serverrules" of player to book named "&4&lInstructions from the owners must be followed."
set slot 31 of metadata tag "serverrules" of player to emerald named "&a&lBy clicking this, you are &4&lACCEPTING &a&lall of the rules above."
set slot 40 of metadata tag "serverrules" of player to barrier named "&a&lI do not accept the rules (KICK)"
set metadata tag "rulesopen" of player to true
open (metadata tag "serverrules" of player) to player
on inventory click:
if index of event-slot is 31:
send "&e&l[RULES]: &a&lYou succesfully acceptet the rules. Stay safe!" to player
delete metadata tag "rulesopen" of player
cancel event
close player's inventory
if index of event-slot is 18:
cancel event
if index of event-slot is 19:
cancel event
if index of event-slot is 20:
cancel event
if index of event-slot is 21:
cancel event
if index of event-slot is 22:
cancel event
if index of event-slot is 23:
cancel event
if index of event-slot is 24:
cancel event
if index of event-slot is 25:
cancel event
if index of event-slot is 26:
cancel event
if index of event-slot is 40:
delete metadata tag "rulesopen" of player
close (metadata tag "serverrules" of player)
kick player
on inventory close:
if metadata tag "rulesopen" of player is true:
play sound "entity.villager.no" to player
wait 2 ticks
open (metadata tag "serverrules" of player) to player