From a1ddec66c5078f442e0fd88b153498b24e3ac00b Mon Sep 17 00:00:00 2001 From: Mylloon Date: Thu, 1 Jul 2021 03:01:20 +0200 Subject: [PATCH] =?UTF-8?q?ajout=20inventaire=20s=C3=A9par=C3=A9=20entre?= =?UTF-8?q?=20cr=C3=A9a=20et=20survie?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventories.sk | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/inventories.sk b/inventories.sk index 437bb2b..7c1e91d 100644 --- a/inventories.sk +++ b/inventories.sk @@ -1,4 +1,32 @@ +options: + tailleInventaire: 41 # 36 d'inventaire + 4 d'équipement + 1 seconde main + on load: ScriptList("add", script) on unload: ScriptList("remove", script) + +function sauvegardeInventaire(player: player, gamemode: text): + set {_uuid} to uuid of {_player} + set {_count} to 0 + loop {@tailleInventaire} times: + set {inv.%{_uuid}%.%{_gamemode}%::%{_count}%} to slot {_count} of inventory of {_player} + add 1 to {_count} + +function chargementInventaire(player: player, gamemode: text): + set {_uuid} to uuid of {_player} + set {_count} to 0 + clear inventory of {_player} + loop {@tailleInventaire} times: + set slot {_count} of inventory of {_player} to {inv.%{_uuid}%.%{_gamemode}%::%{_count}%} + add 1 to {_count} + +on gamemode change: + if old gamemode of player is survival: + sauvegardeInventaire(player, "survival") + send "&7Changement d'inventaire..." + chargementInventaire(player, "creative") + else if gamemode of player is survival: + sauvegardeInventaire(player, "creative") + send "&7Changement d'inventaire..." + chargementInventaire(player, "survival")