Hello!
im trying to make skript which will save blocks somewhere and then i can recover it.. its works good.. i made it.. but its saving to variables and there is 1000000 blocks and thats 1000000 variables and skript cant work.. (variables file has 4GB).. so.. where i should save that blocks? i tried to save it to some file but it took very long time to write and server has error "Server stop responding" or "Time out"..so i dont know how to make it.. i need it for minigames to reseting worlds and areas..
my code:
im trying to make skript which will save blocks somewhere and then i can recover it.. its works good.. i made it.. but its saving to variables and there is 1000000 blocks and thats 1000000 variables and skript cant work.. (variables file has 4GB).. so.. where i should save that blocks? i tried to save it to some file but it took very long time to write and server has error "Server stop responding" or "Time out"..so i dont know how to make it.. i need it for minigames to reseting worlds and areas..
my code:
code_language.skript:
function BlockSave(game: text, pos1: location, pos2: location):
set {_blocks} to 0
delete file "plugins\\BlockSaver\\%{_game}%.txt"
wait 1 tick
create file "plugins\\BlockSaver\\%{_game}%.txt"
loop blocks within {_pos1} and {_pos2}:
add 1 to {_blocks}
write "%loop-block%" at line {_blocks} to file "plugins\\BlockSaver\\%{_game}%.txt"
broadcast "q"
wait 1 tick
broadcast "c"
loop all players:
if name of loop-player is "MataxePlay":
send "&8[&cBlockSaver&8] &e%{_blocks}% &bblocks has been saved to &e""plugins\\BlockSaver\\%{_game}%.txt""&b!" to loop-player
stop
function BlockLoad(game: text, pos1: location, pos2: location):
set {_blocks} to 0
loop blocks within {_pos1} and {_pos2}:
add 1 to {_blocks}
set {_text} to file "plugins\\BlockSaver\\%{_game}%.txt"'s line {_blocks}
set loop-block to {_text}
loop all players:
if name of loop-player is "MataxePlay":
send "&8[&cBlockSaver&8] &e%{_blocks}% &bblocks has been restored from &e""plugins\\BlockSaver\\%{_game}%.txt""&b!" to loop-player
stop