cfx-api
v1.2.31
Published
A package that helps you interacting with the Cfx.re, FiveM & RedM API.
Downloads
540
Maintainers
Readme
Cfx.re JavaScript API
A package that helps you interacting with the Cfx.re, FiveM & RedM API.
How to install
npm i cfx-api
Example usage:
const cfx = require("cfx-api");
(async () => {
// Retrieve a CitizenFX server (could be a FiveM or a RedM server)
const server = await cfx.fetchServer("qrbm5v") // Replace "qrpm7v" with a server id
console.log(`Server: ${server.hostname} has ${server.players.length} players online`);
// Retrieve Cfx.re status
const status = await cfx.fetchStatus()
console.log(status.everythingOk ? "All Cfx.re systems are operational" : "Cfx.re is experiencing issues");
// And get status of all individual components
const components = await status.fetchComponents()
for (let component of components)
console.log(`${component.name}: ${component.status}`);
})();