Aller au contenu
  • 0

Comparer un item et un block


Question

Posté(e)

Version de Minecraft : 1.16.2
Version de Skript : 2.4

Addons utilisés: Tuske

Type du skript : Comparer le nom d'un item et celui d'un block dans le même if

Description du script :

Bonjour,

J'ai trouvé sur ce forum un skript pour récolter du sable avec un chargement en faisant un clique droit avec une pelle, je l'ai un peux modifié, il faut que la pelle ait un certain nom, de ce côté la pas de problème, mais j'aimerai pouvoir faire en sorte qu'ils ne puissent que farm avec le block de sable du spawn et évité qu'ils, apès en avoir farmé un, posent le sable sur le plot et commencent à farmer seul.
Merci à tout aide.

 

Le code (fonctionnel mais manque le compare pour le block):

on rightclick on sand with a shovel:
  if name of event-item is "&e&lHarvest Shovel 1":
    open chest with 1 row named "&9Harvesting..." to player
    wait 3 tick
    format gui slot 0 of player with red wool
    wait 0.55 second
    format gui slot 1 of player with red wool
    wait 0.55 second
    format gui slot 2 of player with red wool
    wait 0.55 second
    format gui slot 3 of player with yellow wool
    wait 0.55 second
    format gui slot 4 of player with yellow wool
    wait 0.55 second
    format gui slot 5 of player with yellow wool
    wait 0.55 second
    format gui slot 6 of player with green wool
    wait 0.55 second
    format gui slot 7 of player with green wool
    wait 0.55 second
    format gui slot 8 of player with green wool
    wait 0.55 second
    close player's inventory
    wait 1 tick
    give 1 sand to player
  if name of event-item is "&e&lHarvest Shovel 2":
    open chest with 1 row named "&9Harvesting..." to player
    wait 3 tick
    format gui slot 0 of player with red wool
    wait 0.45 second
    format gui slot 1 of player with red wool
    wait 0.45 second
    format gui slot 2 of player with red wool
    wait 0.45 second
    format gui slot 3 of player with yellow wool
    wait 0.45 second
    format gui slot 4 of player with yellow wool
    wait 0.45 second
    format gui slot 5 of player with yellow wool
    wait 0.45 second
    format gui slot 6 of player with green wool
    wait 0.45 second
    format gui slot 7 of player with green wool
    wait 0.45 second
    format gui slot 8 of player with green wool
    wait 0.45 second
    close player's inventory
    wait 1 tick
    give 1 sand to player
  if name of event-item is "&e&lHarvest Shovel 3":
    open chest with 1 row named "&9Harvesting..." to player
    wait 3 tick
    format gui slot 0 of player with red wool
    wait 0.35 second
    format gui slot 1 of player with red wool
    wait 0.35 second
    format gui slot 2 of player with red wool
    wait 0.35 second
    format gui slot 3 of player with yellow wool
    wait 0.35 second
    format gui slot 4 of player with yellow wool
    wait 0.35 second
    format gui slot 5 of player with yellow wool
    wait 0.35 second
    format gui slot 6 of player with green wool
    wait 0.35 second
    format gui slot 7 of player with green wool
    wait 0.35 second
    format gui slot 8 of player with green wool
    wait 0.35 second
    close player's inventory
    wait 1 tick
    give 1 sand to player
  if name of event-item is "&e&lHarvest Shovel 4":
    open chest with 1 row named "&9Harvesting..." to player
    wait 3 tick
    format gui slot 0 of player with red wool
    wait 0.25 second
    format gui slot 1 of player with red wool
    wait 0.25 second
    format gui slot 2 of player with red wool
    wait 0.25 second
    format gui slot 3 of player with yellow wool
    wait 0.25 second
    format gui slot 4 of player with yellow wool
    wait 0.25 second
    format gui slot 5 of player with yellow wool
    wait 0.25 second
    format gui slot 6 of player with green wool
    wait 0.25 second
    format gui slot 7 of player with green wool
    wait 0.25 second
    format gui slot 8 of player with green wool
    wait 0.25 second
    close player's inventory
    wait 1 tick
    give 1 sand to player
  if name of event-item is "&e&lHarvest Shovel 5":
    open chest with 1 row named "&9Harvesting..." to player
    wait 3 tick
    format gui slot 0 of player with red wool
    wait 0.15 second
    format gui slot 1 of player with red wool
    wait 0.15 second
    format gui slot 2 of player with red wool
    wait 0.15 second
    format gui slot 3 of player with yellow wool
    wait 0.15 second
    format gui slot 4 of player with yellow wool
    wait 0.15 second
    format gui slot 5 of player with yellow wool
    wait 0.15 second
    format gui slot 6 of player with green wool
    wait 0.15 second
    format gui slot 7 of player with green wool
    wait 0.15 second
    format gui slot 8 of player with green wool
    wait 0.15 second
    close player's inventory
    wait 1 tick
    give 1 sand to player



