command /lootbox [<string>] [<string>] [<string>] [<string>] [<string>] [<string>] [<string>] [<string>]:
permission: skript.lootbox.admin
trigger:
if arg-1 = "create":
if {lootbox::list::*} does not contain arg-2:
add arg-2 to {lootbox::list::*}
set {lootbox::%arg-2%::color} to "%coloured arg-3%"
set {lootbox::%arg-2%::name} to "%arg-2%"
set {lootbox::%arg-2%::item} to player's tool named "%coloured arg-3%%arg-2% LOOTBOX"
add {lootbox::%arg-2%::item} to {lootbox::items::*}
enchant {lootbox::%arg-2%::item} with mending 1
send "<##FCFF00>&lLOOTBOX &7| Created lootbox %{lootbox::%arg-2%::name}%!" to player
else:
send "&cThis lootbox already exist!" to player
if arg-1 = "additem":
if {lootbox::list::*} contains arg-2:
if {lootbox::%arg-2%::rewards::*} does not contain player's tool:
add player's tool to {lootbox::%arg-2%::rewards::*}
send "&aSucess!" to player
if arg-3 is set:
if arg-5 is set:
set {lootbox::%arg-2%::rewards::%player's tool%::command} to "%arg-3% %arg-4% %arg-5%"
if arg-6 is set:
set {lootbox::%arg-2%::rewards::%player's tool%::command} to "%arg-3% %arg-4% %arg-5% %arg-6%"
if arg-7 is set:
set {lootbox::%arg-2%::rewards::%player's tool%::command} to "%arg-3% %arg-4% %arg-5% %arg-6% %arg-7%"
if arg-8 is set:
set {lootbox::%arg-2%::rewards::%player's tool%::command} to "%arg-3% %arg-4% %arg-5% %arg-6% %arg-7% %arg-8%"
broadcast {lootbox::%arg-2%::rewards::%player's tool%::command}
set {e} to {lootbox::%arg-2%::rewards::%player's tool%::command}
if arg-1 = "give":
set {_player} to arg-3 parsed as a player
give {_player} {lootbox::%arg-2%::item}
on right click with shulker box:
if {lootbox::items::*} contains player's tool:
cancel event
set {_lootbox} to uncolored name of player's tool
replace all " LOOTBOX" with "" in {_lootbox}
set {_rewards} to (random element of {lootbox::%{_lootbox}%::rewards::*})
send {_lootbox} to player
send {lootbox::%{_lootbox}%::rewards::%{_rewards}%::command} to player
send {_rewards} to player
if {lootbox::%{_lootbox}%::rewards::%{_rewards}%::command} isn't set:
give player {_rewards}
send "<##FF0000>&lLOOTBOX &8| &7You have recieved %({_rewards}'s name)%!" to player
remove player's tool from player's inventory
else:
execute console command "%{lootbox::%{_rewards}%::item::command}%"
send "<##FF0000>&lLOOTBOX &8| &7You have recieved %({_rewards}'s name)%!" to player
This is the part that doesn't work:
on right click with shulker box:
if {lootbox::items::*} contains player's tool:
cancel event
set {_lootbox} to uncolored name of player's tool
replace all " LOOTBOX" with "" in {_lootbox}
set {_rewards} to (random element of {lootbox::%{_lootbox}%::rewards::*})
send {_lootbox} to player
send {lootbox::%{_lootbox}%::rewards::%{_rewards}%::command} to player
send {_rewards} to player
if {lootbox::%{_lootbox}%::rewards::%{_rewards}%::command} isn't set:
give player {_rewards}
send "<##FF0000>&lLOOTBOX &8| &7You have recieved %({_rewards}'s name)%!" to player
remove player's tool from player's inventory
else:
execute console command "%{lootbox::%{_rewards}%::item::command}%"
send "<##FF0000>&lLOOTBOX &8| &7You have recieved %({_rewards}'s name)%!" to player
When adding the item with a command attached to it, it says the varaible is set BUT when I do if {lootbox::%{_lootbox}%::rewards::%{_rewards}%::command} isn't set: it return as not set
Last edited: