3 lines
2.8 KiB
Mcfunction
3 lines
2.8 KiB
Mcfunction
#带标签的假玩家#
|
||
script run __command() -> ( help());__config() -> m( l('stay_loaded', true)); global_version = 'Version: 0.0.0-SNAPSHOT-dev.20200109.1737';global_tag = 'carpetBot';global_new_bot = 'newCarpetBot';__check_offline(player_name) ->( if (!(player (player_name)), exit('§4假人'+player_name+'未在线'); '' ); if (!query(player(player_name),'has_tag',global_tag), exit('§4'+player_name+'不是假人'); '' ););__check_online(player_name) ->( if (player(player_name), if (query(player(player_name),'has_tag',global_tag), exit('§4假人'+player_name+'已经在线了'); '' ); exit('§4玩家'+player_name+'已经在线了'); '' ););__check_pos(x) ->( x = number(x); if(x == null, exit('§4请输入正确的坐标'); '' ); return(x));__check_tick(tick) ->( tick = str('%d',number(tick+0.5)); if(tick == null, exit('§4请输入正确的游戏刻间隔'); '' ); if(tick < 2, exit(str('§4整数不能小于2,却发现了%d',tick)); '' ); return(tick));help() ->( print('使用帮助:'); print('/script invoke summon xxx 生成假人'); print('/script invoke kill xxx 删除假人'); print('/script invoke killall 删除全部假人'); print('/script invoke tp xxx x y z 传送假玩家,xyz可替换为\"s\"来代表你的位置'); print(global_version); '');summon(player_name) ->( s_player = player(); player_name = replace(player_name, '\\s',''); __check_online(player_name); run(str('player %s spawn at %f %f %f', player_name, s_player~'x', s_player~'y', s_player~'z')); if (!(player(player_name)), exit('§4生成失败') ); modify(player(player_name), 'tag', global_tag); modify(player(player_name), 'tag', global_new_bot); print('已为'+player_name+'添加标签和队伍'); game_tick(50); modify(player(player_name), 'clear_tag', global_new_bot); '');kill(player_name) ->( player_name = replace(player_name, '\\s',''); __check_offline(player_name); run(str('player %s kill', player_name)); game_tick(50); print('已清除'+player_name); '');killall() ->( i = 0; player_list = player('all'); loop(2147483647,,, one_player = slice(player_list,i,i+1); one_player_str = join('',one_player); if(one_player_str=='', break() ); if(query(player(one_player_str),'has_tag',global_tag), do_fake_player = 1; ); modify(player(one_player_str), 'tag', global_tag_no_bot); run(str('player %s kill', one_player_str)); i = i+1; ); if(do_fake_player != 1, exit('§4不存在假人'); '' ); print('已将全部假人移交§6FZ\'sDataPack§f清除标签'); game_tick(50); print('已清除全部假人'); '');tp(player_name,x,y,z) ->( __check_offline(player_name); s_player = player(); if(x == 's', x = s_player~'x' ); if(y == 's', y = s_player~'y' ); if(z == 's', z = s_player~'z' ); x = __check_pos(x); y = __check_pos(y); z = __check_pos(z); run(str('tp %s %f %f %f', player_name, x, y, z)); '');
|