Aller au contenu
  • 0

Ne pas donner l'argent si le joueur n'a pas l'item dans sont inventaire


Question

Posté(e)

Bonjour / Bonsoir, je suis en train de faire un Shop pour un serveur PvP/Faction.

Je me suis rendu compte d'un problème c'est que quand je clique sur vendre ça marche même sans avoir l'item dans sont inventaire.

Donc en gros j'aimerais qu'on puisse pas vendre sans avoir l'item dans l'inventaire.

command /Melon:
   trigger:
       open chest with 1 rows named "&5Melon" to player
       wait 3 ticks
       format slot 4 of player with 16 melon named "&5Achat : 5$ &cVente : 0.2$" to be unstealable
       format slot 0 of player with green stained glass pane named "&5Acheter : 5$" to close then run [make player execute command "/AchatMelon"]
       format slot 1 of player with green stained glass pane named "&5Acheter : 5$" to close then run [make player execute command "/AchatMelon"]
       format slot 2 of player with green stained glass pane named "&5Acheter : 5$" to close then run [make player execute command "/AchatMelon"]
       format slot 3 of player with green stained glass pane named "&5Acheter : 5$" to close then run [make player execute command "/AchatMelon"]
       format slot 5 of player with red stained glass pane named "&cVendre : 0.20$" to close then run [make player execute command "/VenteMelon"]
       format slot 6 of player with red stained glass pane named "&cVendre : 0.20$" to close then run [make player execute command "/VenteMelon"]
       format slot 7 of player with red stained glass pane named "&cVendre : 0.20$" to close then run [make player execute command "/VenteMelon"]
       format slot 8 of player with red stained glass pane named "&cVendre : 0.20$" to close then run [make player execute command "/VenteMelon"]



command /AchatMelon:
   trigger:
       give 16 melon to player
       make player execute command "/eco take %player% 5"

command /VenteMelon:
   trigger:
       remove 16 melon from player's inventory
       make player execute command "/eco give %player% 0.20"


command /shop:
   trigger:
       open chest with 1 rows named "&5Shop" to player
       wait 3 ticks
       format slot 1 of player with 16 melon named "&c&lUn message sera afficher dans le chat clique dessus !" to close then run [make player execute command "/JsonMelon"]
       format slot 0 of player with gray stained glass pane named " " to be unstealable
       format slot 3 of player with 16 Sugar named " &c&lUn message sera afficher dans le chat clique dessus !" to close then run [make player execute command "/JsonSucre"]
       format slot 2 of player with gray stained glass pane named " " to be unstealable
       format slot 4 of player with gray stained glass pane named " " to be unstealable
       format slot 5 of player with 16 cactus named " &c&lUn message sera afficher dans le chat clique dessus !" to close then run [make player execute command "/JsonCactus"]
       format slot 6 of player with gray stained glass pane named " " to be unstealable
command /JsonMelon:
   trigger:
       send json " &cClique ici pour acceder au Shop des Melons ! " styled gray tooltip "Clique ici" run "/Melon" to player

command /JsonSucre:
   trigger:
       send json "&cClique ici pour acceder au Shop des Cannes a sucres !" styled gray tooltip "Clique ici" run "/Sucre" to player

command /JsonCactus:
   trigger:
       send json "&cClique ici pour acceder au Shop des Cactus !" styled gray tooltip "Clique ici" run "/Cactus" to player

command /Sucre:
   trigger:
       open chest with 1 rows named "&5Canne a sucre" to player
       wait 3 ticks
       format slot 4 of player with 16 Sugar canes named "&5Achat : 5$ &cVente : 0.05$" to be unstealable
       format slot 0 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatSucre"]
       format slot 1 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatSucre"]
       format slot 2 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatSucre"]
       format slot 3 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatSucre"]
       format slot 5 of player with red stained glass pane named "&cVendre : 0.05$" to close then run [make player execute command "/VenteSucre"]
       format slot 6 of player with red stained glass pane named "&cVendre : 0.05$" to close then run [make player execute command "/VenteSucre"]
       format slot 7 of player with red stained glass pane named "&cVendre : 0.05$" to close then run [make player execute command "/VenteSucre"]
       format slot 8 of player with red stained glass pane named "&cVendre : 0.05$" to close then run [make player execute command "/VenteSucre"]

command /AchatSucre:
   trigger:
       give 16 Sugar canes to player
       make player execute command "/eco take %player% 10"

command /VenteSucre:
   trigger:
       remove 16 sugar canes from player's inventory
       make player execute command "/eco give %player% 0.05"

command /Cactus:
   trigger:
       open chest with 1 rows named "&5Canne a sucre" to player
       wait 3 ticks
       format slot 4 of player with 16 cactus named "&5Achat : 10$ &cVente : 0.15$" to be unstealable
       format slot 0 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatCactus"]
       format slot 1 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatCactus"]
       format slot 2 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatCactus"]
       format slot 3 of player with green stained glass pane named "&5Acheter : 10$" to close then run [make player execute command "/AchatCactus"]
       format slot 5 of player with red stained glass pane named "&cVendre : 0.15$" to close then run [make player execute command "/VenteCactus"]
       format slot 6 of player with red stained glass pane named "&cVendre : 0.15$" to close then run [make player execute command "/VenteCactus"]
       format slot 7 of player with red stained glass pane named "&cVendre : 0.15$" to close then run [make player execute command "/VenteCactus"]
       format slot 8 of player with red stained glass pane named "&cVendre : 0.15$" to close then run [make player execute command "/VenteCactus"]

command /AchatCactus:
   trigger:
       give 16 cactus to player
       make player execute command "/eco take %player% 10"

command /VenteCactus:
   trigger:
       remove 16 cactus from player's inventory
       make player execute command "/eco give %player% 0.15"





 

Si je n'ai pas été assez claire , veuillez laisser un message .

Merci

4 réponses à cette question

Messages recommandés

  • 0
Posté(e)

Tu dois rajouter ça comme condition :

if player has 16 melon:
   # Evenements
else:
   send "Tu n'as pas 16 melons"

Et aussi remplace:

make player execute command "/eco give %player% 0.20"

Par

add 0.20 to player's balance

Et remplace:

make player execute command "/eco take %player% 5"

Par

remove 5 from player's balance

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