Aller au contenu
  • 0

Charger un kit via un item


Question

Posté(e)

Bonjour à tous,

 

Je suis actuellement en train de créer un serveur training mais j'aurais besoin d'aide pour charger un kit via une feuille de papier.

Je m'explique :

J'ai réussi avec un skript, a sauvegarder et charger son kit en cliquant sur un panneau.

 

[spoiler=Code]

options:





#            --> [POTIONS] <--

   Nom stuff: &e&oStuff



#            --> [ENCHANTEMENT] <--

   epee: Sharpness 3 #Mettez "rien" si aucun enchant
   arc: Power 5 #Mettez "rien" si aucun enchant
   Casque: Protection 2 #Mettez "rien" si aucun enchant
   chestplate: Protection 2 #Mettez "rien" si aucun enchant
   leggings: Protection 2 #Mettez "rien" si aucun enchant
   boots: Protection 2 #Mettez "rien" si aucun enchant



#            --> [colorSIGNS] <--       

on sign change:
   if player has permission "sign.color":
       set line 1 to coloured line 1
       set line 2 to coloured line 2
       set line 3 to coloured line 3
       set line 4 to coloured line 4

on sign change:
   line 1 is "&7[&6Kit&7]"
   player doesn't have permission "sign.place"
   cancel event
   send "&cVous ne pouvez pas faire celà."



#            --> [KITS] <--

on right click on sign:
   if line 3 is "&aLe kit":
       if line 2 is "&aSauvegarder":
           wait 0.5 tick
           set {_slot} to 0
           loop 36 times:
               set {Kit.%player%.%line 3%.%{_slot}%} to slot {_slot} of player's inventory
               add 1 to {_slot}
           wait 0.5 tick
           set {helmet.%player%.%line 3%} to helmet of player
           wait 0.5 tick
           set {chestplate.%player%.%line 3%} to chestplate of player
           wait 0.5 tick
           set {leggings.%player%.%line 3%} to leggings of player
           wait 0.5 tick
           set {boots.%player%.%line 3%} to boots of player
           send "&aVotre kit a été sauvegarder."



       if line 2 is "&aCharger":

       # Copier pour autre panneau restaure mais modifier le "1 "
           if line 3 is set:
               wait 0.5 tick
               set helmet of player to {helmet.%player%.%line 3%}
               wait 0.5 tick
               set chestplate of player to {chestplate.%player%.%line 3%}
               wait 0.5 tick
               set leggings of player to {leggings.%player%.%line 3%}
               wait 0.5 tick
               set boots of player to {boots.%player%.%line 3%}
               wait 0.5 tick
               set {_slot} to 0
               wait 0.5 tick
               loop 36 times:
                   set slot {_slot} of player's inventory to {Kit.%player%.%line 3%.%{_slot}%}
                   add 1 to {_slot}
               send "&aKit reçu !"


on right click on chest:
   loop blocks in radius 3 around event-block:
       line 2 of loop-block is "{@Nom stuff}"
       cancel event
       open chest with 5 row named "" to player
       wait 1 tick

       set {casque} to "{@Casque}"
       set {chestplate} to "{@chestplate}"
       set {leggings} to "{@leggings}"
       set {boots} to "{@boots}"
       set {epee} to "{@epee}"
       set {arc} to "{@arc}"
       format slot 0 of player with diamond helmet of {@Casque} to run [give player diamond helmet of {@Casque}]
       format slot 9 of player with diamond chestplate of {@chestplate} to run [give player diamond chestplate of {@chestplate}]   
       format slot 18 of player with diamond leggings of {@leggings} to run [give player diamond leggings of {@leggings}]   
       format slot 27 of player with diamond boots of {@boots} to run [give player diamond boots of {@boots}]
       format slot 36 of player with diamond sword of {@epee} to run [give player diamond sword of {@epee}]
       format slot 1 of player with bow of {@arc} to run [give player bow of {@arc}]
       format slot 10 of player with arrow to run [give player 64 arrow]
       format slot 19 of player with ender pearl to run [give player 16 ender pearl]
       format slot 35 of player with splash Health potion II item to run [give player 373:16421]
       format slot 44 of player with steak item to run [give player 64 steak]
       format slot 26 of player with 373:8258 to run [give player 373:8258]
       format slot 17 of player with 373:8226 to run [give player 373:8226]
       format slot 8 of player with 373:8259 to run [give player 373:8259]

 

 

Maintenant, je voudrais charger le kit du joueur via un papier, j'ai testé plusieurs codes mais aucun ne marche, voici un de mes codes:

 




on right click:
   if player's tool is a paper:
       if name of player's tool is "&3Kit":
           clear the player's inventory
           wait 0.5 tick
           set helmet of player to {helmet.%player%}
           wait 0.5 tick
           set chestplate of player to {chestplate.%player%}
           wait 0.5 tick
           set leggings of player to {leggings.%player%}
           wait 0.5 tick
           set boots of player to {boots.%player%}
           wait 0.5 tick
           set {_slot} to 0
           wait 0.5 tick
           loop 36 times:
               set slot {_slot} of player's inventory to {Kit.%player%.%{_slot}%}
               add 1 to {_slot}
           message "&aKit chargé !" to the player

 

J'espère que vous pourrez m'aider :)

 

Cordialement, Thinqy.

10 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Jsuis pas un professionnel mais je pense savoir,

 

Ici tu enregistres (par exemple) les bottes sous: "{boots.%player%.%line 3%}"

Et ici tu les charges (Toujours les bottes pour l'exemple) sous: "{boots.%player%}"

 

Il te manque donc ce que correspond le %line 3% de la save (Le nom je crois)

 

Voila voila, si c'est pas ça, j'aurai essayé ^^

 

PS: Si j'appel pas les trucs par leurs vrai noms sorry ;p

  • 0
Posté(e)

Tu gardes le premier code qui est bon (pour moi)

Et le 2ème tu mets (Par exemple si le kit voulu est nommé Guerrier)

 

on right click:
   if player's tool is a paper:
       if name of player's tool is "&3Kit":
           clear the player's inventory
           wait 0.5 tick
           set helmet of player to {helmet.%player%.guerrier}
           wait 0.5 tick
           set chestplate of player to {chestplate.%player%.guerrier}
           wait 0.5 tick
           set leggings of player to {leggings.%player%.guerrier}
           wait 0.5 tick
           set boots of player to {boots.%player%.guerrier}
           wait 0.5 tick
           set {_slot} to 0
           wait 0.5 tick

  • 0
Posté(e)

Non mais en fait le systeme c'est que grace a un coffre, ils se stuffent, sauvegardent leur kit sur un panneau et je veux qu'ils puissent load leur kit en faisant clique droit sur un papier. Y'a pas de "nom" pour le kit ^^

  • 0
Posté(e)
Autant pour moi °_° En lisant j'ai penser que "Le kit" dans "if line 3 is "&aLe kit":" était le nom du kit

Non c'est le texte écrit dans la ligne 3 du panneau ^^"

×
×
  • 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.