-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
81 additions
and
52 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
fx_version "cerulean" | ||
game "gta5" | ||
author "fbrp" | ||
name "template" | ||
description 'Template for FBRP resources' | ||
version '1.0.0' | ||
fx_version("cerulean") | ||
game("gta5") | ||
|
||
client_script "build/client.js" | ||
server_script "build/server.js" | ||
client_script("build/client.js") | ||
server_script("build/server.js") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"watch": ["src/**"], | ||
"ext": "ts js", | ||
"exec": "esbuild client=src/client/client.ts server=src/server/server.ts shared=src/server/server.ts --bundle --outdir=build --target=es2015 --platform=node && eslint . --ext .ts" | ||
"watch": ["src/**"], | ||
"ext": "ts js", | ||
"exec": "esbuild client=src/client/client.ts server=src/server/server.ts --bundle --outdir=build --target=es2015 --platform=node && eslint . --ext .ts" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1 @@ | ||
// import { Tools as CTools } from '@fornuftbergets/fbrp-core/client' | ||
import { hello } from '../shared/shared' | ||
|
||
hello("client") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,52 @@ | ||
// import { Tools as STools } from '@fornuftbergets/fbrp-core/shared' | ||
import { hello } from '../shared/shared' | ||
import express, { Express, Request, Response } from "express"; | ||
import { Server } from "@zerio2/qbcore.js"; | ||
import { port, Resource } from "../shared"; | ||
|
||
hello("server") | ||
const app: Express = express(); | ||
const qbcore: Server = global.exports["qb-core"].GetCoreObject(); | ||
|
||
app.get("/players/count", (_req: Request, res: Response) => { | ||
const players = qbcore.Functions.GetQBPlayers(); | ||
|
||
if (Array.isArray(players)) { | ||
res.status(200); | ||
res.json({ | ||
count: players.length, | ||
}); | ||
} else { | ||
res.status(500); | ||
res.json({ | ||
err: "Players was an object and not array", | ||
}); | ||
} | ||
}); | ||
|
||
app.get("/resources/list", (_req: Request, res: Response) => { | ||
const resources: Record<string, Resource> = {}; | ||
|
||
for (let i = 1; i < GetNumResources(); i++) { | ||
const resourceName = GetResourceByFindIndex(i); | ||
|
||
resources[resourceName] = { | ||
name: resourceName, | ||
version: GetResourceMetadata(resourceName, "version", 0), | ||
status: GetResourceState(resourceName), | ||
}; | ||
} | ||
|
||
res.status(200); | ||
res.json({ | ||
list: resources, | ||
}); | ||
}); | ||
|
||
app.all("*", function (_req: Request, res: Response) { | ||
res.status(400); | ||
res.json({ | ||
err: "Unknown route", | ||
}); | ||
}); | ||
|
||
app.listen(port, () => { | ||
console.log(`FiveM.nvim API is listening on port ${port}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export const port = 6969; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./data"; | ||
export * from "./structs"; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export interface Resource { | ||
status: string; | ||
name: string; | ||
version: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters