BIG FIX now its working
This commit is contained in:
parent
dcccf9ed31
commit
a987a30479
1 changed files with 19 additions and 6 deletions
|
@ -1,37 +1,50 @@
|
||||||
options:
|
options:
|
||||||
tailleInventaire: 41 # 36 d'inventaire + 4 d'équipement + 1 seconde main
|
tailleInventaire: 41 # 36 d'inventaire + 4 d'équipement + 1 seconde main
|
||||||
messagePreChangement: "&7Changement d'inventaire..."
|
messagePreChangement: "&7Changement d'inventaire..."
|
||||||
messagePostChargement: "&7&l%{_n1}%&7 item sauvegardés et &l%{_n2}%&7 chargés."
|
messagePostChargement: "&7&l%{_n1}%&7 objet%{_pluriel1}%&7 sauvegardé%{_pluriel1}%&7 et &l%{_n2}%&7 objet%{_pluriel2}%&7 chargé%{_pluriel2}%."
|
||||||
|
|
||||||
on load:
|
on load:
|
||||||
ScriptList("add", script)
|
ScriptList("add", script)
|
||||||
on unload:
|
on unload:
|
||||||
ScriptList("remove", script)
|
ScriptList("remove", script)
|
||||||
|
|
||||||
|
function isItem(item: text) :: boolean:
|
||||||
|
if "%{_item}%" is "<none>" or "air" or "0 air": # air quand inventaire vide, 0 air quand main gauche vide et <none> quand équipement vide
|
||||||
|
return false
|
||||||
|
return true
|
||||||
|
|
||||||
function inventaire(mode: text, player: player, gamemode: text) :: number:
|
function inventaire(mode: text, player: player, gamemode: text) :: number:
|
||||||
set {_uuid} to uuid of {_player}
|
set {_uuid} to uuid of {_player}
|
||||||
set {_count} and {_nombreItems} to 0
|
set {_count} and {_nombreItems} to 0
|
||||||
if {_mode} is "chargement":
|
if {_mode} is "chargement":
|
||||||
clear inventory of {_player}
|
clear inventory of {_player}
|
||||||
loop {@tailleInventaire} times:
|
loop {@tailleInventaire} times:
|
||||||
set {_item} to slot {_count} of inventory of {_player}
|
|
||||||
if {_mode} is "chargement":
|
if {_mode} is "chargement":
|
||||||
set {_item} to {inv.%{_uuid}%.%{_gamemode}%::%{_count}%}
|
set {_item} to {inv.%{_uuid}%.%{_gamemode}%::%{_count}%}
|
||||||
|
set slot {_count} of inventory of {_player} to {_item}
|
||||||
|
if isItem("%{_item}%") is true:
|
||||||
|
add 1 to {_nombreItems}
|
||||||
else if {_mode} is "sauvegarde":
|
else if {_mode} is "sauvegarde":
|
||||||
|
delete {inv.%{_uuid}%.%{_gamemode}%::%{_count}%}
|
||||||
|
set {_item} to slot {_count} of inventory of {_player}
|
||||||
set {inv.%{_uuid}%.%{_gamemode}%::%{_count}%} to {_item}
|
set {inv.%{_uuid}%.%{_gamemode}%::%{_count}%} to {_item}
|
||||||
|
if isItem("%{_item}%") is true:
|
||||||
|
add 1 to {_nombreItems}
|
||||||
add 1 to {_count}
|
add 1 to {_count}
|
||||||
if "%{_item}%" is not "<none>" or "air" or "0 air":
|
|
||||||
add 1 to {_nombreItems}
|
|
||||||
return {_nombreItems}
|
return {_nombreItems}
|
||||||
|
|
||||||
on gamemode change:
|
on gamemode change:
|
||||||
if old gamemode of player is survival:
|
if old gamemode of player is survival:
|
||||||
set {_n1} to inventaire("sauvegarde", player, "%old gamemode of player%")
|
set {_n1} to inventaire("sauvegarde", player, "survival")
|
||||||
|
set {_pluriel1} to pluriel({_n1})
|
||||||
send {@messagePreChangement}
|
send {@messagePreChangement}
|
||||||
set {_n2} to inventaire("chargement", player, "creative")
|
set {_n2} to inventaire("chargement", player, "creative")
|
||||||
|
set {_pluriel2} to pluriel({_n2})
|
||||||
send {@messagePostChargement}
|
send {@messagePostChargement}
|
||||||
else if gamemode of player is survival:
|
else if gamemode of player is survival:
|
||||||
set {_n1} to inventaire("sauvegarde", player, "creative")
|
set {_n1} to inventaire("sauvegarde", player, "creative")
|
||||||
|
set {_pluriel1} to pluriel({_n1})
|
||||||
send {@messagePreChangement}
|
send {@messagePreChangement}
|
||||||
set {_n2} to inventaire("chargement", player, "%gamemode of player%")
|
set {_n2} to inventaire("chargement", player, "survival")
|
||||||
|
set {_pluriel2} to pluriel({_n2})
|
||||||
send {@messagePostChargement}
|
send {@messagePostChargement}
|
||||||
|
|
Loading…
Reference in a new issue