
Lv.1
就让这一切从头开始吧
签名:离线中
在 【代码岛3】SQL教程!去而复返 中回复
//继续改进:
db.sql`CREATE TABLE IF NOT EXISTS pos(
id VARCHAR(16) PRIMARY KEY UNIQUE NOT NULL,
x REAL NOT NULL,
y REAL NOT NULL,
z REAL NOT NULL
)`
const joinPosition = new Box3Vector3(x,y,z);//出生点
world.onPlayerJoin(({entity})=>{
const rows = await db.sql`SELECT * FROM pos WHERE id = ${entity.player.userKey}`;
if(rows && rows.length){
entity.position.copy(joinPosition);
db.sql`INSERT INTO pos VALUES(${entity.player.userKey},0,0,0)`;
}else{
const row = rows[0];
entity.position.set(row.x,row.y,row.z);
}
})
world.onPlayerLeave(({entity})=>{
db.sql`UPDATE pos SET x = ${entity.position.x},y = ${entity.position.y},z = ${entity.position.z} WHERE id = ${entity.player.userKey}`;
})2020-12-28T11:53:20 点赞:0
在 谁会让地图全部方块变为水? 中回复
waterly();
async function waterly(){
for(y=1;y<128;y++){
for(x=0;x<128;x++){
for(x=0;x<128;x++){
voxels.setVoxel(x,y,z,voxels.id('water');
}
}
await sleep(100);
}
}
这段代码,输到控制台里。
2021-01-20T19:24:30 点赞:0
在 az,有大佬在吗???请教一下—— 中回复
world.querySelectorAll('.排行榜').forEach((e)=>{
e.enableInteract = true;
e.interactRadius = 3;
e.interactHint = '排行榜';
e.onInteract(async({entity})=>{
let pkl = ``;
const pks = await db.sql`SELECT * FROM 数据库名称 ORDER BY 判定值名称 DESC LIMIT 100`;
let n = 0;
for(let i in pks){
n += 1;
pkl += `第${n}名:${pks[i].trueName},分数:${pks[i].pkWins}\n`;
}
entity.player.dialog({
type: Box3DialogType.TEXT,
title: '排行榜',
content: pkl,
})
})
})2021-01-21T19:48:02 点赞:0