Yo ! J'ai quelques soucis avec mon skript de keycard, je reprends le skript et c'est un peu compliqué
Je vous donne toutes les infos ci-dessous :
Version de Minecraft : 1.16.5
Version de Skript : 2.5.3
En gros, je souhaite faire un système de cartes d'accès mais j'ai du mal à détecter quel est le niveau d'accréditation qu'il faut pour ouvrir la porte.
Enfaite, il s'agit d'un bouton, et pas d'une porte directement, donc quand on clique sur le bouton, si la personne a la bonne carte d'accès en main ça la ouvre la porte et ça dit accès autorisé, sinon ça cancel event et ça dit accès refusé. Pour savoir quelle carte il faut pour tel bouton, j'ai mis en place une commande avec laquelle on doit définir le niveau mais c'est ici que je bloque.
Voici le code :
command /button <string> [<string>]:
permission: *
trigger:
if arg 1 is "add":
if arg 2 is "1":
set {choosebutton1.%player%} to true
add targeted block to {ButtonLvl1}
send "&aBouton ajouté ! Il faudra désormais une accréditation de niveau 1 pour l'utiliser." to player
else if arg 2 is "2":
if targeted block is a dark oak button:
add targeted block to {ButtonLvl2}
send "&aBouton ajouté ! Il faudra désormais une accréditation de niveau 2 pour l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "3":
if targeted block is a dark oak button:
add targeted block to {ButtonLvl3}
send "&aBouton ajouté ! Il faudra désormais une accréditation de niveau 3 pour l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "4":
if targeted block is a dark oak button:
add targeted block to {ButtonLvl4}
send "&aBouton ajouté ! Il faudra désormais une accréditation de niveau 4 pour l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "5":
if targeted block is a dark oak button:
add targeted block to {ButtonLvl5}
send "&aBouton ajouté ! Il faudra désormais une accréditation de niveau 5 pour l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else:
send "&cMettez un numéro entre 1 et 5 !" to player
else if arg 1 is "remove":
if arg 2 is "1":
if targeted block is a dark oak button:
if targeted block is in {ButtonLvl1}:
remove targeted block from {ButtonLvl1}
send "&aBouton enlevé ! Tout le monde pourra l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "2":
if targeted block is a dark oak button:
if targeted block is in {ButtonLvl2}:
remove targeted block from {ButtonLvl2}
send "&aBouton enlevé ! Tout le monde pourra l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "3":
if targeted block is a dark oak button:
if targeted block is in {ButtonLvl3}:
remove targeted block from {ButtonLvl3}
send "&aBouton enlevé ! Tout le monde pourra l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "4":
if targeted block is a dark oak button:
if targeted block is in {ButtonLvl4}:
remove targeted block from {ButtonLvl4}
send "&aBouton enlevé ! Tout le monde pourra l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else if arg 2 is "5":
if targeted block is a dark oak button:
if targeted block is in {ButtonLvl5}:
remove targeted block from {ButtonLvl5}
send "&aBouton enlevé ! Tout le monde pourra l'utiliser." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else:
send "&cMettez un numéro entre 1 et 5 !" to player
else if arg 1 is "info":
if arg 2 is "all":
send "Boutons Niv 1 : %{ButtonLvl1}%" to player
send "Boutons Niv 2 : %{ButtonLvl2}%" to player
send "Boutons Niv 3 : %{ButtonLvl3}%" to player
send "Boutons Niv 4 : %{ButtonLvl4}%" to player
send "Boutons Niv 5 : %{ButtonLvl5}%" to player
else:
if targeted block is dark oak button:
if targeted block is in {ButtonLvl1}:
send "Le bouton est accessible aux cartes d'accès niveau 1" to player
else if targeted block is in {ButtonLvl2}:
send "Le bouton est accessible aux cartes d'accès niveau 1" to player
else if targeted block is in {ButtonLvl3}:
send "Le bouton est accessible aux cartes d'accès niveau 1" to player
else if targeted block is in {ButtonLvl4}:
send "Le bouton est accessible aux cartes d'accès niveau 1" to player
else if targeted block is in {ButtonLvl5}:
send "Le bouton est accessible aux cartes d'accès niveau 1" to player
else:
send "Le bouton est accessible à tous." to player
else:
send "&cIl faut regarder un bouton en chêne noir (keycard button)." to player
else:
send "&cL'argument 1 doit être 'add' ou 'remove'." to player
on click on dark oak button:
if {choosebutton1.%player%} is true:
cancel event
add clicked block to {ButtonLvl1}
send "&aBouton Validé !"
set {choosebutton1.%player%} to false
on click on dark oak button:
if targeted block is in {ButtonLvl1}:
send "test"
if player's tool is a magenta dye or light blue dye or yellow dye or white dye or orange dye:
send "&aAccès autorisé !" to player
else:
cancel event
send "&eUtilisez votre carte d'accès !" to player
if targeted block is in {ButtonLvl2}:
if player's tool is a magenta dye or orange dye or light blue dye or yellow dye:
send "&aAccès autorisé !" to player
else if player's tool is white dye:
cancel event
send "&cAccès non autorisé ! Vous n'avez pas le nivea d'accréditation nécessaire.(Niv. 2)" to player
else:
cancel event
send "&eUtilisez votre carte d'accès !" to player
if targeted block is in {ButtonLvl3}:
if player's tool is a magenta dye or light blue dye or yellow dye:
send "&aAccès autorisé !" to player
else if player's tool is white dye or orange dye:
cancel event
send "&cAccès non autorisé ! Vous n'avez pas le nivea d'accréditation nécessaire.(Niv. 3)" to player
else:
cancel event
send "&eUtilisez votre carte d'accès !" to player
if targeted block is in {ButtonLvl4}:
if player's tool is light blue dye or yellow dye:
send "&aAccès autorisé !" to player
else if player's tool is white dye or orange dye or magenta dye:
cancel event
send "&cAccès non autorisé ! Vous n'avez pas le nivea d'accréditation nécessaire.(Niv. 4)" to player
else:
cancel event
send "&eUtilisez votre carte d'accès !" to player
if targeted block is in {ButtonLvl5}:
if player's tool is yellow dye:
send "&aAccès autorisé !" to player
else if player's tool is white dye or orange dye or a magenta dye or light blue dye:
send "&cAccès non autorisé ! Vous n'avez pas le nivea d'accréditation nécessaire. (Niv. 5)" to player
cancel event
else:
send "&eUtilisez votre carte d'accès !" to player
cancel event
Voilà, j'espère que certains pourront m'aider, merci (Si vous avez besoin de plus d'info n'hésitez pas !