Hello. I'm working on a smart inventory to show bans. I want it to create as many pages it needs. The gui has 6 rows, but the 6th row is used to manage aspects of the gui like changing the page and those things. So the bans are only sown in the first 5th rows. If the gui has more than 5 rows of bans, it must add a new page to show more bans. I don't know how to code it.
Skript Version: Skript 2.2-dev27
Skript Author: Bensku
Minecraft Version: 1.8.8
Addons I'm using: SkQuerry 3 and Skellet
I have tried searching the docs, and I found nothing.
I've also tried to search in the forums. Yes
What other methods have you tried to fix it? I don't need to do it
Skript code:
Errors loading this skript: No errors
Skript Version: Skript 2.2-dev27
Skript Author: Bensku
Minecraft Version: 1.8.8
Addons I'm using: SkQuerry 3 and Skellet
I have tried searching the docs, and I found nothing.
I've also tried to search in the forums. Yes
What other methods have you tried to fix it? I don't need to do it
Skript code:
code_language.skript:
command /bans:
trigger:
player has permission "sb.bans":
clear {bans1::%player%::*}
open chest with 6 rows named "&0List of banned players" to player
wait 0.5 ticks
set slot 45 of player's current inventory to book named "&eMain Page"
wait 0.5 ticks
set slot 46 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 47 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 48 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 49 of player's current inventory to anvil named "&eSearch players" with lore "||&7Click here to &csearch &7banned players.||&7You will need to type it in chat."
wait 0.5 ticks
set slot 50 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 51 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 52 of player's current inventory to black stained glass pane named "&7"
wait 0.5 ticks
set slot 53 of player's current inventory to arrow named "&eNext Page"
set {_slot} to 0
wait 1 tick
loop {bans::*}:
if {_slot} is less than 45:
set slot {_slot} of player's current inventory to loop-value's skull named "&7Player &8» &c%loop-value%" with lore "||&7Ban ID &8» &7(&c##%loop-index%&7)||||&7Is Banned &8» &c%{sban.banned.%loop-value%}%||&7Banned by &8» &c%{sban.bannedby.%loop-value%}%||&7Banned on &8» &c%{sban.time.%loop-value%}%||"
set {bans1::%player%::*} to true
add 1 to {_slot}
else:
send "&8[&c&lBANS&8] &cYou don't have permission to do this!"
on inventory click:
if name of player's current inventory is "&0List of banned players":
cancel event
if clicked slot is less than 45:
if clicked item is player head:
if name of item contains "&7Player":
set {_playername} to "%clicked item's name%"
replace all "&7Player &8» &c" in {_playername} with ""
execute player command "/unban %{_playername}%"
execute player command "/bans"
if clicked slot is 45:
close player's inventory
execute player command "/bans"
if clicked slot is 49:
close player's inventory
set {bans.chat::%player%} to true
send "&8[&c&lBANS&8] &7You must write the player's name in chat. Type &ccancel &7to annullate the search."
if clicked slot is 53:
set {_slot} to -1
loop 44 times:
add 1 to {_slot}
set slot {_slot} of player's current inventory to air
set {_slot} to 0
loop {bans::*}:
if {_slot} is less than 45:
if {bans1::%player%::%loop-index%} is not set:
set slot {_slot} of player's current inventory to loop-value's skull named "&7Player &8» &c%loop-value% &7(&c##%loop-index%&7)." with lore "||&7Is Banned &8» &c%{sban.banned.%loop-value%}%&7.||&7Banned by &8» &c%{sban.bannedby.%loop-value%}%&7.||&7Ban reason &8» &c%{sban.reason.%loop-value%}%&7.||&7Banned on &8» &c%{sban.time.%loop-value%}%&7.||&7"
set {bans1::%player%::%loop-index%} to true
add 1 to {_slot}