#how to see other players stats

1 messages · Page 1 of 1 (latest)

queen frost
#
    const sender = event.sender
    if (event.message.startsWith(cmdPrefix)) {
        const commands = event.message.substring(cmdPrefix.length).replace(/@"/g, "\"")
        const args = commands.match(/[\""].+?[\""]|[^ ]+/g) // Split the command into arguments, keeping quoted strings together
        if (args === null) return
        event.cancel = true
        switch (args[0]) {

            case 'help': {
                switch (args[1]) {
                    // DO NOT PUT ANYTHING HERE
                }
                // Sends the nickname the player set to a fuction
                sender.sendMessage([
                    `\n     Custom Commands         `,
                    `\n--------------------------`,
                    `\n\n-Stats "playerName" : Showes the players stats even offline people`
                ])
            }
            case 'stats': {
                switch (args[1]) {
                    // DO NOT PUT ANYTHING HERE
                }
                function showForm(sender) {
                    system.run(() => {
                        {
                            const deaths = (deathsDB.read(args[1].replace("_", " ")))
                            const kills = (killsDB.read(args[1].replace("_", " ")))
                            let kdr = deaths !== 0 ? kills / deaths : (kills !== 0 ? Infinity : 0);
                            kdr = kdr === Infinity ? kills : kdr;
                            const stats = new ActionFormData()
                                .title("Stats")
                                .body(
                                    `§cMoney§f: §4$§c${moneyDB.read(args[1].replace("_", " "))}` +
                                    `\n§cKills§f: §c${killsDB.read(args[1].replace("_", " "))}` +
                                    `\n§cDeaths§f: §c${deathsDB.read(args[1].replace("_", " "))}` +
                                    `\n§cK/D§f: §c${kdr}` +
                                    `\n§cTime Played§f: §c${hoursDB.read(args[1].replace("_", " "))}:${minsDB.read(args[1].replace("_", " "))}:${secsDB.read(args[1].replace("_", " "))}`
                                )
                                .button('§cExit Menu')
                            forceShow(stats, sender)
                            sender.sendMessage(`§cOpened form, Close chat to see it`);
                        }
                    })
                };
                const allPlayerData = [...moneyDB.Database.entries()];
                if (args[1].replace("_", " ") === ) {
                    system.run(() => { showForm(sender) })

                } else {
                    sender.sendMessage(sender.name)
                }
            }

            default: return;
        }

    }
})

#

im trying to make it where you can see offline stats but idk how to do this if (args[1].replace("_", " ") === ) { system.run(() => { showForm(sender) }) ` }

#

im trying to get the offline player name and use the name to see their stats

glad snow
tired runeBOT
#

Offline Player v0.2.0
Represents a reference to a player identity and the data belonging to a player that is stored on the disk and can, thus, be retrieved without the player needing to be online.

import { OfflinePlayer } from "offline-player/index.js";
// Get data via player.id (Recommended)
const player = OfflinePlayer.get('-68719476735');
// Or get via player.name
const player = OfflinePlayer.get('JaylyPlays');

Summary
Using either index.js with index.d.ts file, or `index.t

queen frost
#

no im using a database

#

this one

#

@glad snow

glad snow
#

idk how are you storing the info

queen frost
#

oh

light chasm
#

@queen frost

#

Save it ehen they leave

#

Like delete their old stats