Aller au contenu
  • 0

Problème au niveau des animaux. (Fonction)


Question

Posté(e)

Bonjour à toute et à tous, j'ai besoin de vous.

Je fait actuellement un skript de gadgets, pets, morph, chapeau, particules...

Je rencontre un problème au niveau des animaux, j'ai fait mon code pour faire spawné une vache, la vache spawn, mes le serveur crash. Voici les Screenshots de ma fonctions et les erreurs de la console et mon code.

function Animaux(p: player):
   close {_p}'s inventory
   wait 1 tick
   set {menu.animaux.%{_p}%} to true
   open chest with 5 rows named "Cosmétiques > Animaux" to {_p}
   loop 500 times:
       if {menu.animaux.%{_p}%} is true:
           delete {_deco::*}
           set {_deco::*} to 0, 1, 2, 3, 5, 6, 7, 8, 10, 16, 19, 28, 25, 34, 36, 37, 39, 38, 41, 42, 43 and 44
           loop {_deco::*}:
               set slot loop-value-2 of current inventory of {_p} to red stained glass pane named "{@prefix}"
           set slot 33 of current inventory of {_p} to 383:92 named "&6Animal Vache" with lore "&7Clique pour devenir||&7une Vache."
           set slot 32 of current inventory of {_p} to 383:95 named "&6Animal Loup" with lore "&7Clique pour devenir||&7un Loup."
           set slot 30 of current inventory of {_p} to 383:120 named "&6Animal Villageois" with lore "&7Clique pour devenir||&7un Villageois."
           set slot 29 of current inventory of {_p} to 383:91 named "&6Animal Mouton" with lore "&7Clique pour devenir||&7un Mouton."
           set slot 24 of current inventory of {_p} to 383:90 named "&6Animal Cochon" with lore "&7Clique pour devenir||&7un Cochon."
           set slot 23 of current inventory of {_p} to 383:66 named "&6Animal Sorcière" with lore "&7Clique pour devenir||&7un Sorcière."
           set slot 22 of current inventory of {_p} to 383:61 named "&6Animal Blaze" with lore "&7Clique pour devenir||&7un Blaze."
           set slot 21 of current inventory of {_p} to 383:58 named "&6Animal Enderman" with lore "&7Clique pour devenir||&7un Enderman."
           set slot 20 of current inventory of {_p} to 383:100 named "&6Animal Cheval" with lore "&7Clique pour devenir||&7un Cheval."
           set slot 15 of current inventory of {_p} to 383:55 named "&6Animal Slime" with lore "&7Clique pour devenir||&7un Slime."
           set slot 14 of current inventory of {_p} to 383:54 named "&6Animal Zombie" with lore "&7Clique pour devenir||&7un Zombie."
           set slot 13 of current inventory of {_p} to 383:52 named "&6Animal Araignée" with lore "&7Clique pour devenir||&7un Araignée."
           set slot 12 of current inventory of {_p} to 383:51 named "&6Animal Squelette" with lore "&7Clique pour devenir||&7un Squelette."
           set slot 11 of current inventory of {_p} to 383:50 named "&6Animal Creeper" with lore "&7Clique pour devenir||&7un Creeper."
           set slot 31 of current inventory of {_p} to 152 named "&cSupprimé votre animal" with lore "&7Clique pour retiré||&7votre animal."
           set slot 40 of current inventory of {_p} to arrow named "&6Retour" with lore "&7Clique pour retourné||&7au menu des Cosmétiques."
           set {_random.monture} to random integer between 1 to 6
           if {_random.monture} is 1:
               set slot 4 of current inventory of {_p} to 383 named "&6Animaux"
           else if {_random.monture} is 2:
               set slot 4 of current inventory of {_p} to 383:51 named "&6Animaux"
           else if {_random.monture} is 3:
               set slot 4 of current inventory of {_p} to 383:52 named "&6Animaux"
           else if {_random.monture} is 4:
               set slot 4 of current inventory of {_p} to 383:54 named "&6Animaux"
           else if {_random.monture} is 5:
               set slot 4 of current inventory of {_p} to 383:55 named "&6Animaux"
           else if {_random.monture} is 6:
               set slot 4 of current inventory of {_p} to 383:56 named "&6Animaux"
       else:
           exit loop
       wait 1 seconds
