Voici le code que j'avais promis:
PS: je t'ai fait fonctionné la possibilité de changé d'item de HOME
options:
home: &8⊗ &6Home &e&l # home: presentation des homes
tp: &8[&f&lTeleportation&8] # TP: presentation des TP
attente: 5 # attente avant TP
c: &6 # c: Couleur 1
c2: &e # c2: Couleur 2
f: &7➲ # f: Format
command /sethome <text> [<item>]:
description: Crée un nouveau home, avec item personalisé
usage: §6/sethome <nom du home> [item]
executable by: players
trigger:
loop {home.%player%.list::*}:
set {_data::*} to loop-value split by "|"
set {_home.name} to {_data::1}
set {_home.coord} to {_data::2}
set {_home.item} to {_data::3}
if {_home.name} = arg 1:
remove loop-value from {home.%player%.list::*}
if arg 2 isn't set:
set {_item.choisi} to "compass" parsed as item
if arg 2 is set:
set {_item.choisi} to "%arg-2%" parsed as an item
set {_newhome.loc} to player's location
set {_newhome.loc} to "%round down x-coord of {_newhome.loc}%,%round down y-coord of {_newhome.loc}%,%round down z-coord of {_newhome.loc}%"
add "%arg-1%|%player's location%|%{_item.choisi}%" to {home.%player%.list::*}
send "{@home}%arg-1% {@c}ajouté en {@c2}%player's location%"
command /delhome <text>:
description: Supprime l'un de vos home
executable by: players
trigger:
loop {home.%player%.list::*}:
set {_data::*} to loop-value split by "|"
set {_home.name} to {_data::1}
set {_home.coord} to {_data::2}
set {_home.item} to {_data::3}
if {_home.name} = arg 1:
remove loop-value from {home.%player%.list::*}
send "{@home}%argument% {@c}supprimé!"
stop
send "{@home}%argument% {@c}inexistant..."
command /home [<text>]:
description: Vous téléporte à l'un de vos home
executable by: players
trigger:
if arg 1 isn't set:
wait 1 tick
open chest with 6 rows named "&8&lMenu des {@c2}&lHomes" to player
wait 1 tick
format slot 53 of player with arrow named "&aPage suivante" to be unstealable # Juste bloqué en attendant
format slot 45 of player with arrow named "&cPage précédente" to be unstealable # //
set {_slot} to 0 # Evite de faire les slot avec des var non temporaire
loop {home.%player%.list::*}:
set {_data::*} to loop-value split by "|"
set {_home.name} to {_data::1}
set {_home.coord} to {_data::2}
set {_home.item} to {_data::3} parsed as item # Possibilité de choisir son item de HOME
format slot {_slot} of player with {_home.item} named "{@home}: &f%{_home.name}% &8⊗" to close then run [make player execute command "/home %{_home.name}%"]
add 1 to {_slot}
stop
else:
loop {home.%player%.list::*}:
set {_data::*} to loop-value split by "|"
set {_home.name} to {_data::1}
set {_home.item} to {_data::3}
set {_home.coord::*} to {_data::2} split at ","
replace "x: " with "" in {_home.coord::1}
replace "y: " with "" in {_home.coord::2}
replace "z: " with "" in {_home.coord::3}
set {_x} to {_home.coord::1} parsed as a number
set {_y} to {_home.coord::2} parsed as a number
set {_z} to {_home.coord::3} parsed as a number
set {_home.coord} to location at x = {_x}, y = {_y}, z = {_z}
if {_home.name} = arg 1:
if player is riding a horse or a skeleton horse:
make player dismount his vehicle
wait 5 ticks
loop entities in radius 3 around the player:
if loop-entity is a skeleton horse or a horse:
teleport loop-entity to {_home.coord}
send "{@tp} &f%loop-entity% {@f} &f%{_home.name}%" to player
send "{@tp} {@c2}&l%player% {@c}dans {@c2}{@attente} {@c}sec"
wait {@attente} seconds
teleport player to {_home.coord}
send "{@tp} {@c2}&l%player% {@f} {@c2}%{_home.name}%"
stop
send "{@home}%arg-1% {@c}inexistant !!!"
Petit j'aime si ca t'a aidé ^^