Aller au contenu
  • 0

Ouvrir un deuxième menu


Question

Posté(e)

Bonsoir a tous,

 

Je suis en train de coder un petit skript mais j'ai un problème quand je met une commande pour ouvrir un deuxieme menu:

 

command /menu:
   trigger:
       wait 1.5 tick
       open chest with 6 rows named "&b&lMenu Warps"  to player
       wait 1 tick
       format slot 0 of player with light green stained glass pane named " " to be unstealable
       format slot 1 of player with light green stained glass pane named " " to be unstealable
       format slot 2 of player with light green stained glass pane named " " to be unstealable
       format slot 3 of player with light green stained glass pane named " " to be unstealable
       format slot 4 of player with light green stained glass pane named " " to be unstealable
       format slot 5 of player with light green stained glass pane named " " to be unstealable
       format slot 6 of player with light green stained glass pane named " " to be unstealable
       format slot 7 of player with light green stained glass pane named " " to be unstealable
       format slot 8 of player with light green stained glass pane named " " to be unstealable
       format slot 9 of player with light green stained glass pane named " " to be unstealable
       format slot 10 of player with light green stained glass pane named " " to be unstealable
       format slot 11 of player with diamond sword named "&2&lSpawn" with lore "&8Téléporte toi au spawn du faction!" to close then run [make player execute command "/spawn"]
       format slot 12 of player with light green stained glass pane named " " to be unstealable
       format slot 13 of player with 324 named "&5&lHUB" with lore "&8Téléporte toi au HUB/Lobby! (10 secondes de téléportation)"to close then run [make player execute command "/HUB"]
       format slot 14 of player with light green stained glass pane named " " to be unstealable
       format slot 15 of player with 324 named "&c&lEvents" to close then run [make player execute command "/events"]
       format slot 16 of player with light green stained glass pane named " " to be unstealable
       format slot 17 of player with light green stained glass pane named " " to be unstealable
       format slot 18 of player with light green stained glass pane named " " to be unstealable
       format slot 29 of player with light green stained glass pane named " " to be unstealable
       format slot 20 of player with light green stained glass pane named " " to be unstealable
       format slot 21 of player with 324 named "&c&lBoutique " with lore "Téléporte toi a la boutique d'item in-game" to close then run [make player execute command "/boutique"]
       format slot 22 of player with light green stained glass pane named " " to be unstealable
       format slot 23 of player with 324 named "&d&lMine " with lore "&7Téléporte toi à la mine automatique!" to close then run [make player execute command "/mine"]
       format slot 24 of player with light green stained glass pane named " " to be unstealable
       format slot 25 of player with light green stained glass pane named " " to be unstealable
       format slot 26 of player with light green stained glass pane named " " to be unstealable
       format slot 27 of player with light green stained glass pane named " " to be unstealable
       format slot 28 of player with light green stained glass pane named " " to be unstealable
       format slot 39 of player with book named "&8&lLiens utiles" with lore "&7Liens internet" to close then run [make player execute command "/lien"]
       format slot 30 of player with light green stained glass pane named " " to be unstealable
       format slot 31 of player with diamond named "&d&lShop" with lore "&7Espace a louer pendant 2 semaines (7500 € in-game)" to close then run [make player execute command "/shop"]
       format slot 32 of player with light green stained glass pane named " " to be unstealable
       format slot 33 of player with diamond named "&1&lVille" with lore "Maisons disponible/deja achetée de la ville"to close then run [make player execute command "/ville"]
       format slot 34 of player with light green stained glass pane named " " to be unstealable
       format slot 35 of player with light green stained glass pane named " " to be unstealable
       format slot 36 of player with light green stained glass pane named " " to be unstealable
       format slot 37 of player with light green stained glass pane named " " to be unstealable
       format slot 38 of player with light green stained glass pane named " " to be unstealable
       format slot 39 of player with diamond named "&1&lListe des warps" with lore "&7Liste des warps du serveur"to close then run [make player execute command "/warplist"]
       format slot 40 of player with light green stained glass pane named " " to be unstealable
       format slot 39 of player with diamond named "&5&lStaff" with lore "&7Liste des warps du serveur"to close then run [make player execute command "/staff"]
       format slot 42 of player with light green stained glass pane named " " to be unstealable
       format slot 43 of player with light green stained glass pane named " " to be unstealable
       format slot 44 of player with light green stained glass pane named " " to be unstealable
       format slot 45 of player with light green stained glass pane named " " to be unstealable
       format slot 46 of player with light green stained glass pane named " " to be unstealable
       format slot 47 of player with light green stained glass pane named " " to be unstealable
       format slot 48 of player with light green stained glass pane named " " to be unstealable
       format slot 49 of player with light green stained glass pane named " " to be unstealable
       format slot 50 of player with light green stained glass pane named " " to be unstealable
       format slot 51 of player with light green stained glass pane named " " to be unstealable
       format slot 52 of player with light green stained glass pane named " " to be unstealable
       format slot 53 of player with light green stained glass pane named " " to be unstealable