on inventory click:
   #Animaux
   if inventory name of player's current inventory is "Cosmétiques > Animaux":
       #Anti-Glitch
       if name of clicked item contains "{@prefix}":
           if "%click type%" contains "LEFT":
               cancel event
           else if "%click type%" contains "RIGHT":
               cancel event
           else if "%click type%" contains "MIDDLE":
               cancel event
       #Anti-Glitch
       else if name of clicked item contains "&6Animaux":
           if "%click type%" contains "LEFT":
               cancel event
           else if "%click type%" contains "RIGHT":
               cancel event
           else if "%click type%" contains "MIDDLE":
               cancel event
       #Cosmétiques-Retour
       else if name of clicked item contains "&6Retour":
           if "%click type%" contains "LEFT":
               MenuCosmetiques(player)
           else if "%click type%" contains "RIGHT":
               MenuCosmetiques(player)
           else if "%click type%" contains "MIDDLE":
               MenuCosmetiques(player)
           cancel event
       #Animal-Creeper
       else if name of clicked item contains "&6Animal Creeper":
           if "%click type%" contains "LEFT":
               if {menu.animal.%player%} is "Creeper":
                   send "{@prefix}&c Vous avez déjà l'animal Creeper."
               else:
                   spawn 1 creeper at the player
                   set {menu.animal.%player%} to "Creeper"
                   set name of spawned entity to "&f%name of player%"
                   send "{@prefix} &7Vous avez invoqué votre animal."
                   add spawned entity to {pet.%player%.follow::*}
                   while spawned entity exists:
                       make spawned entity pathfind to player with speed 1
           else if "%click type%" contains "RIGHT":
               if {menu.animal.%player%} is "Creeper":
                   send "{@prefix}&c Vous avez déjà l'animal Creeper."
               else:
                   spawn 1 creeper at the player
                   set {menu.animal.%player%} to "Creeper"
                   set name of spawned entity to "&f%name of player%"
                   send "{@prefix} &7Vous avez invoqué votre animal."
                   add spawned entity to {pet.%player%.follow::*}
                   while spawned entity exists:
                       make spawned entity pathfind to player with speed 1
           else if "%click type%" contains "MIDDLE":
               if {menu.animal.%player%} is "Creeper":
                   send "{@prefix}&c Vous avez déjà l'animal Creeper."
               else:
                   spawn 1 creeper at the player
                   set {menu.animal.%player%} to "Creeper"
                   set name of spawned entity to "&f%name of player%"
                   send "{@prefix} &7Vous avez invoqué votre animal."
                   add spawned entity to {pet.%player%.follow::*}
                   while spawned entity exists:
                       make spawned entity pathfind to player with speed 1
           cancel event
       #Supprimé-Animal
       else if name of clicked item contains "&cSupprimé votre animal":
           if "%click type%" contains "LEFT":
               if {menu.animal.%player%} is "Vache":
                   set {menu.animal.%player%} to "vide"
                   send "{@prefix}&7 Vous avez supprimé votre animal."
                   loop {pet.%player%.follow::*}:
                       kill loop-value
                   clear {pet.%player%.follow::*}
               else:
                   send "{@prefix}&c Vous n'avez pas d'animal."
           else if "%click type%" contains "RIGHT":
               if {menu.animal.%player%} is "Vache":
                   set {menu.animal.%player%} to "vide"
                   send "{@prefix}&7 Vous avez supprimé votre animal."
                   loop {pet.%player%.follow::*}:
                       kill loop-value
                   clear {pet.%player%.follow::*}
               else:
                   send "{@prefix}&c Vous n'avez pas d'animal."
           else if "%click type%" contains "MIDDLE":
               if {menu.animal.%player%} is "Vache":
                   set {menu.animal.%player%} to "vide"
                   send "{@prefix}&7 Vous avez supprimé votre animal."
                   loop {pet.%player%.follow::*}:
                       kill loop-value
                   clear {pet.%player%.follow::*}
               else:
                   send "{@prefix}&c Vous n'avez pas d'animal."
           cancel event

1458149957-t6jy9fe.png

1458149962-ls30ing.png

Merci d'avance pour votre aide, j’espère que vous aurez toute les informations pour résoudre mon problème.

7 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Le problème vient de la l'effect pathfind de SkQuery. Il faut le mettre à jour, si ça ne marche pas toujours pas, il faudra attendre la prochaine update.

  • 0
Posté(e)

Franchement avec plusieurs SkQuery peut faire que des erreurs...

 

Utilise celui de SkQuery tout seul et essaye pour voir si ça fonctionne :)

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