J'en viens à votre aide chers Skripteurs (plutôt les bons :p) pour un Skript, assez gros projet, qui me prend du temps et je bloque donc c'est énervant :/
Je fais donc un "Hôtel des échanges" un peu dans le même principe que les "Hôtel des ventes".
Je dois afficher tous les items en vente dans un GUI et lorsque l'on clique cela vend, pour le vente je l'ai fait dans une fonction avec un ID par vente, tout cela stocké dans une BDD.
Le problème c'est que pour afficher les offres j'utilise une boucle avec un "count" mais pour le "to close the run [le count]" le count n'est plus valable car la boucle est terminée, c'est à dire que le count = à la fin.
C'est dur à comprendre donc si vous avez besoin de précisions n'hésitez pas ;)
(Le problème est dans les "format slot the run" et dans la fonction "changeIt")
function changeIt(changer : player, id : text):
set {_id} to {_id} parsed as integer
send "%{_id}%" to {_changer}
set {_itemP} to the first element out of objects in column "echange_item" from result of query "SELECT echange_item FROM offres_hde WHERE id = '%{_id}%'" and close
set {_numbV} to the first element out of objects in column "item_nombre" from result of query "SELECT item_nombre FROM offres_hde WHERE id = '%{_id}%'" and close
set {_itemV} to the first element out of objects in column "item_vente" from result of query "SELECT item_vente FROM offres_hde WHERE id = '%{_id}%'" and close
set {_numbP} to the first element out of objects in column "echange_nombre" from result of query "SELECT echange_nombre FROM offres_hde WHERE id = '%{_id}%'" and close
send "%{_itemP}% %{_numbV}% %{_itemV}% %{_numbP}%" to {_changer}
if number of {_itemP} in {_changer}'s inventory < {_numbP}:
set {_msgAnnul} to {@NoSuffItems}
replace all "[prix]" in {_msgAnnul} with "%{_itemIdP}%"
broadcast "bite"
annuler({_changer}, "%{_msgAnnul}%")
stop
remove {_numbP} of {_itemP} from {_changer}'s inventory
give {_numbV} of {_itemV} to {_changer}
annuler({_changer}, {@SuccEchange})
command /hde:
trigger:
add objects in column "id" from result of query "SELECT id FROM offres_hde LIMIT 0,45" and close to {_ID::*}
add objects in column "pseudo_vendeur" from result of query "SELECT pseudo_vendeur FROM offres_hde LIMIT 0,45" and close to {_vendeur::*}
add objects in column "item_id" from result of query "SELECT item_id FROM offres_hde LIMIT 0,45" and close to {_idV::*}
add objects in column "item_nombre" from result of query "SELECT item_nombre FROM offres_hde LIMIT 0,45" and close to {_numbV::*}
add objects in column "item_name" from result of query "SELECT item_name FROM offres_hde LIMIT 0,45" and close to {_nameV::*}
add objects in column "item_enchantements" from result of query "SELECT item_enchantements FROM offres_hde LIMIT 0,45" and close to {_enchantV::*}
add objects in column "echange_id" from result of query "SELECT echange_id FROM offres_hde LIMIT 0,45" and close to {_idP::*}
add objects in column "echange_nombre" from result of query "SELECT echange_nombre FROM offres_hde LIMIT 0,45" and close to {_numbP::*}
add objects in column "echange_enchantements" from result of query "SELECT echange_enchantements FROM offres_hde LIMIT 0,45" and close to {_enchantP::*}
open chest with 6 rows named {@NomMenuHDE} to player
format slot 48 of player with egg named "&bVendre" to close then run [send {@VendreMenu}]
format slot 50 of player with stick named "&r%{_nombreOffres}% offres en ventes" to be unstealable
format slot 53 of player with 2 arrows named "&rPage &a2" to be unstealable
set {_count} to 0
set {_count1} to 1
loop 45 times:
if {_idV::%{_count1}%} is not set:
stop
set {_item} to "%{_idV::%{_count1}%}%" parsed as item
set {_itemP} to "%{_idP::%{_count1}%}%" parsed as item
if {_enchantP::%{_count1}%} is "NULL":
set {_enchantsP} to ""
else:
replace all "/" in {_enchantP::%{_count1}%} with "||&7"
set {_enchantsP} to "||&7echanté(e)(s)||&7%{_enchantP::%{_count1}%}%"
if {_nameV::%{_count1}%} is "NULL":
if {_enchantV::%{_count1}%} is "NULL":
format slot {_count} of player with {_numbV::%{_count1}%} of {_item} with lore "||||&eVendu par: &7%{_vendeur::%{_count1}%}%||&eContre: &7%{_numbP::%{_count1}%}% %{_itemP}%%{_enchantsP}%" to close then run [changeIt(player, {_ID::%{_count1}%})]
else:
replace all "/" in {_enchantV::%{_count1}%} with "||&7"
format slot {_count} of player with {_numbV::%{_count1}%} of {_item} with lore "&7%{_enchantV::%{_count1}%}%||||&eVendu par: &7%{_vendeur::%{_count1}%}%||&eContre: &7%{_numbP::%{_count1}%}% %{_itemP}%%{_enchantsP}%" to close then run [changeIt(player, {_ID::%{_count1}%})]
else:
if {_enchantV::%{_count1}%} is "NULL":
format slot {_count} of player with {_numbV::%{_count1}%} of {_item} named "&b&o%{_nameV::%{_count1}%}%" with lore "||||&eVendu par: &7%{_vendeur::%{_count1}%}%||&eContre: &7%{_numbP::%{_count1}%}% %{_itemP}%%{_enchantsP}%" to close then run [changeIt(player, {_ID::%{_count1}%})]
else:
replace all "/" in {_enchantV::%{_count1}%} with "||&7"
format slot {_count} of player with {_numbV::%{_count1}%} of {_item} named "&b&o%{_nameV::%{_count1}%}%" with lore "&7%{_enchantV::%{_count1}%}%||||&eVendu par: &7%{_vendeur::%{_count1}%}%||&eContre: &7%{_numbP::%{_count1}%}% %{_itemP}%%{_enchantsP}%" to close then run [changeIt(player, {_ID::%{_count1}%})]
add 1 to {_count}
add 1 to {_count1}
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
Izychiel
Salut !
J'en viens à votre aide chers Skripteurs (plutôt les bons :p) pour un Skript, assez gros projet, qui me prend du temps et je bloque donc c'est énervant :/
Je fais donc un "Hôtel des échanges" un peu dans le même principe que les "Hôtel des ventes".
Je dois afficher tous les items en vente dans un GUI et lorsque l'on clique cela vend, pour le vente je l'ai fait dans une fonction avec un ID par vente, tout cela stocké dans une BDD.
Le problème c'est que pour afficher les offres j'utilise une boucle avec un "count" mais pour le "to close the run [le count]" le count n'est plus valable car la boucle est terminée, c'est à dire que le count = à la fin.
C'est dur à comprendre donc si vous avez besoin de précisions n'hésitez pas ;)
(Le problème est dans les "format slot the run" et dans la fonction "changeIt")
23 réponses à cette question
Messages recommandés