npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ioq3-rcon

v1.0.0

Published

Client for Urban Terror RCON protocol with parsing.

Downloads

67

Readme

ioq3-rcon

GitHub package.json version Travis (.org) npm

ioq3-rcon is a library for Urban Terror RCON protocol with some parsing functionality.

Installation

not yet uploaded

Usage

import IOQ3Rcon from 'ioq3-rcon'

const client = new IOQ3Rcon({
    address: '127.0.0.1',
    port: 27960,
    // optional if only using info/status functions
    rconPassword: 'secret',
    // optional, wait time before next command can be executed
    rateLimitMs: 150,
    // optional, timeout for UDP packet
    timeoutMs: 8000
});

Server info (no rcon)

client.getServerInfo().then((result) => {
    // Can have more or less keywords depending on server's response
    /*result: {
            modversion: '4.3.4',
            game: 'q3ut4',
            auth: '1',
            pure: '1',
            gametype: '7',
            sv_maxclients: '22',
            bots: '0',
            clients: '0',
            mapname: 'ut4_uptown',
            hostname: '...',
            protocol: '68'
    }*/
})

Server Status (no rcon)

client.getServerStatus().then((result) => {
    // status keyword can have more or less sub-keywords depending on server's response
    /*{
        status: {
            sv_allowdownload: '0',
            g_matchmode: '0',
            g_gametype: '7',
            sv_maxclients: '32',
            sv_floodprotect: '2',
            capturelimit: '10',
            sv_hostname: '...',
            auth_status: 'public',
            g_modversion: '4.3.4'
        },
        players: [
            { name: 'dasfg', points: 53, ping: 250 },
            ...
        ]
    }*/
})

RCON command

client.sendRcon('status').then((result) => {
    // passes cleaned result string
})

RCON get variable value

client.getVarValue('mapname').then((result) => {
    /* result: {
            name: 'mapname',
            value: 'ut4_casa'
    } */
})

// if var has a default
client.getVarValue('g_gravity').then((result) => {
    /* result: {
            name: 'g_gravity',
            value: '900',
            default: '800'
    } */
})

Other functions

  • Use sendRconRaw(command) to get the original return buffer instead of cleaned string
  • Use send(command) to specify your own command, returns cleaned string
  • Use sendRaw(command) to specify your own command, returns original Buffer

Throttling / Chaining commands

Please be aware that due to ioq3 rate limiting, you should chain your commands instead of executing them at the same time.

Option 1: await

await client.sendRcon('status')
await client.sendRcon('map ut4_casa')
// ...
await client.sendRcon('g_password abc')

Option 2: chaining promises

client.sendRcon('status')
    .then((statusResult) => {
        // do something with 'status' result
        return client.sendRcon('map ut4_casa')
    })
    .then((mapResult) => {
        // do something with map result
        return client.sendRcon('g_password abc')
    })
    .then((passwordResult) => {
        // do something with password result
    })