restore_scores 1.4.0

This commit is contained in:
延皓
2021-08-05 20:49:51 +08:00
parent 4d7dbe3805
commit 87ac15a68d
+11 -3
View File
@@ -1,4 +1,4 @@
global_version = '1.2.0'; global_version = '1.4.0';
__config() -> { __config() -> {
'scope' -> 'global', 'scope' -> 'global',
'stay_loaded' -> false 'stay_loaded' -> false
@@ -147,9 +147,13 @@ __restore(pl) ->(
total_killed = 0; total_killed = 0;
total_traded = 0; total_traded = 0;
total_hurt = 0; total_hurt = 0;
failed_list = [];
c_for(i = 0, i < length(pl), i += 1, c_for(i = 0, i < length(pl), i += 1,
run('player ' + pl:i + ' spawn'); run('player ' + pl:i + ' spawn');
game_tick(50); game_tick(50);
if(player(pl:i) != pl:i,
put(failed_list, length(failed_list), pl:i);
);
//滑翔距离 //滑翔距离
//mc会统计多一倍的数据所以除以200 //mc会统计多一倍的数据所以除以200
aviate = statistic(pl:i, 'custom', 'aviate_one_cm')/200; aviate = statistic(pl:i, 'custom', 'aviate_one_cm')/200;
@@ -214,12 +218,16 @@ __restore(pl) ->(
scoreboard('fz.aviate1m', '总滑翔距离', total_aviate); scoreboard('fz.aviate1m', '总滑翔距离', total_aviate);
scoreboard('totalList', '总滑翔距离', total_aviate); scoreboard('totalList', '总滑翔距离', total_aviate);
game_tick(50); game_tick(50);
run('function fz:scoreboards/install') run('function fz:scoreboards/install');
return(failed_list);
); );
by_whitelist() ->( by_whitelist() ->(
pl = keys(system_info('server_whitelist')); pl = keys(system_info('server_whitelist'));
game_tick(50); game_tick(50);
__restore(pl); failed_list = __restore(pl);
if(failed_list != [],
print(' : ( 这些玩家恢复失败了:' + failed_list);
);
print('完成!'); print('完成!');
return() return()
) )