command /ville:
   trigger:
       open chest with 6 rows named "&9&lVille" to player

command /lien:
   trigger:
       wait 1.5
       open chest with 3 rows named "&c&lliens" to player
       wait 1 tick
       format slot 0 of player with light green stained glass pane named " " to be unstealable
       format slot 1 of player with light green stained glass pane named " " to be unstealable
       format slot 2 of player with light green stained glass pane named " " to be unstealable
       format slot 3 of player with light green stained glass pane named " " to be unstealable
       format slot 4 of player with light green stained glass pane named " " to be unstealable
       format slot 5 of player with light green stained glass pane named " " to be unstealable
       format slot 6 of player with light green stained glass pane named " " to be unstealable
       format slot 7 of player with light green stained glass pane named " " to be unstealable
       format slot 8 of player with light green stained glass pane named " " to be unstealable
       format slot 9 of player with light green stained glass pane named " " to be unstealable
       format slot 10 of player with stone named "&5Site" with lore "." to close then run
       format slot 10 of player with stone named "&5Forum" with lore "." to close then run
       format slot 10 of player with stone named "&5Votes" with lore "." to close then run
       format slot 10 of player with stone named "&5Boutique" with lore "." to close then run
       format slot 10 of player with stone named "&Partenaire" with lore "." to close then run
       format slot 10 of player with stone named "&Partenaires" with lore "." to close then run
       format slot 10 of player with stone named "&4AzeLiK" with lore "." to close then run
       format slot 17 of player with light green stained glass pane named " " to be unstealable
       format slot 18 of player with light green stained glass pane named " " to be unstealable
       format slot 19 of player with light green stained glass pane named " " to be unstealable
       format slot 20 of player with light green stained glass pane named " " to be unstealable
       format slot 21 of player with light green stained glass pane named " " to be unstealable
       format slot 22 of player with light green stained glass pane named " " to be unstealable
       format slot 23 of player with light green stained glass pane named " " to be unstealable
       format slot 24 of player with light green stained glass pane named " " to be unstealable
       format slot 25 of player with light green stained glass pane named " " to be unstealable
       format slot 26 of player with light green stained glass pane named " " to be unstealable

 

Il y a certains points qui ne sont pas fini mais je dois les terminer, le principal c'est que je ne peux pas ouvrir d'autres menus à partir du premier (qui est le /menu).

 

Exemple : quand j'ai

        format slot 39 of player with book named "&8&lLiens utiles" with lore "&7Liens internet" to close then run [make player execute command "/lien"]

 

Je ne peux pas ouvrir le menu 'lien' , pareil avec le /ville, ... ( Je n'ai pas montrer le reste du code car trop long)

 

Merci de votre aide

 

AzeLiK

19 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Enléve toute tes vitre et met sa a la place ( Pour optimiser )

set {_slotfill} to 0
           loop 54 times:
               format slot {_slotfill} of player with black glass named " " to be unstealable
               add 1 to {_slotfill}

  • J'aime 1
  • 0
Posté(e)
Il ne faut pas mettre le "/" dans la commande. Le "lien" suffit.

Mettre le "/" ne change rien.

 

Ton problème c'est juste que le délai (1,5 tick) et trop court : Tu ferme le menu et 1,5 tick plus tard il faut en réouvrir un or cela est trop rapide. Normalement mettre 2 tick règle le probléme

  • J'aime 1
  • 0
Posté(e)
Enléve toute tes vitre et met sa a la place ( Pour optimiser )

set {_slotfill} to 0
           loop 54 times:
               format slot {_slotfill} of player with black glass named " " to be unstealable
               add 1 to {_slotfill}

Est ce que c'est vraiment plus propre de faire ça ?

Certes on gagne en lisibilité dans le code, mais on format plusieurs slots pour y mettre une vitre, puis à nouveau autre chose. De plus vu les bugs que rencontre le format slot, je sais pas si c'est bon de faire to be unstealable, puis to run sur un même slot.

 

 

Pour tes erreurs, la première vient du fait que tu as oublié le S à slot.

Pour les autres, tu pourrais reposter le codes que tu as actuellement ? J'ai l'impression que le lore est collé au to close then run, mais on peut pas être sur avec l'image.

  • 0
Posté(e)
Est ce que c'est vraiment plus propre de faire ça ?

Certes on gagne en lisibilité dans le code, mais on format plusieurs slots pour y mettre une vitre, puis à nouveau autre chose. De plus vu les bugs que rencontre le format slot, je sais pas si c'est bon de faire to be unstealable, puis to run sur un même slot.

 

 

Pour tes erreurs, la première vient du fait que tu as oublié le S à slot.

Pour les autres, tu pourrais reposter le codes que tu as actuellement ? J'ai l'impression que le lore est collé au to close then run, mais on peut pas être sur avec l'image.

Tu gagne en lisibilité et donc tu peut trouver plus vite et plus simplement tes erreurs et qui dit moin de lignes dit plus optimiser :)

  • 0
