Bonjour, ceci est mon premier tutoriel alors j'espère qu'il sera au mieux pour vous plaire ! Quand je dis Menu Staff j'entends par la si le joueur a la permission menustaff.moderateur il accedera a un autre menu que s'il est OP ! Je trouve cela facile mais peut-être et j'espère que ça vous aideras ^^
Commençons déjà par créer la commande je pense que tout le monde sais faire :
command /menustaff:
trigger:
Jusque la ça va ? :p Bon allez commençons par vérifier si le joueur a la permission "menustaff.moderateur"
if player has permission "menustaff.moderateur":
Ensuite on va ouvrir un coffre de une ligne avec des glass noir nommé "&e-----" qui feront rien quand vous cliquerez on verra comment ajouter une commande plus tard :
wait 1 tick
open chest with 1 rows named "&cMenu Modérateur" to player
format slot 0 of player with black stained glass named "&a-------" to be unstealable
format slot 1 of player with black stained glass named "&a-------" to be unstealable
format slot 2 of player with black stained glass named "&a-------" to be unstealable
format slot 3 of player with black stained glass named "&a-------" to be unstealable
format slot 4 of player with black stained glass named "&a-------" to be unstealable
format slot 5 of player with black stained glass named "&a-------" to be unstealable
format slot 6 of player with black stained glass named "&a-------" to be unstealable
format slot 7 of player with black stained glass named "&a-------" to be unstealable
format slot 8 of player with black stained glass named "&a-------" to be unstealable
Ne pas oublier le "wait 1 tick" pour être sur qu'il se passera aucun bug !
Nous allons vérifier si le joueur a au moins une permission "menustaff.moderateur" ou s'il est op sinon on va lui envoyer un message pour lui dire qu'il n'a pas la permission grace à "else:" (else veut dire "sinon" pour ceux qui ne savent pas)
else:
send "&cGrade non valide pour accèder au menu !"
Voilà le code la fonctionne mais c'est pas fini car on a dit on veut un menu différent si le joueur est op donc continuons !
Vérifions si le joueur est op :
if player is op:
Maintenant on va envoyer un message et ouvrir un coffre de une ligne pareil que tout à l'heure ET fermer le premier menu pour provoquer aucun bug !
send "&2Redirection du menu !"
wait 1 tick
close the player's inventory
wait 1 tick
open chest with 1 rows named "&cMenu Admin" to player
format slot 0 of player with black stained glass named "&a-------" to be unstealable
format slot 1 of player with black stained glass named "&a-------" to be unstealable
format slot 2 of player with black stained glass named "&a-------" to be unstealable
format slot 3 of player with black stained glass named "&a-------" to be unstealable
format slot 4 of player with black stained glass named "&a-------" to be unstealable
format slot 5 of player with black stained glass named "&a-------" to be unstealable
format slot 6 of player with black stained glass named "&a-------" to be unstealable
format slot 7 of player with black stained glass named "&a-------" to be unstealable
format slot 8 of player with green wool named "&l&bBroadcast" with lore "Voici mon premier tuto !" to close then run [make player execute command "/broadcast Voici mon premier tuto !"]
Donc voilà à quoi sert :
to close then run [make player execute command "/broadcast Voici mon premier tuto !"]
to close va fermer le menu et then run [make player execute command "/broadcast Voici mon premier tuto !"] va lancer la commande /broadcast
J'ajouterais des choses plus complexes une autre fois mais cela ne fait pas longtemps que je Skript ^^
Voici le code complet :
command /menustaff:
trigger:
if player has permission "menustaff.moderateur":
wait 1 tick
open chest with 1 rows named "&cMenu Modérateur" to player
format slot 0 of player with black stained glass named "&a-------" to be unstealable
format slot 1 of player with black stained glass named "&a-------" to be unstealable
format slot 2 of player with black stained glass named "&a-------" to be unstealable
format slot 3 of player with black stained glass named "&a-------" to be unstealable
format slot 4 of player with black stained glass named "&a-------" to be unstealable
format slot 5 of player with black stained glass named "&a-------" to be unstealable
format slot 6 of player with black stained glass named "&a-------" to be unstealable
format slot 7 of player with black stained glass named "&a-------" to be unstealable
format slot 8 of player with black stained glass named "&a-------" to be unstealable
else:
send "Grade non valide pour accèder au menu !"
if player is op:
send "&2Redirection du menu !"
wait 1 tick
close the player's inventory
wait 1 tick
open chest with 1 rows named "&cMenu Admin" to player
format slot 0 of player with black stained glass named "&a-------" to be unstealable
format slot 1 of player with black stained glass named "&a-------" to be unstealable
format slot 2 of player with black stained glass named "&a-------" to be unstealable
format slot 3 of player with black stained glass named "&a-------" to be unstealable
format slot 4 of player with black stained glass named "&a-------" to be unstealable
format slot 5 of player with black stained glass named "&a-------" to be unstealable
format slot 6 of player with black stained glass named "&a-------" to be unstealable
format slot 7 of player with black stained glass named "&a-------" to be unstealable
format slot 8 of player with green wool named "&l&bBroadcast" with lore "Voici mon premier tuto !" to close then run [make player execute command "/broadcast Voici mon premier tuto !"]
Le code fonctionne je l'ai testé ! Bonne journée à vous