Aller au contenu

Messages recommandés

Posté(e)

Bonjour,  je voudrait un skript assez simple pour les pro je pense.

Je m'explique :

Quand je fait la commande /casino, ca ouvre un menu.

En plein millieu du menu, il y as un papier nommée "Somme a misé".

Quand on clique dessus ca ouvre un enclume, dans la barre ou on peut écrire dans l'enclume on met la somme qu'on veut miser, et quand on rempli la barre, on as juste a cliquer sur le papier pour confirmer le parie,

Quand on as confirmer le parie, sa tire un nombre aléatoire entre 1 et 3, si c'est 1 il à gagné, si c'est 2 & 3 il a perdu

Posté(e)

Voici !!

Enfin j'ai réussi pfiou

Alors il te faut Skript 2.2 ou plus, MundoSk (packets), TuSKe (GUI)

Voici le code (avec un panneau, j'arrive vraiment pas avec l'enclume) :

options:
	# Par combien est multipliée la mise quand on gagne
	multiplier: 10

function signInput(player: player):
	set {casino::usingSign::%{_player}%} to true
	set {_loc} to location of {_player}
	set {_block} to type of block at {_loc}
	set block at {_loc} to sign
	loop {casino::signLines::*}:
		(loop-index parsed as int) < 5
		set line (loop-index parsed as int) of block at {_loc} to colored loop-value
	wait a tick
	set {_packet} to new play_server_open_sign_editor packet
	set location pinfo 0 of {_packet} to {_loc}
	send {_player} packet {_packet}
	set block at {_loc} to {_block}

on packet event play_client_update_sign:
	if {casino::usingSign::%player%} is true:
		set {_lines::*} to string array pinfo 0 of event-packet
		set {casino::usingSign::%player%} to false
		set {_mise} to "%{_lines::1}%"
		set {casino::mise::%player%} to ({_mise} parsed as integer)
		if {_mise} is "cancel" or "exit":
			message "&cTu as quitté le menu !"
			stop
		else if {casino::mise::%player%} is an integer:
			if player's money >= {casino::mise::%player%}:
				remove {casino::mise::%player%} from player's balance
				wait 0.1 second # Obligatoire
				playGui(player)
			else:
				message "&cTu n'as pas assez d'argent !"
		else:
			wait 0.1 second # Obligatoire
			signInput(player)
			message "&cIl faut mettre un nombre ou ""exit"" !"
		stop

on inventory close:
	if name of event-inventory is "&cTirage...":
		if {casino::gui::%player%} is not true:
			add {casino::mise::%player%} to player's balance
			message "&cTirage annulé"
			clear {casino::mise::%player%}


function playGui(p: player):
	open virtual chest inventory with 3 rows named "&cTirage..." to {_p}
	format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with 3 of black stained glass pane named "3"
	wait 1 second
	format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with 2 of black stained glass pane named "2"
	wait 1 second
	format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with black stained glass pane named "1"
	wait 1 second
	format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with black stained glass pane named ""

	set {_lv} to 0
	loop (random integer between 10 and 40) times:
		add 1 to {_lv}
		if {_lv} > 3:
			set {_lv} to 1
		format gui slot 13 of {_p} with {_lv} of paper named "&6&lNombre : &e&l&n%{_lv}%"
		wait 3 ticks

	set {casino::gui::%{_p}%} to true
	if {_lv} is 1:
		open virtual chest inventory with 3 rows named "&aGagné !" to {_p}
		format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with green wool named "&aGagné !"
		add ({casino::mise::%{_p}%} * {@multiplier}) to {_p}'s balance
	else:
		open virtual chest inventory with 3 rows named "&cPerdu..." to {_p}
		format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of {_p} with red wool named "&cPerdu !"
	format gui slot 13 of {_p} with {_lv} of paper named "&6&lNombre : &e&l&n%{_lv}%"
	clear {casino::gui::%{_p}%}
	wait 3 seconds
	close {_p}'s inventory
	clear {casino::mise::%{_p}%}


command /casino:
	trigger:
		clear {casino::mise::%player%}
		open virtual chest inventory with 3 rows named "&cCasino" to player
		format gui slot 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26 of player with black stained glass pane named ""
		format gui slot 13 of player with paper named "&eSomme a miser" to run:
			signInput(player)

on load:
	set {casino::signLines::*} to "", "/\/\/\/\", "Entre ta mise" and "ou ""exit"" !"

on join:
	clear {casino::mise::%player%}

Pas optimisé a max, mais c'est déjà pas mal et ca fonctionne. Enjoy ?

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.