我的世界服务器中玩家间的传送功能

大家好,下面是小编给大家分享的我的世界技巧教程 租赁服务器玩家间传送功能,希望能帮到大家!

萌新学MC不易,请大佬们多多指点。

第一步:要建立几个计分板,并设置计分板初始分数

1、/scoreboard objectives add jinbi dummy金币

/scoreboard players set @a jinbi 100

建立一个“金币”的计分板,并设置初始分数为100(分数可以自定义)

2、/scoreboard objectives add tp trigger传送

/scoreboard players set @a tp 0

建立一个“传送”的计分板,并设置初始值为0

3、/scoreboard objectives add xhtp trigger相互传送

/scoreboard players set @a xhtp 0

建立一个“相互传送”的计分板,并设置初始值为0

第二步:建立传送书

以下是腐竹自己服务器的指令书,偷懒直接copy。

跟今天有关的是其中传送邀请和传送申请指令。

/give @p minecraft:written_book 1 0 {title:"传送书",author:God,pages:[

"{text:\" 铲屎官生活指南\",color:blue,bold:true,extra:[

{text:\"\\n \"},

{text:\"\\n \"},

{text:\"\\n返回主城\",color:dark_green,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 2\"}},

{text:\"\\n \"},

{text:\"\\n生存模式\",color:red,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 1\"}},

{text:\"\ 随机传送\",color:dark_purple,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 3\"}},

{text:\"\\n \"},

{text:\"\\n传送邀请\",color:dark_aqua,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 99\"}},

{text:\"\ 传送申请\",color:green,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 98\"}},

{text:\"\\n \"},

{text:\"\\n喵神博彩\",color:light_purple,bold:true,clickEvent:{action:run_command,value:\"/trigger tp set 4\"}},

{text:\"\\n \"},

{text:\"\\n \"},

{text:\"\\n其他设施陆续更新中。。\",color:gray,bold:true}

]}"

]}

第三步:命令方块

最开始需要设置以下两个单独的循环开启的命令方块

1、/scoreboard players enable @a tp

允许玩家执行tp触发器

2、/scoreboard players enable @a xhtp

允许玩家执行xhtp触发器

1、传送邀请

方块序列1:

/testfor @p[score_tp_min=99,score_tp=99,score_jinbi_min=100,c=1]

检测一个tp分数为99、且金币大于等于100的玩家【循环 开启】

/tellraw @a {"text":"","extra":[

{"text":"【系统公告】","color":"red"},

{"text":"\n ","color":"red"},{"selector":"@p[score_tp=99,score_tp_min=99,c=1]"},{"text":"发起了传送邀请","color":"dark_aqua"},

{"text":"\n 传送费用","color":"dark_aqua","bold":"true"},{"text":"100金币","color":"yellow","bold":"true"},

{"text":"\n 想前往的玩家请点击以下链接","color":"dark_aqua","hold":"true"},

{"text":"\n 接受传送邀请","color":"green","underlined":"true","clickEvent":{"action":"run_command","value":"/trigger xhtp set 1"}}]}

命令执行后如上图 【连锁 条件 开启】

/scoreboard players remove @p[score_tp_min=99,score_tp=99,c=1] jinbi 100

扣除发起邀请玩家100金币【连锁 条件 开启】

/scoreboard players set @p[score_tp=99,score_tp_min=99,c=1] xhtp 2

设置发起邀请的玩家xhtp分数设置为2【连锁 条件 开启】

/scoreboard players set @a tp 0

设置所有玩家tp分数初始化【连锁 条件 开启】

方块序列2:

testfor @p[score_xhtp=1,score_xhtp_min=1,score_jinbi_min=100,c=1]

检测xhtp分数为1,金币大于等于100的玩家 【循环 开启】

/tp @p[score_xhtp=1,score_xhtp_min=1,c=1] @p[score_xhtp=2,score_xhtp_min=2,c=1]

把xhtp分数为1的玩家传送到xhtp分数为2的玩家身边【连锁 条件 开启】

/scoreboard players remove @p[score_xhtp=1,score_xhtp_min=1] jinbi 100

扣除接受传送邀请的玩家100金币【连锁 条件 开启】

/tellraw @a {"text":"","extra":[

{"text":"【系统公告】","color":"red"},

{"text":"\n ","color":"red"},

{"selector":"@p[score_xhtp=1,score_xhtp_min=1,c=1]"},{"text":"接受了","color":"dark_aqua"},{"selector":"@p[score_xhtp=2,score_xhtp_min=2,c=1]"},{"text":"的传送邀请","color":"dark_aqua","bold":"true"},

{"text":"\n 传送费用","color":"dark_aqua","bold":"true"},{"text":"100金币","color":"gold","bold":"true"}]}

命令执行后如上图 【连锁 条件 开启】

/scoreboard players set @a xhtp 0

初始化所有玩家的xhtp分数

以上是传送邀请全部指令,原理是:

发起邀请的玩家执行指令书上的指令后,通过命令方块赋予自身xhtp分数为2,并把xhtp分数为1的触发器体现在聊天栏上

接受邀请的玩家,只要点击聊天上的链接,命令方块就会赋予该玩家一个xhtp分数为1,

之后通过/tp命令进行传送。

2、传送申请

传送申请和邀请传送的原理一样,不再赘述,命令方块如下:

方块序列1:

/testfor @p[score_tp_min=98,score_tp=98,score_jinbi_min=100,c=1]

【循环 开启】

/tellraw @a {"text":"","extra":[

{"text":"【系统公告】","color":"red"},{"text":"\n ","color":"red"},

{"selector":"@p[score_tp=98,score_tp_min=98,c=1]"},{"text":"发起了传送申请","color":"dark_aqua"},

{"text":"\n 传送费用","color":"dark_aqua","bold":"true"},{"text":"100金币","color":"yellow","bold":"true"},

{"text":"\n 同意他传送至你身边请点击以下链接","color":"dark_aqua","hold":"true"},

{"text":"\n 同意传送申请","color":"green","underlined":"true","clickEvent":{"action":"run_command","value":"/trigger xhtp set 3"}}]}

【连锁 条件 开启】

/scoreboard players remove @p[score_tp_min=98,score_tp=98,c=1] jinbi 100

【连锁 条件 开启】

/scoreboard players set @p[score_tp=98,score_tp_min=98,c=1] xhtp 4

【连锁 条件 开启】

/scoreboard players set @a tp 0

【连锁 条件 开启】

方块序列2:

testfor @a[score_xhtp=3,score_xhtp_min=3,score_jinbi_min=100,c=1]

【循环 开启】

/tp @p[score_xhtp=4,score_xhtp_min=4,c=1] @p[score_xhtp=3,score_xhtp_min=3,c=1]

【连锁 条件 开启】

/scoreboard players remove @p[score_xhtp=3,score_xhtp_min=3] jinbi 100

【连锁 条件 开启】

/tellraw @a {"text":"","extra":[

{"text":"【系统公告】","color":"red"},

{"text":"\n ","color":"red"},

{"selector":"@p[score_xhtp=3,score_xhtp_min=3,c=1]"},{"text":"同意了","color":"dark_aqua"},{"selector":"@p[score_xhtp=4,score_xhtp_min=4,c=1]"},{"text":"的传送申请","color":"dark_aqua","bold":"true"},

{"text":"\n 传送费用","color":"dark_aqua","bold":"true"},{"text":"100金币","color":"gold","bold":"true"}]}

【连锁 条件 开启】

/scoreboard players set @a xhtp 0

【连锁 条件 开启】

以上,就是玩家间相互传送功能分享,有更简单的也可以告诉我哦。

发表评论

您必须 登录 才能发表留言!