C'est un script d'hôtel de vente (rien de plus basique), un joueur met en vente un objet un autre joueur peut l'acheter. Si le joueur qui à mit en vente son objet souhaite le récupérer il peut en cliquant sur l'objet.
Sauf que dans un hôtel de vente on n'a des pages (1,2,3 ...) suivant le nombres d'articles mit en vente. Néanmoins dans mon script je peux allé à la page 10 (voir +) or que la page 1 n'est pas complétée à 100%.
Comment régler ce soucis ?
function guihdv(p: player, page: number):
set {_startpage} to {_page}*36
set {_i} to 1
set {_slot} to 0
set {_id} to 1
open virtual chest inventory with size 6 named "&7» &6Hôtel des ventes &e##%{_page}%" to {_p}
# Blanc
make a gui slot 36 of {_p} with stained glass pane:0 named " " to do nothing
make a gui slot 38 of {_p} with stained glass pane:0 named " " to do nothing
make a gui slot 40 of {_p} with stained glass pane:0 named " " to do nothing
make a gui slot 42 of {_p} with stained glass pane:0 named " " to do nothing
make a gui slot 44 of {_p} with stained glass pane:0 named " " to do nothing
# Cyan
make a gui slot 37 of {_p} with red stained glass pane named " " to do nothing
make a gui slot 39 of {_p} with red stained glass pane named " " to do nothing
make a gui slot 41 of {_p} with red stained glass pane named " " to do nothing
make a gui slot 43 of {_p} with red stained glass pane named " " to do nothing
if {_page} = 0:
make a gui slot 48 of {_p} with paper named "&7<--" to do nothing
else:
make a gui slot 48 of {_p} with paper named "&7<--" to run function guihdv({_p}, ({_page} - 1))
make a gui slot 49 of {_p} with sunflower named "&6Rafraîchir" to run function guihdv({_p}, {_page})
make a gui slot 50 of {_p} with paper named "&7-->" to run function guihdv({_p}, ({_page} + 1))
wait 1 ticks
loop {hdv.item::*}:
if loop-index parsed as a number > {_startpage}:
if {hdv.name::%loop-index%} is "%{_p}%":
make a gui slot {_slot} of {_p} with {hdv.item::%loop-index%} with lore "&7ID: &6%{_id}%||&7Prix: &6%{hdv.prix::%loop-index%}% &eSC||&7Vendeur: &6%{hdv.name::%loop-index%}%||||&aClique ici pour retirer l'objet." to close then run function remove({_p}, loop-index)
add 1 to {_slot}
add 1 to {_id}
else:
make a gui slot {_slot} of {_p} with {hdv.item::%loop-index%} with lore "&7ID: &6%{_id}%||&7Prix: &6%{hdv.prix::%loop-index%}% &eSC||&7Vendeur: &6%{hdv.name::%loop-index%}%" to close then run function buy({_p}, "%{hdv.name::%loop-index%}%", loop-index)
add 1 to {_slot}
add 1 to {_id}
if {_slot} = (36*{_i}):
exit loop
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.
Question
Nouz
Version de Minecraft : 1.8.9
Version de Skript : 2.2-dev36
Addons utilisés: MundoSk, WildSkript, skUtilitites, SkQuery, skript-mirror, Skelett, skript-yaml, skrayfall, tuske
Type du skript : Hôtel de Vente
Description du script :
C'est un script d'hôtel de vente (rien de plus basique), un joueur met en vente un objet un autre joueur peut l'acheter. Si le joueur qui à mit en vente son objet souhaite le récupérer il peut en cliquant sur l'objet.
Sauf que dans un hôtel de vente on n'a des pages (1,2,3 ...) suivant le nombres d'articles mit en vente. Néanmoins dans mon script je peux allé à la page 10 (voir +) or que la page 1 n'est pas complétée à 100%.
Comment régler ce soucis ?
function guihdv(p: player, page: number): set {_startpage} to {_page}*36 set {_i} to 1 set {_slot} to 0 set {_id} to 1 open virtual chest inventory with size 6 named "&7» &6Hôtel des ventes &e##%{_page}%" to {_p} # Blanc make a gui slot 36 of {_p} with stained glass pane:0 named " " to do nothing make a gui slot 38 of {_p} with stained glass pane:0 named " " to do nothing make a gui slot 40 of {_p} with stained glass pane:0 named " " to do nothing make a gui slot 42 of {_p} with stained glass pane:0 named " " to do nothing make a gui slot 44 of {_p} with stained glass pane:0 named " " to do nothing # Cyan make a gui slot 37 of {_p} with red stained glass pane named " " to do nothing make a gui slot 39 of {_p} with red stained glass pane named " " to do nothing make a gui slot 41 of {_p} with red stained glass pane named " " to do nothing make a gui slot 43 of {_p} with red stained glass pane named " " to do nothing if {_page} = 0: make a gui slot 48 of {_p} with paper named "&7<--" to do nothing else: make a gui slot 48 of {_p} with paper named "&7<--" to run function guihdv({_p}, ({_page} - 1)) make a gui slot 49 of {_p} with sunflower named "&6Rafraîchir" to run function guihdv({_p}, {_page}) make a gui slot 50 of {_p} with paper named "&7-->" to run function guihdv({_p}, ({_page} + 1)) wait 1 ticks loop {hdv.item::*}: if loop-index parsed as a number > {_startpage}: if {hdv.name::%loop-index%} is "%{_p}%": make a gui slot {_slot} of {_p} with {hdv.item::%loop-index%} with lore "&7ID: &6%{_id}%||&7Prix: &6%{hdv.prix::%loop-index%}% &eSC||&7Vendeur: &6%{hdv.name::%loop-index%}%||||&aClique ici pour retirer l'objet." to close then run function remove({_p}, loop-index) add 1 to {_slot} add 1 to {_id} else: make a gui slot {_slot} of {_p} with {hdv.item::%loop-index%} with lore "&7ID: &6%{_id}%||&7Prix: &6%{hdv.prix::%loop-index%}% &eSC||&7Vendeur: &6%{hdv.name::%loop-index%}%" to close then run function buy({_p}, "%{hdv.name::%loop-index%}%", loop-index) add 1 to {_slot} add 1 to {_id} if {_slot} = (36*{_i}): exit loop
Voilà la fonction du GUI de l'hôtel de vente.
5 réponses à cette question
Messages recommandés