Posté(e)

command /menu:
   trigger:
       wait 1.5 tick
       open chest with 6 rows named "&b&lMenu Warps"  to player
       wait 1 tick
       set slot 11  of player's current inventory to diamond sword named "&2&lSpawn" with lore "&8Téléporte toi au spawn du faction!"
       set slot 13  of player's current inventory to 324 named "&5&lHUB" with lore "&8Téléporte toi au HUB/Lobby! (10 secondes de téléportation)"
       set slot 15  of player's current inventory to 324 named "&c&lEvents"
       set slot 21  of player's current inventory to 324 named "&c&lBoutique " with lore "Téléporte toi a la boutique d'item in-game"
       set slot 23  of player's current inventory to 324 named "&d&lMine " with lore "&7Téléporte toi à la mine automatique!"
       set slot 28  of player's current inventory to diamond named "&d&lShop" with lore "&7Espace a louer pendant 2 semaines (7500 € in-game)"
       set slot 30  of player's current inventory to diamond named "&1&lVille" with lore "Maisons disponible/deja achetée de la ville"
       set slot 32  of player's current inventory to book named "&8&lLiens utiles" with lore "&7Liens internet"
       set slot 34  of player's current inventory to diamond named "&1&lListe des warps" with lore "&7Liste des warps du serveur"
       set slot 40  of player's current inventory to diamond named "&5&lStaff" with lore "&7Liste des warps du serveur"
       add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 17, 18, 19, 20, 22, 24, 25, 26, 27, 29, 30, 32, 34, 35, 36, 37, 38, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 to {_list::*}
       set {_item} to white stained glass pane
       while inventory name of player's current inventory is "&b&lMenu Warps":
           add 1 to {_start}
           set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
           if {_start} = size of {_list::*}:
               set {_start} to 0
               add 1 to {_loop}
               if {_loop} = 1:
                   set {_loop} to 0
                   set {_item} to light green stained glass pane
on inventory click:
   if name of player's current inventory is "&b&lMenu Warps":
       if clicked slot is 11:
           make player execute command "/spawn"
       else if clicked slot is 13:
           make player execute command "/hub"
       else if clicked slot is 15:
           make player execute command "/event"
       else if clicked slot is 21:
           make player execute command "/boutique"
       else if clicked slot is 23:
           make player execute command "/mine"
       else if clicked slot is 29:
           make player execute command "/shop"
       else if clicked slot is 31:
           open chest with 6 rows named "&9&lVille" to player
       else if clicked slot is 33:
           open chest with 3 rows named "&a&lLiens" to player
           set slot 10  of player's current inventory to stone named "&5Site" with lore " "
           set slot 11  of player's current inventory to stone named "&5Forum" with lore " "
           set slot 12  of player's current inventory to stone named "&5Votes" with lore " "
           set slot 13  of player's current inventory to stone named "&5Boutique" with lore " "
           set slot 14  of player's current inventory to stone named "&Partenaire" with lore " "
           set slot 15  of player's current inventory to stone named "&Partenaires" with lore " "
           set slot 16  of player's current inventory to stone named "&4AzeLiK" with lore " "
           add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25 and 26 to {_list::*}
           set {_item} to white stained glass pane
           while inventory name of player's current inventory is "&a&lLiens":
               add 1 to {_start}
               set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
               if {_start} = size of {_list::*}:
                   set {_start} to 0
                   add 1 to {_loop}
                   if {_loop} = 1:
                       set {_loop} to 0
                       set {_item} to light green stained glass pane
       else if clicked slot is 39:
           make player execute command "/warplist"
       else if clicked slot is 41:
           make player execute command "/staff"

 

Cordialement,

PheonBest

 

P-S: Je ne l'ai pas testé.

  • 0
