检测玩家ID - 5m到js



你好我在javascript语言开发一个机器人,但我不知道如何检测加入服务器的人的玩家id,请提供任何帮助这是我的代码

on('playerConnecting', async(name, setKickReason, deferrals) => {
const chann = client.channels.cache.get("room id")
const guild = client.guilds.cache.get("serverid");
deferrals.defer()
deferrals.update("message")
const player = global.source;
let discord = "**undefined**";
let steam = "**undefined**";
let fivem = "**undefined**";
let ip = "**undefined**";
let license = "**undefined**";
for (let i = 0; i < GetNumPlayerIdentifiers(player); i++) {
const identifier = GetPlayerIdentifier(player, i);
if (identifier.includes('discord:')) {
discord = identifier
} else if(identifier.includes('steam:')) {
steam = identifier
} else if(identifier.includes('fivem:')) {
fivem = identifier
} else if(identifier.includes("ip:")) {
ip = identifier;
}else if(identifier.includes("license:")) {
license = identifier;
}
}
setTimeout(async() => {
discord = discord.split('discord:').pop()
steam = steam.split('steam:').pop()
ip = ip.split('ip:').pop()
license = license.split('license:').pop()
fivem = fivem.split('fivem:').pop()
let pingg = GetPlayerPing(player)
let embed= new MessageEmbed()
.setColor("RED")
.addField(`**Default Name**`,`**${name}**`)
.addField(`**Steam Name**`,`**${steam}**`)
.addField(`**FiveM Name**`,`**${fivem}**`)
.addField(`**Discord Name**`,`<@${discord}>`)
.addField(`**Discord id**`,`**${discord}**`)
.addField(`**IP**`,`**${ip}**`)
.addField(`**License**`,`**${license}**`)
.addField(`**Ping**`,`**${pingg}**`)
.addField(`**player-id**`,`**${player.id}**`)
.setFooter(guild.name)
.setTimestamp()
let mes = await chann.send(embed)

我试图把[播放器。

本地命令被映射到全局JavaScript函数,其名称类似于每个FiveM本地文档的Lua本地映射

因此,您应该能够像使用其他本机(GetPlayerPing,GetPlayerIdentifier等)一样使用本机GetPlayerServerId

.addField(`**player-id**`,`**${GetPlayerServerId(player)}**`)

你可以在文档中看到JS和Lua的所有本机。

相关内容

  • 没有找到相关文章

最新更新