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 🙏

© 2025 – Pkg Stats / Ryan Hefner

qbcore-extended

v0.1.0

Published

TypeScript utilities for QBCore

Readme

qbcore-extended

TypeScript utilities for QBCore that simplify working with the core object and common events.

Installation

npm install qbcore-extended

Usage

Client

import QBCore from 'qbcore-extended/client';

QBCore.onPlayerLoaded = (player) => {
  emit('chat:addMessage', { args: ['[TS]', `Client says: ${player.citizenid} loaded.`] });
};

QBCore.onPlayerUnload = () => {
  emit('chat:addMessage', { args: ['[TS]', 'Client says: player unloaded.'] });
};

Server

import QBCore from 'qbcore-extended/server';

QBCore.onPlayerLoaded = (player) => {
  console.log(`Player loaded: ${player.PlayerData.citizenid}`);
};

QBCore.onPlayerUnload = (playerId) => {
  console.log(`Player unloaded: ${playerId}`);
};

You can also import both sides from the root entry point:

import QBCore from 'qbcore-extended';

QBCore.Client.onPlayerLoaded = () => {};
QBCore.Client.onPlayerUnload = () => {};
QBCore.Server.onPlayerLoaded = () => {};
QBCore.Server.onPlayerUnload = () => {};

The core property exposes the original QBCore object if you need to call additional functions.

Shared utilities and jobs

Both client and server wrappers expose QBCore's shared helpers and job configuration:

// Random plate using QBCore's helper
const plate = QBCore.shared.RandomStr(4);

// Access job definitions
const police = QBCore.jobs['police'];

Server helpers

The server wrapper includes shortcuts for common QBCore functions and command registration:

// Fetch a player by source
const player = QBCore.getPlayer(source);

// Register a simple command
QBCore.registerCommand('ping', 'Replies with pong', (src) => {
  console.log(`${src} pinged`);
});

Database

The library can also initialize a sequelize-typescript instance using the mysql_connection_string defined in server.cfg:

import { getSequelize } from 'qbcore-extended/server';

const sequelize = getSequelize();
// use sequelize to define models or run queries

Server native thread affinity

CitizenFX's JavaScript runtime requires certain server natives to run on the main game thread. The library exposes helpers so you don't need to call setImmediate manually:

import { Natives, runOnMainThread } from 'qbcore-extended/server';

// Automatically deferred via proxy
Natives.SetPlayerRoutingBucket(playerId, 0);

// Manual wrapper for custom references
const giveWeapon = runOnMainThread(GiveWeaponToPed);
giveWeapon(playerPed, weaponHash, 250, false, false);

Example resources

A minimal resource demonstrating basic usage is available in examples/sample-resource.

An example showing how to log player events with Sequelize is available in examples/sequelize-resource.