Posté(e)
command /menu:
   trigger:
       wait 1.5 tick
       open chest with 6 rows named "&b&lMenu Warps"  to player
       wait 1 tick
       set slot 11  of player's current inventory to diamond sword named "&2&lSpawn" with lore "&8Téléporte toi au spawn du faction!"
       set slot 13  of player's current inventory to 324 named "&5&lHUB" with lore "&8Téléporte toi au HUB/Lobby! (10 secondes de téléportation)"
       set slot 15  of player's current inventory to 324 named "&c&lEvents"
       set slot 21  of player's current inventory to 324 named "&c&lBoutique " with lore "Téléporte toi a la boutique d'item in-game"
       set slot 23  of player's current inventory to 324 named "&d&lMine " with lore "&7Téléporte toi à la mine automatique!"
       set slot 28  of player's current inventory to diamond named "&d&lShop" with lore "&7Espace a louer pendant 2 semaines (7500 € in-game)"
       set slot 30  of player's current inventory to diamond named "&1&lVille" with lore "Maisons disponible/deja achetée de la ville"
       set slot 32  of player's current inventory to book named "&8&lLiens utiles" with lore "&7Liens internet"
       set slot 34  of player's current inventory to diamond named "&1&lListe des warps" with lore "&7Liste des warps du serveur"
       set slot 40  of player's current inventory to diamond named "&5&lStaff" with lore "&7Liste des warps du serveur"
       add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 17, 18, 19, 20, 22, 24, 25, 26, 27, 29, 30, 32, 34, 35, 36, 37, 38, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 to {_list::*}
       set {_item} to white stained glass pane
       while inventory name of player's current inventory is "&b&lMenu Warps":
           add 1 to {_start}
           set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
           if {_start} = size of {_list::*}:
               set {_start} to 0
               add 1 to {_loop}
               if {_loop} = 1:
                   set {_loop} to 0
                   set {_item} to light green stained glass pane
on inventory click:
   if name of player's current inventory is "&b&lMenu Warps":
       if clicked slot is 11:
           make player execute command "/spawn"
       else if clicked slot is 13:
           make player execute command "/hub"
       else if clicked slot is 15:
           make player execute command "/event"
       else if clicked slot is 21:
           make player execute command "/boutique"
       else if clicked slot is 23:
           make player execute command "/mine"
       else if clicked slot is 29:
           make player execute command "/shop"
       else if clicked slot is 31:
           open chest with 6 rows named "&9&lVille" to player
       else if clicked slot is 33:
           open chest with 3 rows named "&a&lLiens" to player
           set slot 10  of player's current inventory to stone named "&5Site" with lore " "
           set slot 11  of player's current inventory to stone named "&5Forum" with lore " "
           set slot 12  of player's current inventory to stone named "&5Votes" with lore " "
           set slot 13  of player's current inventory to stone named "&5Boutique" with lore " "
           set slot 14  of player's current inventory to stone named "&Partenaire" with lore " "
           set slot 15  of player's current inventory to stone named "&Partenaires" with lore " "
           set slot 16  of player's current inventory to stone named "&4AzeLiK" with lore " "
           add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25 and 26 to {_list::*}
           set {_item} to white stained glass pane
           while inventory name of player's current inventory is "&a&lLiens":
               add 1 to {_start}
               set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
               if {_start} = size of {_list::*}:
                   set {_start} to 0
                   add 1 to {_loop}
                   if {_loop} = 1:
                       set {_loop} to 0
                       set {_item} to light green stained glass pane
       else if clicked slot is 39:
           make player execute command "/warplist"
       else if clicked slot is 41:
           make player execute command "/staff"

 

Cordialement,

PheonBest

 

P-S: Je ne l'ai pas testé.

Il me marque 1 erreur:

http://www.noelshack.com/2016-31-1470135532-erreur.png

  • 0
Posté(e)
Tu gagne en lisibilité et donc tu peut trouver plus vite et plus simplement tes erreurs et qui dit moin de lignes dit plus optimiser :)

 

Moins de ligne n'est absolument pas la même chose que plus optimisé ! Tu peux souvent faire différement en moins de lignes, mais niveau exécution du code, ce ne sera pas forcément plus optimisé par rapport à une version plus longue.

  • 0
Posté(e)

Cadeau:

 

