2021-07-01 03:01:20 +02:00
|
|
|
options:
|
2021-07-01 03:12:41 +02:00
|
|
|
tailleInventaire: 41 # 37 d'inventaire + 4 d'équipement + 1 seconde main
|
|
|
|
messageChangement: "&7Changement d'inventaire..."
|
2021-07-01 03:01:20 +02:00
|
|
|
|
2021-06-30 21:58:41 +02:00
|
|
|
on load:
|
|
|
|
ScriptList("add", script)
|
|
|
|
on unload:
|
|
|
|
ScriptList("remove", script)
|
2021-07-01 03:01:20 +02:00
|
|
|
|
|
|
|
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:
|
2021-07-01 03:12:41 +02:00
|
|
|
sauvegardeInventaire(player, "%old gamemode of player%")
|
|
|
|
send {@messageChangement}
|
2021-07-01 03:01:20 +02:00
|
|
|
chargementInventaire(player, "creative")
|
|
|
|
else if gamemode of player is survival:
|
|
|
|
sauvegardeInventaire(player, "creative")
|
2021-07-01 03:12:41 +02:00
|
|
|
send {@messageChangement}
|
|
|
|
chargementInventaire(player, "%gamemode of player%")
|