command /harvestshovel <number>:
  permission: "harvests.sk"
  trigger:
    if arg-1 is 1:
      give 1 wooden shovel named "&e&lHarvest Shovel 1" to player
    else if arg-1 is 2:
      give 1 stone shovel named "&e&lHarvest Shovel 2" to player
    else if arg-1 is 3:
      give 1 iron shovel named "&e&lHarvest Shovel 3" to player
    else if arg-1 is 4:
      give 1 diamond shovel named "&e&lHarvest Shovel 4" to player
    else if arg-1 is 5:
      give 1 netherite shovel named "&e&lHarvest Shovel 5" to player

command /harvestsand:
  permission: "harvests.sk"
  permission message: &6[&4Error&6] You don't have the permission to use this command !
  trigger:
    give 1 sand named "&e&lHarvest Sand"

 

13 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Bonjour

 

on a right click with a shovel:

    if clicked block is Sand:

        # code habituel

    else if clicked block is <bloc> #ex: grass

        # autre code

 

Désolé je suis sur téléphone, mais j'espère avoir compris et a réussi à t'aider 🙂

  • 0
Posté(e)
il y a 6 minutes, KneaXy a dit :

Bonjour

 

on a right click with a shovel:

    if clicked block is Sand:

        # code habituel

    else if clicked block is <bloc> #ex: grass

        # autre code

 

Désolé je suis sur téléphone, mais j'espère avoir compris et a réussi à t'aider 🙂

Merci mais ce n'est pas ça le problème, il faut que le farming ne fonctionne qu'avec un seul block de sable (donner un nom ou les coordonnées d'où est le block), pas avec n'import lequel.

  • 0
Posté(e)
il y a 21 minutes, Scaffus a dit :

Merci mais ce n'est pas ça le problème, il faut que le farming ne fonctionne qu'avec un seul block de sable (donner un nom ou les coordonnées d'où est le block), pas avec n'import lequel.

Mais du coup je ne comprend pas ...

on rightclick on sand with a shovel:

Lorsque le joueur fait click droit en utilisant une pelle

Où est le problème ? Enfin je t'avoue que j'ai un peu de mal à comprendre 😃 

  • 0
Posté(e)
à l’instant, KneaXy a dit :

Mais du coup je ne comprend pas ...


on rightclick on sand with a shovel:

Lorsque le joueur fait click droit en utilisant une pelle

Où est le problème ? Enfin je t'avoue que j'ai un peu de mal à comprendre 😃 

En gros, je veux que le joueur ne puisse farm du sable qu'a un seul endroit c'est à dire au spawn et pas qu'il puisse farm à n'importe quel endroit où il y a du sable, merci

  • 0
Posté(e)
il y a 5 minutes, Scaffus a dit :

En gros, je veux que le joueur ne puisse farm du sable qu'a un seul endroit c'est à dire au spawn et pas qu'il puisse farm à n'importe quel endroit où il y a du sable, merci

Aaaaaaaaaah, tu peux comparer sa position 🙂
Genre, si ton spawn est en x -50 et z 50, tu fais

if player's x-position > -50:
    if player's z-position < 50:

  • 0
Posté(e)
à l’instant, KneaXy a dit :

Aaaaaaaaaah, tu peux comparer sa position 🙂
Genre, si ton spawn est en x -50 et z 50, tu fais

if player's x-position > -50:
    if player's z-position < 50:

Merci ! et dans un rayon c'est possible ?

 

  • 0
Posté(e)
à l’instant, Scaffus a dit :

Merci ! et dans un rayon c'est possible ?

 

Excellente question xD

  • 0
Posté(e)
à l’instant, Scaffus a dit :

Je vais regarder la doc, merci de ton aide 🙂

Mais pas de soucis ! Avec plaisir 😉 

  • 0
Posté(e)
à l’instant, Scaffus a dit :

Comment je cloture le sujet ?

Ajoute le tag résolu à ton topic 🙂 
Il me semble que tu dois éditer ton sujet et après ajouter le tag "Résolu" 

Invité
Ce sujet ne peut plus recevoir de nouvelles réponses.
×
×
  • 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.