猫史档案馆


#创作节#紧急招人

用户:JYF_斗罗JYF_斗罗查看:4 回复:7 评论:4 创建时间:2021-07-22T19:24:52


现在很需要一名精通的代码师

建筑的话,我主要想建个鸟巢

如果有加入的话,在下方回复,你要代码还是建筑


回复

上一页1 页 / 共 1下一页
JYF_斗罗JYF_斗罗

难道就没有一个知名的代码是会帮我吗?😢

点赞0


评论


Architect_皮卡awaArchitect_皮卡awa

emotion_doge

点赞0


评论


云游box3der尖头叉子云游box3der尖头叉子

emotion_doge

点赞0


评论


快乐猫猫w快乐猫猫w

az

点赞0


评论


望_庐山望_庐山

emotion_doge

点赞0


评论


JYF_斗罗JYF_斗罗

// 查询自己的历史最高分
async function getMyBestTime(player) {

    // 搜索数据
    const rows = await db.sql`SELECT * FROM leaderboard WHERE name=${player} ORDER BY record ASC LIMIT 1`; 

    // 找不到数据
    if (rows && !rows.length) { 
        console.log('还没有比赛记录');
        return null;
    }

    world.say(`${row[0].name} : ${row[0].record}`)
    return rows[0];
}

// 在聊天窗口回复 '1', 查询自己历史最高分
world.onChat(async ({entity:user,message})=>{
    if(message==='1'){
        const personalBest = await getMyBestTime(user.player.name);
        msg = personalBest ? `你的历史最高分是 ${personalBest.record}` : `你还没有比赛记录`
        user.player.directMessage(msg)
    }
});

 

点赞0


评论


VernierVernier

鸟巢……喵 太复杂了那个线条

点赞0


评论