猫史档案馆


【教程】好用而不常见的管喵代码1——禁足

用户:萌新大佬萌新大佬查看:8 回复:10 评论:8 创建时间:2022-05-10T10:24:25


直接上代码,看不懂评论区里问。

const VIP_Player=['萌新大佬'];//自己改
world.onChat(({entity,message})=>{
    if(!VIP_Player.includes(entity.player.name))return;
    if(!message.startsWith('禁足')||!message.startsWith('解禁'))
    var other=world.querySelectorAll('player').find((e)=>e.player.name==message.slice(2));
    if(!other||other==null){
        entity.player.directMessage('此人不存在');
        return;
    }
    if(message.startsWith('禁足')){
        if(other.canMove==false){
            entity.player.directMessage('此人已禁足');
            return;
        }
        other.player.directMessage('你被禁足了!');
        entity.player.directMessage('禁足成功');
        other.moveArg={
            walkSpeed:other.player.walkSpeed,
            walkAcceleration:other.player.walkAcceleration,
            runSpeed:other.player.runSpeed,
            runAcceleration:other.player.runAcceleration,
            crouchSpeed:other.player.crouchSpeed,
            crouchAcceleration:other.player.crouchAcceleration,
            enableJump:other.player.enableJump,
            enableDoubleJump:other.player.enableDoubleJump
        };
        other.player.walkSpeed=
        other.player.walkAcceleration=
        other.player.runSpeed=
        other.player.runAcceleration=
        other.player.crouchSpeed=
        other.player.crouchAcceleration=
        0;
        other.player.enableJump=
        other.player.enableDoubleJump=
        false;
        other.canMove=false;
    }else if(message.startsWith('解禁')){
        if(other.canMove==true||other.canMove==null){
            entity.player.directMessage('此人还未禁足或已被解禁');
            return;
        }
        other.player.directMessage('你被解禁了!');
        entity.player.directMessage('解禁成功');
        Object.assign(other.player,other.moveArg);
        other.canMove=true;
    }
})


回复

上一页1 页 / 共 1下一页
萌新大佬萌新大佬

ddddd

点赞0


评论


萌新大佬萌新大佬

关于现在没人喜欢教程贴了这事

点赞0


评论


ZNS_哪吒ZNS_哪吒

ddd

点赞0


评论


灵清帝王吃爆一切厕所灵清帝王吃爆一切厕所

这样好像更简单():

const admin = ['一剑走天下'];
world.onChat(async({ entity , message }) => {
    if(admin.includes(entity.player.name)) {
        if(message.startsWith('禁足')) {
            world.querySelectorAll('player').forEach(async( user ) => {
                if(user.player.name == message.slice(2)) {
                    if(user.player.disableInputDirection == Box3InputDirection.NONE) {
                        user.player.disableInputDirection = Box3InputDirection.BOTH;
                        user.player.jumpPower = 0;
                        entity.player.directMessage(`${user.player.name}已被禁足`);
                        user.player.directMessage(`你被禁足了!`)
                    }else {
                        entity.player.directMessage('此人已被禁足!')
                    }
                }else {
                    entity.player.directMessage('此人不在地图内!')
                }
            })
        }
        if(message.startsWith('解除禁足')) {
            world.querySelectorAll('player').forEach(async( user ) => {
                if(user.player.name == message.slice(4)) {
                    if(user.player.disableInputDirection == Box3InputDirection.BOTH) {
                        user.player.disableInputDirection = Box3InputDirection.NONE;
                        user.player.jumpPower = 0.96;
                        entity.player.directMessage(`${user.player.name}已解除禁足`);
                        user.player.directMessage(`你被解除禁足了!`)
                    }else {
                        entity.player.directMessage('此人已被解除禁足!')
                    }
                }else {
                    entity.player.directMessage('此人不在地图内!')
                }
            })
        }
    }
})

点赞0


评论


超级大帅哥本人超级大帅哥本人

so what is this ?

点赞0


评论


萌新大佬萌新大佬

ddd

 

点赞0


评论


银狐残影银狐残影

const VIP_Player=['萌新大佬'];//自己改
world.onChat(({entity,message})=>{
    if(!VIP_Player.includes(entity.player.name))return;
    if(!message.startsWith('禁足')||!message.startsWith('解禁'))
    var other=world.querySelectorAll('player').find((e)=>e.player.name==message.slice(2));
    if(!other||other==null){
        entity.player.directMessage('此人不存在');
        return;
    }
    if(message.startsWith('禁足')){
        if(other.canMove==false){
            entity.player.directMessage('此人已禁足');
            return;
        }
        other.player.directMessage('你被禁足了!');
        entity.player.directMessage('禁足成功');
        other.moveArg={
            walkSpeed:other.player.walkSpeed,
            walkAcceleration:other.player.walkAcceleration,
            runSpeed:other.player.runSpeed,
            runAcceleration:other.player.runAcceleration,
            crouchSpeed:other.player.crouchSpeed,
            crouchAcceleration:other.player.crouchAcceleration,
            enableJump:other.player.enableJump,
            enableDoubleJump:other.player.enableDoubleJump
        };
        other.player.walkSpeed=
        other.player.walkAcceleration=
        other.player.runSpeed=
        other.player.runAcceleration=
        other.player.crouchSpeed=
        other.player.crouchAcceleration=
        0;
        other.player.enableJump=
        other.player.enableDoubleJump=
        false;
        other.canMove=false;
    }else if(message.startsWith('解禁')){
        if(other.canMove==true||other.canMove==null){
            entity.player.directMessage('此人还未禁足或已被解禁');
            return;
        }
        other.player.directMessage('你被解禁了!');
        entity.player.directMessage('解禁成功');
        Object.assign(other.player,other.moveArg);
        other.canMove=true;
    }
})

点赞0


评论


༿༺闪ོ༒电ོ༻༾༿༺闪ོ༒电ོ༻༾

大佬怎么做才能禁足不然啊

点赞0


评论


༿༺闪ོ༒电ོ༻༾༿༺闪ོ༒电ོ༻༾

比如按什么,说什么

点赞0


评论


ikun鸡你太美森森团队成员ikun鸡你太美森森团队成员

这也不行啊()(

禁足代码:

entity.player.disableInputDirection=Box3InputDirection.BOTH

恢复代码:

entity.player.disableInputDirection=Box3InputDirection.NONE

很简单…………

点赞0


评论