command /menu:
   trigger:
       open chest with 6 rows named "&b&lMenu Warps" to player
       wait 1 tick
       set slot 11  of player's current inventory to diamond sword named "&2&lSpawn" with lore "&8Téléporte-toi au spawn du Faction!"
       set slot 13  of player's current inventory to 324 named "&5&lHUB" with lore "&8Téléporte-toi au HUB/Lobby! (10 secondes de téléportation)"
       set slot 15  of player's current inventory to 324 named "&c&lEvents"
       set slot 21  of player's current inventory to 324 named "&c&lBoutique " with lore "Téléporte-toi à la boutique d'item in-game !"
       set slot 23  of player's current inventory to 324 named "&d&lMine " with lore "&7Téléporte-toi à la mine automatique!"
       set slot 28  of player's current inventory to diamond named "&d&lShop" with lore "&7Espace à louer pendant 2 semaines (7500 € in-game)"
       set slot 30  of player's current inventory to diamond named "&1&lVille" with lore "Maisons disponibles/déjà achetées de la ville"
       set slot 32  of player's current inventory to book named "&8&lLiens utiles" with lore "&7Liens internet"
       set slot 34  of player's current inventory to diamond named "&1&lListe des warps" with lore "&7Liste des warps du serveur"
       set slot 40  of player's current inventory to diamond named "&5&lStaff" with lore "&7Liste des warps du serveur"
       add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 16, 17, 18, 19, 20, 22, 24, 25, 26, 27, 29, 31, 33, 35, 36, 37, 38, 39, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52 and 53 to {_list::*}
       set {_item} to white stained glass pane
       while inventory name of player's current inventory is "&b&lMenu Warps":
           add 1 to {_start}
           set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
           if {_start} = size of {_list::*}:
               set {_start} to 0
               add 1 to {_loop}
               if {_loop} = 1:
                   set {_item} to light green stained glass pane
               else if {_loop} = 2:
                   set {_loop} to 0
                   set {_item} to white stained glass pane
           wait 3 ticks
on inventory click:
   if inventory name of player's current inventory is "&b&lMenu Warps":
       cancel event
       if clicked slot is 11:
           close player's inventory
           make player execute command "/spawn"
       else if clicked slot is 13:
           close player's inventory
           make player execute command "/hub"
       else if clicked slot is 15:
           close player's inventory
           make player execute command "/event"
       else if clicked slot is 21:
           close player's inventory
           make player execute command "/boutique"
       else if clicked slot is 23:
           close player's inventory
           make player execute command "/mine"
       else if clicked slot is 28:
           close player's inventory
           make player execute command "/shop"
       else if clicked slot is 30:
           open chest with 6 rows named "&9&lVille" to player
       else if clicked slot is 32:
           open chest with 3 rows named "&a&lLiens" to player
           set slot 10  of player's current inventory to stone named "&aSite" with lore " "
           set slot 11  of player's current inventory to stone named "&aForum" with lore " "
           set slot 12  of player's current inventory to stone named "&aVotes" with lore " "
           set slot 13  of player's current inventory to stone named "&aBoutique" with lore " "
           set slot 14  of player's current inventory to stone named "&aPartenaires" with lore " "
           set slot 15  of player's current inventory to stone named "&aPartenaires" with lore " "
           set slot 16  of player's current inventory to stone named "&4AzeLiK" with lore " "
           add 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 17, 18, 19, 20, 21, 22, 23, 24, 25 and 26 to {_list::*}
           set {_item} to white stained glass pane
           while inventory name of player's current inventory is "&a&lLiens":
               add 1 to {_start}
               set slot {_list::%{_start}%} of player's current inventory to {_item} named " "
               if {_start} = size of {_list::*}:
                   set {_start} to 0
                   add 1 to {_loop}
                   if {_loop} = 1:
                       set {_item} to light green stained glass pane
                   else if {_loop} = 2:
                       set {_loop} to 0
                       set {_item} to white stained glass pane
               wait 3 ticks
       else if clicked slot is 34:
           make player execute command "/warplist"
       else if clicked slot is 40:
           make player execute command "/staff"
   else if inventory name of player's current inventory is "&a&lLiens":
       cancel event
       if clicked slot is 10:
           close player's inventory
       else if clicked slot is 11:
           close player's inventory
       else if clicked slot is 12:
           close player's inventory
       else if clicked slot is 13:
           close player's inventory
       else if clicked slot is 14:
           close player's inventory
       else if clicked slot is 15:
           close player's inventory
       else if clicked slot is 16:
           close player's inventory

 

Cordialement,

PheonBest.

  • J'aime 1
×
×
  • Créer...

Information importante

Nous avons placé des cookies sur votre appareil pour aider à améliorer ce site. Vous pouvez choisir d’ajuster vos paramètres de cookie, sinon nous supposerons que vous êtes d’accord pour continuer.