用户:Fliere_tammy查看:276 回复:10 评论:10 创建时间:2020-06-02T12:32:57
1.pvp代码
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true;
entity.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
if (button !== 'action0' || !hitEntity) {
return;
}
hitEntity.velocity.x += direction.x;
hitEntity.velocity.y += 0.5;
hitEntity.velocity.z += direction.z;
hitEntity.hurt(20 * Math.random() + 5, {
attacker: entity,
});
});
});
world.onDie(({ entity, attacker }) => {
if (attacker) {
world.say(attacker.player.name + ' killed ' + entity.player.name)
}
entity.player.forceRespawn();
});
2.$执行代码
world.onChat(({entity,message})=>{
if(entity&&['管喵名字'].indexOf(entity.player.name)!=-1&&message.charAt(0)=='$'){
try{
world.say('<~ '+eval(message.split('$')[1]))}catch(err){
world.say('Error:'+err)
}
};
3.回血代码
world.onPress(({button,entity})=>{
if(button=='crouch'){
if(entity.hp>=300){
return;
}
entity.hp+=10;
}
})
4.发光代码
world.querySelectorAll('player').forEach((x) => {if (x.player.name == "Tammy_fliere_小号") {x.player.emissive = 2}});
5.玩家的大小
world.querySelectorAll('player').forEach((x) => {if (x.player.name == "Tammy_fliere_小号") {x.player.scale = 20}})
4.5.3.都是可以改数值的
抄代码也得抄个样子啊,特别是PVP我还以为有大佬也会做防止打飞的代码,没想到里面我全都会……而且全部都不是原创……要点脸行吗
点赞1
评论
..............老子自己弄了半天才黑化,你就这样跟老子说?
第一个开发API里面的,纯抄,第二,三,四,五个都是抄大佬的没错吧?
去掉注释我就看不出来了?
不是,是某人帮我写的
……那不就是