Skip to content

An API for Node.js that allows interaction with the FiveM masterlist and retrieving various information.

License

Notifications You must be signed in to change notification settings

NiclqsGER/cfx-data-fetcher

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CFX-Data-Fetcher

This package can help you to interact with Cfx.re.



How to install

npm i @niclqs/cfx-data-fetcher

Basic template:

const cfx = require('@niclqs/cfx-data-fetcher');

(async () => {
    const server = await cfx.fetchServerData('xxxxxx');
    const status = await cfx.fetchCfxStatus();
})();

Important:

It is always important to check the status and server of any service or application you are using. This can prevent errors and failures from occurring, and ensure that you are getting the most out of the service.

Try-Catch is your friend! (Written by ChatGPT)



API Reference (Serverdata)

Returns: Endpoint (e. g. xxxxxx)

  server.getEndpoint()

Returns: Gametype (e. g. Roleplay)

  server.getGametype()

Returns: getHostname (e. g. ^7YOURROLEPLAYSERVER ^5TEST-BASED)

  server.getHostname()

Returns: getMapname (e. g. San Andreas)

  server.getMapname()

Returns: getMapname (e. g. San Andreas)

  server.getMapname()

Returns: getPlayerCount (e. g. 10)

  server.getPlayerCount()

Returns: getMaxSlots (e. g. 1000)

  server.getMaxSlots()

Returns: getResources (As array; e. g. ["testscript1", "testscript2"])

  server.getResources()

Returns: getServerVersion (e. g. FXServer-master SERVER v1.0.0.5848 win32)

  server.getServerVersion()

Returns: getVars (As array; e. g. Voice, Discord, OneSync)

  server.getVars()

Returns: getOnlinePlayers (As array; A player includes: endpoint, id, identifiers, name and ping)

  server.getOnlinePlayers()

Returns: getServerOwnerId (Return the ID from the owner)

  server.getServerOwnerId()

Returns: getServerOwnerName (Return the Name from the owner)

  server.getServerOwnerName()

Returns: isServerPrivate (Return true or false)

  server.isServerPrivate()

Returns: getUpvotes (Current Upvotes)

  server.getUpvotes()

Returns: getBurstUpvotes (Current BurstUpvotes)

  server.getBurstUpvotes()

Returns: getServerPatreonBadge (NONE, AURUM, ARGENTUM, PLATINUM)

  server.getServerPatreonBadge()

Returns: getJson (Return everything about the Server; As with the master list also)

  server.getJson()


API Reference (CFX Status)

Returns: isOnline (True/False)

  status.isOnline()

Returns: getPageJson (e. g. latest update, time_zone, ...)

  status.getPageJson()

Returns: getStatusJson (indicator, description; e. g. All Systems Operational)

  status.getStatusJson()

About

An API for Node.js that allows interaction with the FiveM masterlist and retrieving various information.

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published