Aller au contenu

Messages recommandés

Posté(e)

Version de Minecraft : 1.12.2
Version de Skript : 2.4.1

Type du skript : Skript ./shop (MENU GUI)

Description du script :

Bien le Bonsoir/Bonjour !

J’espère que vous vous portez bien, et que vos proches également.

Je me permet d'écrire sur le Forum de Skript-MC, car j'ai actuellement commencé un Skript de ./shop (boutique d'item pour un PvP/Faction). Or, voila mon soucis, je n'est fais que 4Blocs (image ci-joins) et sa me fais déjâ un skript énorme (Plus de 160 Lignes pour 4blocs !!!) ! J'aimerai donc avoir votre avis ou des conseils, pour réduire celui-ci, des techniques ancestrale que vos maîtres vous on appris !  Pour ma part, si vous voyez quelque chose qui vous fait pouffez de rire dans mes lignes de code, ou qui vous dérange, ne me critiquez pas ! J'ai commencé seul, j'en fais depuis envrion 2 semaines, plus précisément 1 semaine, car la première c'etait beaucoup plus de théorie, apprendre les bases etc.. donc je me répéte, si vous voyez des choses absurdes dite moi simple :

Citation

Bonjour InfinityXx ! J'espère que tu te porte bien, j'ai vu que dans ton code, a la ligne *** tu as écris tel chose, tu peux faire une ligne plus simple ! tien je t'envoie sa tout de suite :

  Ce n'est pas compliqué 🙂 Juste de la politesse ! sur ce, je vous met ci-dessous mon skript, et en pj ce que donne mon menu.



#SHOP


command /shop:
	trigger:
		open chest with 3 rows named "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &e&lShop" to player
		wait 1 ticks
		format slot 0 of player with gray stained glass pane named " " to be unstealable
		format slot 1 of player with yellow stained glass pane named " " to be unstealable
		format slot 2 of player with gray stained glass pane named " " to be unstealable
		format slot 4 of player with glowing diamond chestplate named "&f>> &c&lGrade" to run [make player execute command "/grade"]
		format slot 6 of player with gray stained glass pane named " " to be unstealable
		format slot 7 of player with yellow stained glass pane named " " to be unstealable
		format slot 8 of player with gray stained glass pane named " " to be unstealable
		format slot 9 of player with yellow stained glass pane named " " to be unstealable
		format slot 10 of player with gray stained glass pane named " " to be unstealable
		format slot 11 of player with gold ore named "&f>> &c&lAchat" with lore "" to run [make player execute command "/achat"]
		format slot 15 of player with diamond ore named "&f>> &c&lVente" with lore "" to run [make player execute command "/vente"]
		format slot 16 of player with gray stained glass pane named " " to be unstealable
		format slot 17 of player with yellow stained glass pane named " " to be unstealable
		format slot 18 of player with gray stained glass pane named " " to be unstealable
		format slot 19 of player with yellow stained glass pane named " " to be unstealable
		format slot 20 of player with gray stained glass pane named " " to be unstealable
		format slot 22 of player with glowing bedrock named "&f>> &c&lFermer le menu" to close
		format slot 24 of player with gray stained glass pane named " " to be unstealable
		format slot 25 of player with yellow stained glass pane named " " to be unstealable
		format slot 26 of player with gray stained glass pane named " " to be unstealable


#CATEGORIE ACHAT/VENTE


command /achat:
	trigger:
		open chest with 5 rows named "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &e&lAchat" to player
		wait 2 ticks
		format slot 0 of player with glowing stone named "&f>> &c&lStone" with lore "&f>> &d&l2$/u" to be unstealable
		format slot 9 of player with stone named "&f>> &e&lQuantitié: 1" with lore "&f>> &d&lPrix: 2$" to run [make player execute command "/stone"]
		format slot 18 of player with 16 stone named "&f>> &e&lQuantitié: 16" with lore "&f>> &d&lPrix: 32$" to run [make player execute command "/stone2"]
		format slot 27 of player with 32 stone named "&f>> &e&lQuantitié: 32" with lore "&f>> &d&lPrix: 64$" to run [make player execute command "/stone3"]
		format slot 36 of player with 64 stone named "&f>> &e&lQuantitié: 64" with lore "&f>> &d&lPrix: 128$" to run [make player execute command "/stone4"]
		format slot 1 of player with glowing dirt named "&f>> &c&lDirt" with lore "&f>> &d&l1$/u" to be unstealable
		format slot 10 of player with dirt named "&f>> &e&lQuantitié: 1" with lore "&f>> &d&lPrix: 1$" to run [make player execute command "/dirt"]
		format slot 19 of player with 16 dirt named "&f>> &e&lQuantitié: 16" with lore "&f>> &d&lPrix: 16$" to run [make player execute command "/dirt2"]
		format slot 28 of player with 32 dirt named "&f>> &e&lQuantitié: 32" with lore "&f>> &d&lPrix: 32$" to run [make player execute command "/dirt3"]
		format slot 37 of player with 64 dirt named "&f>> &e&lQuantitié: 64" with lore "&f>> &d&lPrix: 64$" to run [make player execute command "/dirt4"]
		format slot 2 of player with glowing grass block named "&f>> &c&lGrass" with lore "&f>> &d&l2$/u" to be unstealable
		format slot 11 of player with grass block named "&f>> &e&lQuantitié: 1" with lore "&f>> &d&lPrix: 2$" to run [make player execute command "/grass"]
		format slot 20 of player with 16 grass block named "&f>> &e&lQuantitié: 16" with lore "&f>> &d&lPrix: 32$" to run [make player execute command "/grass2"]
		format slot 29 of player with 32 grass block named "&f>> &e&lQuantitié: 32" with lore "&f>> &d&lPrix: 64$" to run [make player execute command "/grass3"]
		format slot 38 of player with 64 grass block named "&f>> &e&lQuantitié: 64" with lore "&f>> &d&lPrix: 128$" to run [make player execute command "/grass4"]
		format slot 3 of player with glowing cobblestone named "&f>> &c&lCobbleStone" with lore "&f>> &d&l0.5$/u" to be unstealable
		format slot 12 of player with cobblestone named "&f>> &e&lQuantitié: 1" with lore "&f>> &d&lPrix: 0.5$" to run [make player execute command "/cobble"]
		format slot 21 of player with 16 cobblestone named "&f>> &e&lQuantitié: 16" with lore "&f>> &d&lPrix: 8$" to run [make player execute command "/cobble2"]
		format slot 30 of player with 32 cobblestone named "&f>> &e&lQuantitié: 32" with lore "&f>> &d&lPrix: 16$" to run [make player execute command "/cobble3"]
		format slot 39 of player with 64 cobblestone named "&f>> &e&lQuantitié: 64" with lore "&f>> &d&lPrix: 32$" to run [make player execute command "/cobble4"]
		
		
command /vente:
	trigger:
		open chest with 5 rows named "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &e&lVente" to player

		
#CATEGORIE ACHAT
#STONE
command /stone:
	trigger:
		if player's balance is bigger than 1.999:
			make server execute command "eco take %player% 2"
			make server execute command "give %player% stone 1"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /stone2:
	trigger:
		if player's balance is bigger than 31.999:
			make server execute command "eco take %player% 32"
			make server execute command "give %player% stone 16"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 		
command /stone3:
	trigger:
		if player's balance is bigger than 63.999:
			make server execute command "eco take %player% 64"
			make server execute command "give %player% stone 32"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /stone4:
	trigger:
		if player's balance is bigger than 127.999:
			make server execute command "eco take %player% 128"
			make server execute command "give %player% stone 64"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 		
#DIRT					
command /dirt:
	trigger:
		if player's balance is bigger than 0.999:
			make server execute command "eco take %player% 1"
			make server execute command "give %player% dirt 1"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /dirt2:
	trigger:
		if player's balance is bigger than 15.999:
			make server execute command "eco take %player% 16"
			make server execute command "give %player% dirt 16"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 		
command /dirt3:
	trigger:
		if player's balance is bigger than 31.999:
			make server execute command "eco take %player% 32"
			make server execute command "give %player% dirt 32"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /dirt4:
	trigger:
		if player's balance is bigger than 63.999:
			make server execute command "eco take %player% 64"
			make server execute command "give %player% dirt 64"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 	
#GRASS
command /grass:
	trigger:
		if player's balance is bigger than 1.999:
			make server execute command "eco take %player% 2"
			make server execute command "give %player% grass 1"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /grass2:
	trigger:
		if player's balance is bigger than 31.999:
			make server execute command "eco take %player% 32"
			make server execute command "give %player% grass 16"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 		
command /grass3:
	trigger:
		if player's balance is bigger than 63.999:
			make server execute command "eco take %player% 64"
			make server execute command "give %player% grass 32"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /grass4:
	trigger:
		if player's balance is bigger than 127.999:
			make server execute command "eco take %player% 128"
			make server execute command "give %player% grass 64"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
#COBBLESTONE
command /cobble:
	trigger:
		if player's balance is bigger than 0.499:
			make server execute command "eco take %player% 0.5"
			make server execute command "give %player% cobble 1"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /cobble2:
	trigger:
		if player's balance is bigger than 7.999:
			make server execute command "eco take %player% 8"
			make server execute command "give %player% cobble 16"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /cobble3:
	trigger:
		if player's balance is bigger than 15.999:
			make server execute command "eco take %player% 16"
			make server execute command "give %player% cobble 32"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 
command /cobble4:
	trigger:
		if player's balance is bigger than 31.999:
			make server execute command "eco take %player% 32"
			make server execute command "give %player% cobble 64"
		else:
			send "&e&k&liii&6&l[&e&lHawkron&6&l]&e&k&liii&r &cTu n'as pas assez d'argent" 

Merci de prendre le temps de me répondre

Cdt InfinityXx

shop.PNG

shop2.PNG

Posté(e)

Salut, j'ai un peu regardé ton code. Il y a de bonnes choses et de moins bonnes. Tout d'abord pour les prix tu peux essayer de comparer avec

if player's balance is greater than or equal to X:

Ensuite pour tes blocs ce que je te conseil c'est de ne pas créer une commande a chaque objet car il y en aura beaucoup trop. En revanche tu peux mettre ton bloc seul et lorsqu'on clic tu as un nouveau menu qui s'ouvre avec les différentes quantités. Et lors du clic tu peux utiliser une commande avec deux arguments qui changeront en fonction du bloc et de la quantité. Comme ça par exemple

command /buy <text> <text>:
  trigger
      if arg 1 is "stone":
          if arg 2 is "16":
              if player's balance is greater than or equal to 32:
            	make server execute command "eco take %player% 32"
            	make server execute command "give %player% cobble 16
  			if arg 2 is "32":
  				etc...
  	   if arg 1 is "grass":
  		  etc...

Ca fait longtemps que j'ai pas fait de skript mais j'espère t'aider 🙂

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