Open Source

NRage Framework (RAGE:MP)

1,000.00

Add to wishlistAdded to wishlistRemoved from wishlist 2

Download this project profile

NRage – a GTAV server framework based on RAGE:MP 1.1+ and was designed as superstructure to it to provide all functionality needed for development focused only on gameplay parts, without any need to script server core or client core. Project is hand-written by me and is sold with full profile (including git repository, patreon, all media, etc) and contains ready-to-use backend solutions, front-end solutions, and wrappers for RAGE Engine in multiplayer:

Short content description:

  • Database.
  • Login/registration.
  • Multi-account control.
  • Multi-language support.
  • Full application level support.
  • Gameplay concept.
  • Standalone server and client core.
  • Character creation.
  • Streaming (synchronization module).
  • Game objects (blips, colshapes, objects, markers, etc).
  • System actions.
  • Currencies.
  • Player characteristics.
  • Inventory.
  • Chat.
  • Leveling.
  • Vehicles.
  • Immersive NPCs.
  • HUD and Dialogs.
  • Admin tools.
  • Anti-cheat.
  • Referral system
  • Shops.
  • World interactions system.
  • Cinematic camera manager.
  • Debug tools (Built-in IDE, completed CLI).
  • Gameplay areas control (safezones, turfs).
  • Natives support.

Project profile:

  • Language: TypeScript
  • Client: NodeJS
  • Server: NodeJS
  • Bundler: Webpack + Lerna
  • Front: React (less) + Redux
  • Development model: Agile
  • Git: Bitbucket (with full history)
  • Backlog: JIRA (new generation)
  • Roadmap: Included (JIRA Roadmap)
  • API Version: 1.1+ (RAGE:MP)
  • Netcode: ragerpc + partially nr.events
  • API Wrapper: Included.
  • Database: MongoDB (mongoose)
  • Localization: EN/RU (i18next)
Methods and shorthand descriptions

Server
Classes
– Currency (currency.ts) – class-controller for currencies, inlcudes all methods to initialize and control your project currencies in format of wallets, support hard-currency.
createCurrency(key: CurrencyType, name: string): void
getCurrency(player: PlayerMp | Player, key: CurrencyType): number
getWallet(player: PlayerMp | Player): object
checkWallet(player: PlayerMp | Player, key: string, amount: number): boolean
setWallet(player: PlayerMp | Player, newWallet: [k: string]: number }): void
setCurrency(player: PlayerMp | Player, key: CurrencyType, amount: number, reason?: string): void
addCurrency(player: PlayerMp | Player, key: CurrencyType, amount: number, reason?: string): void
swapCurrency(player: PlayerMp | Player, source: string, to: string, amount: number, reason?: string): void
addPoints(player: PlayerNR | Player, amount: number, reason?: string): void
– (WIP) Grid Inventory (inventory.ts) – class-controller for inventory, supports weights and grid-based inventory control: for gear, bakcpack and containers such as vehicles. Contains methods to calculate positions, weights and generic configuration.
createItem(keyString: string, name: string, type: ItemType, stacks: number, size: [number, number], tradable: boolean, weight: number, removable = true): void
itemExists(keyString: string): boolean
getItemData(keyString: string): Item
getItemWeight(keyString: string): number
getItemDimensions(keyString: string): [number, number]
getInventoryWeight(items: InventoryItem[]): number
getBackpackMaxLoad(keyString: string): number
private getBackpackDimensions(keyString: string): [number, number]
// private findItem(keyString: string, where: InventoryType): boolean
private getItemMap(keyString: string, position: number): number[]
private getInventoryMap(items: InventoryItem[]): number[]
canFitAny(inventory: InventoryItem[], dimensions: [number, number], keyString: string): number
canFitPosition(entity: PlayerMp | Player, where: InventoryType, position: number, keyString: string, amount: number): boolean
addItem(player: PlayerMp | Player, keyString: string, amount = 1, data?: any, position = -1): boolean
addItemBackpack(player: PlayerMp | Player, keyString: string, amount = 1, data?: any, position = -1): boolean
// removeItemPosition(player: PlayerMp | Player, position: number, force?: boolean): boolean
// removeItemBackpackPosition(player: PlayerMp | Player, position: number, force?: boolean): boolean
– Leveling (leveling.ts) – class-controller for experience and levels. Based on exponential formula with limit up to 8000 levels. Classic system of experience – experience is reset, level threshold is increased for next level until exponential cap is reached and becomes a fixed value. Contains methods for leveling calculation and generic configuration.
getXPLevel(level: number): number
getXPMultiplier(player: PlayerNR | Player): number
setLevel(player: PlayerMp | Player, level: number): void
setXP(player: PlayerMp | Player, xp: number): void
addXP(player: PlayerMp | Player, amount: number): void
– Patreon API (patreon.ts) – class-controller for Patreon. Contains methods for initialization and reading data from Patreon campaigns using Axios (based on REST API) using tokens: campaign details, campaign tiers, members, patrons and relative patrons data (paid, unpaid, etc) and methods for validating them in-game in real time.
static async getAllCampaigns(accessToken: string): Promise<Campaign[]>
private async getData(request: string): Promise<any>
async getCampaignMembers(): Promise<Members>
async getTiers(): Promise<Tier[]>
async getPatrons(): Promise<Patron[]>
async getPatron(email: string): Promise<Patron>
async getPatronTiers(email: string): Promise<string[]>
async patronHasTier(email: string, tier: string): Promise<boolean>
– Vehicles (vehicles.ts)- class-controller for all game vehicles. Performs as core initialization for vehicles: sets-up inventories, fuel volumes, fuel consumption rates, vehicle modifications (including custom ones, ask for details) and all of the visuals like neon, colors, etc. Reads and writes to database.
get(model: string): VehicleConfig
getAll(): [string, VehicleConfig][]
getFuel(model: string): number
getPrice(model: string): number
getInventorySize(model: string): number
getFuelConsumptionRate(model: string): number
setMod(vehicle: VehicleMp, modIndex: number, value: number): void
getModCustom(vehicle: VehicleMp, name: VehicleModsCustom): any
setModCustom(vehicle: VehicleMp, name: VehicleModsCustom, value: any): void
setColor(vehicle: VehicleMp, colorPrimary: RGB, colorSecondary: RGB): void
setPearlescentColor(vehicle: VehicleMp, color: VehicleColors): void
setNeonColor(vehicle: VehicleMp, color: RGB): void
saveVehicle(vehicle: VehicleMp): void
loadMods(vehicle: VehicleMp, mods: Partial<IVehicleMods>, inventory: string, fuel: number, numberplate: string): void
saveMods(vehicle: VehicleMp): void
Constants
– account.ts – account interfaces.
– bans.ts – interfaces for static bans data (by IP, by ID).
– blips.ts – interfaces and data for blip constructor.
– character.ts – interfaces for character constructor.
– collectibles.ts – interfaces and data collectible items constructor.
– locations.ts – locations data and interfaces, currently all hospitals used to get respawn point.
– markers.ts – interfaces and data for markers constructor. Contains data for shops, teleport points and etc.
– objects.ts – interfaces and data for static objects, for example a “Lucky Wheel” interactivity data.
– peds.ts – intrefaces and data for NPC constructor. This is advanced struct, contains data about: positioning, animations, speech, interactivity type (Vendor, interactive, lore character, etc).
– safezones.ts – interfaces and data for zones (green, yellow, red). Contains information about: visualiazation, position, elevation, types and names of zones.
Core
Controllers
– account.controller.ts – database controller for characters and accounts.
createAccount: async (account: ServerAccount): Promise<ServerAccount>
saveAccount: async (schema: Partial<ServerAccount>): Promise<void>
findAccount: async (schema: FilterQuery<ServerAccount>, cb?: (…args: any[]) => void): Promise<ServerAccount>
findAccounts: async (schema: FilterQuery<ServerAccount>, cb?: (…args: any[]) => void): Promise<ServerAccount[]>
banAccount: async ({ socialClub, banInfo }: BanAccountInput): Promise<void>
warnAccount: async ({ socialClub, blacklisted }: WarnAccountInput): Promise<void>
getCharacters: async (username: string): Promise<Character[]>
createCharacter: async (username: string, character: Character): Promise<void>
findCharacter: async (name: string): Promise<Character>
findCharacterAccount: async (name: string, rgscId: string): Promise<Character>
updateCharacter: async (name: string, schema: Partial<Character>): Promise<void>
– static.controller.ts – database controller for “dynamic” static objects.
loadStatic: async (alias: string, cb?: (…args: any[]) => void): Promise<IStatic>
createStatic: async (alias: string): Promise<IStatic>
updateStatic: async (alias: string, …args: any[]): Promise<void>
– system.controller.ts – database controller for system data (last start, last payday, total launch count, etc)
load: async (): Promise<ISystem>
create: async (): Promise<ISystem>
update: async (args: Partial<ISystem>): Promise<void>
– vehicle.controller.ts – database controller for vehicles.
loadVehicle: async (schema: Partial<IVehicle>, cb?: (…args: any[]) => void): Promise<IVehicle>
createVehicle: async (key: string, modelHash: string, owner: PlayerMp | Player): Promise<IVehicle>
updateVehicle: async (schema: Partial<IVehicle>, data: Partial<IVehicle>): Promise<void>
Models
– account.model.ts – mongoose model for controllers listed above.
– static.model.ts – mongoose model for controllers listed above.
– system.model.ts – mongoose model for controllers listed above.
– vehicle.model.ts – mongoose model for controllers listed above.
– Main (core.ts) – server superstructure over RAGE:MP to extend its functionality.
export const random = (min: number, mid: number, max: number): number
export const selectRandom = (array: any[]): any
export const min = (value: number, to: number): number
export const max = (value: number, to: number): number
export const createHash = (length = 16): string
export const HEXtoRGB = (hex: string): RGB
export const getClosestVector = (arrayOfVectors: Vector3Mp[], object: EntityMp): Vector3Mp
export const getGender = (player: PlayerMp | Player): string
export const addMomentTimezone = (value: number, type: DurationInputArg2, time = moment()): Moment
export const getClosestLocation = (arrayOfLocations: Location[], object: EntityMp): Location
export const instanceOfVector = (object: any): object is Vector3Mp
export const instanceOfEntity = (object: any): object is EntityMp
export const playAnimation = (player: PlayerMp | Player, animationDict: string, animation: string, flag = 1, duration = 0, speed = 8.0): void
export const getEntityFromId = (entityType: string, id: number): EntityMp
export const getCurrentVendorFromClient = async (player: Player | PlayerNR): Promise<EntityMp>
export const getVehicleSpeed = (velocity: Vector3Mp): number
export const doPayday = (player: PlayerNR | Player): void
export const setVIPLevel = async (player: PlayerNR | Player, level: VipLevels, time: moment.Moment): Promise<void>
export const findPlayerByID = (rgscId: string): PlayerMp
export const setDesiredWantedLevel = (player: PlayerNR | Player, wantedLevel: number): boolean
export const setWantedLevel = (player: PlayerNR | Player, wantedLevel: number): void
export const banPlayerServer = async (violator: PlayerMp, reason: string, time: number, silent = false): Promise<void>
export const kickPlayerServer = (violator: PlayerMp, reason: string, silent = false): void
export const checkDuplicates = (player: PlayerNR | Player): void
export const createAdminVeh = (vehclass: string, issuer: PlayerMp, options?: {
alpha?: number,
color?: [Array2d, Array2d] | [RGB, RGB],
dimension?: number,
engine?: boolean,
heading?: number;
locked?: boolean,
numberPlate?: string
}): void
export const getAccountFromServerAccount = (serverAccount: ServerAccount): Account
export const config = (): { [k: string]: any }
– Wrapper (wrapper.ts) – Complex constructor that wraps native types, interfaces and methods from RAGE:MP API for contextual control over them. Fully replicates mp namespace as nr.
export interface PlayerNR extends PlayerMp
export interface VehicleNR extends VehicleMp
export interface ObjectNR extends ObjectMp
export interface PedNR extends EntityMp, PedMp
class NRWrap {

public rpc = {
register: (name: string, cb: ProcedureListener): Function,
unregister: (name: string): void,
call: <T = any>(name: string, args?: any, options?: CallOptions): Promise<T>,
callServer: <T = any>(name: string, args?: any, options?: CallOptions): Promise<T>,
on: (name: string, cb: ProcedureListener): Function,
off: (name: string, cb: ProcedureListener): void,
trigger: (name: string, args?: any): void,
triggerServer: (name: string, args?: any): void,
callClient: <T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>,
callBrowsers: <T = any>(player: Player, name: string, args?: any, options?: CallOptions): Promise<T>,
triggerClient: (player: Player, name: string, args?: any): void,
triggerBrowsers: (player: Player, name: string, args?: any): void
};
public players = {

broadcast: (text: string): void,
broadcastInRange: (position: Vector3Mp, range: number, text: string): void,
broadcastInDimension: (position: Vector3Mp, range: number, dimension: number, text: string): void,
broadcastInDimensionRange: (position: Vector3Mp, range: number, dimension: number, text: string): void,
call: (eventName: string, …args: any[]): void,
callArray: (eventName: string, …args: any[]): void,
callInDimension: (dimension: number, eventName: string, …args: any[]): void,
callInRange: (position: Vector3Mp, range: number, eventName: string, …args: any[]): void
};
public vehicles = {

new: (model: RageEnums.Hashes.Vehicle | HashOrString, position: Vector3Mp, options?: {
alpha?: number,
color?: [Array2d, Array2d] | [RGB, RGB],
dimension?: number,
engine?: boolean,
heading?: number;
locked?: boolean,
numberPlate?: string
}): VehicleMp
};
public objects = {

new: (model: HashOrString, position: Vector3Mp, options?: {
alpha?: number,
dimension?: number,
rotation?: Vector3Mp
}): ObjectMp
};
public pickups = {

new: (…args: any[]): PickupMp
};
public blips = {

new: (sprite: number, position: Vector3Mp, options?: {
alpha?: number,
color?: number,
dimension?: number,
drawDistance?: number,
name?: string,
rotation?: number,
scale?: number,
shortRange?: boolean
}): BlipMp
};
public peds = {

new: (modelHash: string | number, position: Vector3Mp, options?: {
dynamic: boolean,
frozen: boolean,
invincible: boolean
}): PedMp & EntityMp
};
public colshapes = {

newCircle: (x: number, y: number, range: number, dimension?: number): ColshapeMp,
newCuboid: (x: number, y: number, z: number, width: number, depth: number, height: number): ColshapeMp,
newRectangle: (x: number, y: number, width: number, height: number): ColshapeMp,
newSphere: (x: number, y: number, z: number, range: number, dimension?: number): ColshapeMp,
newTube: (x: number, y: number, z: number, range: number, height: number): ColshapeMp
};
public markers = {

new: (type: number, position: Vector3Mp, scale: number, options?: {
color?: RGBA,
dimension?: number,
direction?: Vector3Mp,
rotation?: Vector3Mp,
visible?: boolean
}): MarkerMp
};
public checkpoints = {

new: (type: number, position: Vector3Mp, radius: number, options?: {
color?: RGBA,
dimension?: number,
direction?: Vector3Mp,
visible?: boolean
}): CheckpointMp
};
public events = {
add: (eventName: RageEnums.EventKey | string, cb: (…args: any[]) => void): void,
addArray: (events: ({ [name: string]: (…args: any[]) => void; })): void,
addCommand: (command: string, cb: (player: PlayerMp, fullText: string, …args: string[]) => void): void,
addCommandArray: (commands: { [commandName: string]: (player: PlayerMp, fullText: string, …args: string[]) => void; }): void,
call: (eventName: string, …args: any[]): void,
callLocal: (eventName: string, …args: any[]): void,
delayShutdown: (bool: boolean): void,
delayInitialization: (bool: boolean): void,
getAllOf: (eventName: string): void,
remove: (eventName: string, handler?: (…args: any[]) => void): void,
reset: (): void
};
public config = {

};
public world = {

removeIpl: (name: string): void,
requestIpl: (name: string): void,
setWeatherTransition: (weather: RageEnums.Weather | string, duration?: number): void
};
// Global
delayServerShutdown = (bool: boolean): void
delayServerInitialization = (bool: boolean): void
}
Loaders
– Bootstrap (bootstrap.loader.ts) – system loader, initializes pipe between clients and server, sets game time, payout intervals, etc.
– Database (database.loader.ts) – mongoose database loader, connects to database, opens pipes and etc.
– Language (lang.loader.ts) – i18next loader.
– Modules (module.loader.ts) – modules loader (src/modules).
Modules
– Account – authorization module, handles login sequences, account registration, сохранения аккаунтов и персонажей проекта. Обеспечивает полную безопасность логина, запрет на использование мультиаккаунта, запрет на использования аккаунта другой учетной записи Rockstar, автономное сохранение данных персонажа и аккаунта независимо от способа выхода из игры. Имплементация типа PlayerNR с полями данных видимых только в области серверной части. Инициализирует данные о аккаунте (уровень админа, уровень вип, хард-валюта и т.д.). Производит общение с интерфейсом логина CEF через RPC.
nr.events.add(NREvents.playerReady, async (player: PlayerMp)
nr.rpc.on(NREvents.cefReady, async (_, { player })
const updatePlayerByAccount = async (player: PlayerNR | Player, account: Account): Promise<void>
const getCurrentAccount = async (_: undefined, info: ProcedureListenerInfo): Promise<GetCurrentAccountResult>
const updateAccountOnLogin = async (account: Account): Promise<void>
const login = async ({ username, password }: { username: string, password: string }, info: ProcedureListenerInfo): Promise<LoginResult>
export const savePlayer = (player: PlayerNR | Player): void
export const saveAccount = (player: PlayerNR | Player): void
const playerQuited = (player: PlayerNR)
– Actions – server-side actions module, serves as an end-point for client actions module, in this case the whole process of “Wheel of Fortune” actiuon.
– Admininistration – server admininistration module, controls login rules, player permissions and admin functionality. Supports procedural calls for bans, kicks, warns, creating vehicles, teleport (few sorts of them), dimension change, jail, freeze, and specific gun-based tool – NRay Gun.
export const giveNRayGun = (player: PlayerMp): void
export const sendPlayerToLimbo = (player: PlayerMp | Player): void
const checkPermission = (client: PlayerMp, permission: AdminPermissions): boolean
async function banPlayer(issuer: PlayerMp, violator: PlayerMp, reason: string, time: number): Promise<void>
const kickPlayer = (issuer: PlayerMp, violator: PlayerMp, reason: string): void
const warnPlayer = async (issuer: PlayerMp, violator: PlayerMp, state: boolean, reason?: string): Promise<void>
function teleport(issuer: PlayerMp, target: Vector3Mp | EntityMp): void
function teleportToMe(issuer: PlayerMp, target: PlayerMp): void
function changeDimension(issuer: PlayerMp, target: EntityMp, dimension: number): void
async function jailPlayer(issuer: PlayerMp, target: PlayerMp): Promise<void>
function freezePlayer(issuer: PlayerMp, target: PlayerMp): void
function setEntityPosition(issuer: PlayerMp, entity: EntityMp | VehicleMp, position: Vector3Mp): void
function deleteEntity(issuer: PlayerMp, target: VehicleMp | ObjectMp | PlayerMp): void
function createEntity(issuer: PlayerMp, hash: string, position: Vector3Mp): void
– Anticheat – basic anticheat based on event handlers. Has three levels of actions – log, kick and ban. Concept is complete but it requires adaptation for any upcoming content. Able find and eliminate these
Vehicle spawned on client
Vehicle spawned without server consent (all vehicles should be wrapped with vehicles class method, applied by default on server-side).
Vehicle or player invisibility
Godmodes
Health and Armor amount
Missing collision
Illegal weapons (blacklist based)
Vehicle speedhack
Player model changes
Infinite ammo
– Character – module for creating, loading and saving characters. End-point module for client module.
const getCharacters = async (_: undefined, info: ProcedureListenerInfo): Promise<GetCharactersListResult>
const updatePlayerByCharacter = async (player: PlayerNR | Player, character: Character): Promise<void>
const loadCharacter = async (name: string, info: ProcedureListenerInfo): Promise<LoadCharacterResult>
– Chat – custom chat module with UTF-8 support. Based off React component, serves as a midpoint between clients CEF. Has a built-in interceptor for default RAGE:MP chat to display these as system messages.
const getMessageLabel = (str: string): ChatLabels
const getMessageFromString = (str: string, player: PlayerMp | Player): ChatMessage
const sendChatMessage = async (str: string, info: ProcedureListenerInfo): Promise<void>
– Currencies – currencies moduile, implements currency class, creates the currencies themselves and RPC-events to create workflow with clients.
– Debug – debug module, used by superstructured RAGE:MP console to execute scripted commands and/or direct code execution using RPC callbacks. Has built-in shorthand commands (described in client side).
const debug = (code: string, info: ProcedureListenerInfo): string
– Inventory (WIP) – module for creating prototypes of items, implements inventory class, creates items and their properties: name, type, size (grid), weight, stack size. Has a built-in list of all GTAV weapons and few custom items as example.
– Leveling – experience and level calculation module, implements leveling class, creates RPC-events that calculates how and when specific player should receive experience.
const levelReasons: { [k: string]: number}
export const addExperience = (player: PlayerMp | Player, amount: number): void
nr.rpc.register(NREvents.experienceGateway, (args, info)
– Player – character and client init module. Contains RPC-events to provide server data, handlers for player states (food, water, mood), handlers for respawning, wanted levels, stealth mode, animation, walking styles, speech.
nr.rpc.register(NREvents.getServerLang, async ()
nr.rpc.register(NREvents.clientInit, (_, info): { [k: string]: any }
nr.rpc.register(NREvents.playerRespawn, (args, info)
nr.rpc.register(NREvents.setDesiredWantedLevel, (args, info)
nr.rpc.register(NREvents.setWantedLevel, (args, info)
nr.rpc.register(‘toggleCrouch’, (_, info)
nr.rpc.register(‘playAnimation’, (args: any, info)
nr.rpc.register(‘playWalkingStyle’, (args: any, info)
nr.rpc.register(‘playSpeech’, (args: any)
– Referals – module based on promo-codes and permissions (Patreon included). Can be used for content creators (streamers), patrons, global giveaways. Result of promocode usage is code you define on server, in current example gives soft-currency, hard-currency, VIP status.
const isCodeUsed = (player: PlayerNR | Player, code: string): boolean
const isSubscriptionUsed = (player: PlayerNR | Player): boolean
const subscribePlayer = async (player: PlayerNR | Player, code: string): Promise<void>
export const runPromoCode = async (player: PlayerNR | Player, code: string): Promise<boolean>
nr.rpc.register(NREvents.usePromoCode, async (args, info)
– Shops – in-game shop service module.
vehicles – a complete vehicles shop. Supports a camera to preview selected vehicles, color palletes, detailed information about vehicle (fuel, inventory size, seats amount, vehicle characteristics in %) and “Test Drive” for a seamless drive test of selected vehicle in personal dimension. Contains CEF handlers.
const removePreviewVehicle = (player: Player): void
const setActiveVehicleInVehShop = async (name: string, player: PlayerNR | Player, colors?: [RGB, RGB]): Promise<SetActiveVehicleResult>
nr.rpc.register(NREvents.getVehicleList, async (alias: string, { player }): Promise<GetVehicleListResult>
nr.rpc.register(NREvents.setActiveVehicleInVehShop, async (name: string, { player })
nr.rpc.register(NREvents.buyVehicleInVehShop, async ({ name, moneySource }: BuyVehicleProps, { player }): Promise<BuyVehicleResult>
nr.rpc.register(NREvents.changeVehicleColorInVehShop, async (args, info))
nr.rpc.register(NREvents.resetVehicleShop, (_, { player })
nr.rpc.register(NREvents.doTestDrive, async (_, { player })
nr.rpc.register(NREvents.cancelTestDrive, (_, { player })
– Static
blips – blips constructor. Creates all blips on the map.
colshapes – colshapes constructor. Creates a colshapes for safezones.
markers – markers constructor. Creates interactive markers: teleports, non-NPC shops (fuel stations for example) and etc.
objects – objects constructor. Creates all interactive objects based on their details, for example collectibles.
peds – dynamic NPC constructor. Creates every NPC, sets their identity, animations, names and interactive counterpart based on their data, starting with “just talk” ending with full-scale shops.
– System – system simulation module. Controls vehicle fuel consumption in real-time, each player payday time, syncing time with hardware time.
– Vehicles – vehicles module. Controls vehicles states: engine state, lock state. Contains vehicle objects constructors and desctructors.
export const wrapVehicle = (vehicle: VehicleMp, type: string, owner: PlayerMp | Player, key?: string): void
export const despawnVehicle = (vehicle: VehicleMp): void
export const destroyVehicle = (vehicle: VehicleMp): void
export const loadVehicle = async (key: string, owner: PlayerMp | Player): Promise<VehicleMp>
const saveEngineState = (args: any)
const saveLockState = (args: any)
nr.rpc.register(‘broadcast.shareWaypoint’, (args: any))
mp.events.add(‘playerEnterVehicle’, (player: PlayerMp, vehicle: VehicleMp, seat))
Utility
– fslog.ts – fslog lib
– hash.ts – simple-encryptor lib
– logger.ts – lib4js lib
– App (app.ts) – server application index, launches its core.
– Application Level (index.ts) – NodeJS index.
Client
Classes
– Scaleforms (scaleforms.ts) – handmade replica of forms styled “mission complete, respect +”
export const showShardScaleform = (title: string, message: string, titleColor: number, bgColor: number, time = 5000): void
Constants
– animations.ts – animations constants.
– cameras.ts – constants for camera data.
– props.ts – hash collection for “InteractAnything” module.
– statics.ts – data for creating local static objects.
Core
– Main (core.ts) – client-side superstructure to RAGE:MP API that extends its functionality.
export const selectRandom = (array: any[]): any
export const setActionCooldown = (time: number): void
export const min = (value: number, to: number): number
export const max = (value: number, to: number): number
export const actionInCooldown = (): boolean
export const instanceOfVector = (object: any): object is Vector3Mp
export const instanceOfEntity = (object: any): object is EntityMp
export const checkLoS = (who: EntityMp, target: EntityMp): boolean
export const distance = (source: EntityMp | Vector3Mp, destination: EntityMp | Vector3Mp, useZ = true): number
export const getStreetName = (): string
export const getZoneName = (): string
export const getSafezoneName = (level: number): string
export const getServerTime = (): moment.Moment
export const getPlayerName = (player: PlayerMp): string
export const getServerName = (): string
export const getClosestPed = (range: number): PedMp
export const getClosestVehicle = (range: number): VehicleMp
export const getClosestPlayer = (range: number): PlayerMp
export const getVehiclePeds = (vehicle: VehicleMp): PlayerMp[]
export const getClosestMarker = (range: number): MarkerMp
export const getClosestObject = (range: number): ObjectMp
export const getCursorObject = (range: number, flag = 17): RaycastResult
export const getWorldProp = (hash: number, range: number, position: Vector3Mp): EntityHandle
export const getNormalizedVector = (vector: Vector3Mp): Vector3Mp
export const getCrossProduct = (v1: Vector3Mp, v2: Vector3Mp): Vector3Mp
export const getDeathCause = (cause: number): string
export const getPropAction = (hash: number): string
export const getClosestProp = (hash: number, range: number): EntityHandle
export const getPropHeading = (handle: EntityHandle): number
export const getPropPosition = (handle: EntityHandle): Vector3Mp
export const getPropHash = (handle: EntityHandle): number
export const isStreamed = (pool: PlayerMpPool | ObjectMpPool | VehicleMpPool | PedMpPool | MarkerMpPool, entity: EntityMp): boolean
export const engineToggle = (): void
export const lockToggle = (): void
export const toggleCrouch = (): void
export const reloadWeapon = (): void
export const isAiming = (): boolean
export const disableFiring = (): void
export const toggleRagdoll = (state: boolean, time?: number): void
export const doTaunt = (index?: number): void
export const playScenario = (scenario: string, position?: Vector3Mp, heading?: number, xOffset = 0, yOffset = 0, zOffset = 0): void
export const knockOut = async (): Promise<void>
export const savePlayer = (): Promise<void>
export const changeHealth = (value: number)
export const changeStat = (stat: ‘hunger’ | ‘thirst’ | ‘mood’, value: number, cap?: number)
export const checkMood = (value: number): boolean
export const getPlayerLevel = (): number
export const getGender = (): string
export const createTurf = (position: Vector3Mp, radius: number, alpha: number, sprite: number, rotation: number, color: number, flashing: boolean): EntityHandle
export const removeTurfs = (): void
export const setDesiredWantedLevel = (level: number, los = true): void
export const removeWantedLevel = (): void
export const checkPermission = (permission: AdminPermissions): boolean
export const debugHUDToggle = (): void
export const teleportForward = (): void
export const teleportToBlip = (): void
export const teleportHome = (): void
export const teleportUnderCursor = (): void
export const moveUnderCursor = (): void
export const deleteUnderCursor = (): void
export const createUnderCursor = (): void
export const toggleNoClip = (): void
export const strip = (text: string): string
export const notification = (title: string, message: string, icon?: string, long = false, textColor = -1, bgColor = -1): void
export const showHint = (text: string): void
export const removeHint = (): void
export const playSound = (soundSet: string, sound: string, soundid = -1): void
export const playSoundFrontend = (soundid = -1, sound: string, soundSet: string): void
export const playSound3D = (soundSet: string, sound: string, at: Vector3Mp | EntityMp, soundid = 1): void
export const moveSkyTo = (handle: number): void
export const moveSkyFrom = (handle: number, switchtype: number): void
export const setWalkingStyle = (player: PlayerMp, index: number): void
export const playWalkingStyle = (index: number): void
export const setAnimation = (entity: PlayerMp | PedMp, animSet: [string, string], flag = 0, duration = -1, speed = 8, playbackRate = 1.0): void
export const playAnimation = (animSet: [string, string], flag = 0, duration = -1, speed = 8): void
export const setSpeech = (entity: EntityMp, speechName: string, voiceName: string, speechParam: string): void
export const playSpeech = (entity: EntityMp, speechName: string, voiceName: string, speechParam: string): void
export const setMood = (player: PlayerMp, index: number): void
export const playMood = (entity: EntityMp, index: number): void
export const makeScreenshot = async (): Promise<void>
export const setRadioEmitter = async (handle: EntityHandle, radio: RadioStations): Promise<void>
export const createBlip = (sprite: number, position: Vector3Mp, color: number, shortRange = true, scale = 0.8): BlipMp
export const setBlipText = (blip: BlipMp, text: string): void
export const HEXtoRGB = (hex: string): RGB
export const fadeAlpha = (vehicle: VehicleMp, toAlpha: number, time: number): void
export const showInfoOverlay = (): void
– Natives (natives.ts) – wrapper for RAGE engine native calls presented as functions and methods.
GET_ENTITY_PHYSICS_HEADING: (entity: EntityHandle): number
GET_OFFSET_FROM_ENTITY_IN_WORLD_COORDS: (entity: EntityHandle, offsetX: number, offsetY: number, offsetZ: number): Vector3Mp
GET_ENTITY_MODEL: (entity: EntityHandle): number
DOES_BLIP_EXIST: (blip: EntityHandle): boolean
GET_NEXT_BLIP_INFO_ID: (i: number): number
GET_FIRST_BLIP_INFO_ID: (i: number): number
GET_NUMBER_OF_ACTIVE_BLIPS: (): number
IS_PLAYER_SWITCH_IN_PROGRESS: (): boolean
SET_PED_CURRENT_WEAPON_VISIBLE: (ped, visible, deselectWeapon, p3, p4): void
SET_BLIP_SPRITE: (blip, sprite): void
SET_BLIP_ALPHA: (blip, a): void
SET_BLIP_COLOUR: (blip, c): void
SET_BLIP_ROTATION: (blip, r): void
SET_BLIP_FLASHES: (blip, f): void
SET_BLIP_SCALE: (blip, scale): void
SET_BLIP_FLASH_TIMER: (blip, t): void
SET_BLIP_COORDS: (blip, x, y, z): void
SET_CURSOR_LOCATION: (x, y): void
SET_THIS_SCRIPT_CAN_REMOVE_BLIPS_CREATED_BY_ANY_SCRIPT: (toggle): void
SET_FACIAL_IDLE_ANIM_OVERRIDE: (ped, animName, animDict): void
_SET_NOTIFICATION_COLOR_NEXT: (textColor): void
_SET_NOTIFICATION_BACKGROUND_COLOR: (bgColor): void
_SWITCH_IN_PLAYER: (ped): void
_SWITCH_OUT_PLAYER: (ped, flags, switchType): void
_LINK_STATIC_EMITTER_TO_ENTITY: (emitterName, handle): void
– Wrapper (wrapper.ts) – Complex constructor, wraps types, interfaces and methods of RAGE:MP for contextual execution purposes. Wraps rage-rpc module same way.
Loaders
– loader.ts – initial loader, establishes connection with server to get data, inits localization library, launches modules.
Modules
– Account – account and character events controller: requests login, character creation forms, creates visuals, initializes anti-hack system and finalizes game state after character selection.
const movePlayerToRender = async ()
const syncCall = (args: any)
const authCameraHandler = async ()
const selectCharacterCameraHandler = async ()
const gameplayCameraHandler = async ()
const updateCharacterOnSelection = async (character: any): Promise<void>
const getLastLogin = async (): Promise<string>
const saveLastLogin = (lastLogin: string): void
– Interactions Module (InteractAnything) – specific interactions module for dynmaic interactions with game environment. Allows player to interact with: vehicles, players, NPC, object, markers and world props without direct context: interact with game world object based on object hashes (object IDs).
const createVisualQue = (position: Vector3Mp, range = 1.25, zOffset = 0.05): void
const removeThisFrame = ()
const enableThisFrame = (entity: EntityMp | number, inVehicle: boolean)
export const doAction = (): void
– Admin Module – admin tools client-side helper: handles states, noclip mode, teleport by map clicks, etc.
– Anti-cheat – anti-cheat client-side helper: watches over all possible exploits related to client-side changes and reports data to server.
– Camera Manager – camera manager module. Supports creating cutscenes for other modules, like login sequence, shops, etc.
static on(eventName: string, eventFunction: EventFunction)
static fireEvent(eventName: string, …args: any[])
static getCamera(name: string)
static setCamera(name: string, camera: CameraNR)
static hasCamera(name: string)
static destroyCamera(camera: CameraNR)
static createCamera(name: string, type: string, position: Vector3Mp, rotation?: Vector3Mp, fov?: number)
static setActiveCamera(activeCamera: CameraNR, toggle: boolean)
static setActiveCameraWithInterp(activeCamera: CameraNR, position: Vector3Mp, rotation: Vector3Mp, duration: number, easeLocation: number, easeRotation: number)
static doesExist(camera: CameraNR)
static get activeCamera()
static get gameplayCam()
– Character Creation module (WIP) – handles character creation chains, visual components application, saving, etc. Built with future reference to change anything on-fly.
public update(data: CustomizationData): void
private updateGender(gender: Gender)
private updateParents(father: number, mother: number, similar: number)
private updateHeadOverlays(data: HeadOverlays)
private updateFaceFeatures(data: FaceFeatures)
private updateHair(hair: number)
private updateHairColor(hairPrimaryColor: number, hairSecondaryColor: number)
private updateFacialHairColor(facialHairColor: number)
private updateEyeColor(eyeColor: number)
– Chat – simple custom chat handler: open, close, send message.
– Debugger – debugger module: handles custom console and debug panel (F3).
– Console: CLI for plain code execution (server or client) and command execution with aliases (su, sudo, V, pos, JSON).
– Debug: an overlay panel (F3) with detailed backend information, variables states, etc. Enables NRay Gun mode.
time
dimension
position
heading
character
stats
wallet
level
wantedLevel
vehicle
vehicleRPM
ownedVehicle
rentedVehicle
cursorObject
currentNPC
currentNPCData
currentAction
currentActionName
isInSafeZone
isFreeAiming
isInMeleeCombat
isInScenario
isFalling
street
zone
interiorID
– Dialogs – NPC intreaction dialogs. Uses camera manager and CEF routing.
export const createDialogCamera = (alias: string): void
export const createNPCDialog = async (dialog: Routes, entity: EntityMp): Promise<void>
export const createDialog = async (dialog: Routes, entity?: EntityMp): Promise<void>
export const closeDialog = async (): Promise<void>
– HUD – front-end and HUD components handler. Supports nametags, NPC names, marker names, vehicles visuals, player titles, IDs, statuses, visual marker-based ques, etc. Handles front-end components and routes.
const _toggleCursor = (freezeControls: boolean, state: boolean): void
nr.rpc.register(NREvents.toggleCursor, (props: ToggleCursorProps))
export const showCursor = (): void
export const hideCursor = (): void
export const setRoute = async (route: Routes | string, params?: { [key: string]: any }): Promise<void>
export const setTimeCycleModifier = (modifierName: string): void
export const displayRadar = (state: boolean): void
export const showChat = (state: boolean): void
rpc.register(‘displayNotification’, (args: any))
rpc.register(‘receiveDebugData’, (): DebugData)
rpc.register(‘getHUDInfo’, (): HudInfo)
mp.events.add(‘render’, (nametags))
– Keybinder – keyhandler with built-in feature to change keys on front-end.
– Leveling – client-side helper, recieves and processes visuals related to experience (using scaleforms), handles Z-menu data (level info).
const newLevelNotification = (level: number): void
export const updateRankBar = (limit: number, nextLimit: number, previousXP: number, levelup = false): void
nr.rpc.register(NREvents.updateRankBar, (args))
export const showCurrentLevel = (): void
– Player – player functionality module: death, incoming/outgoing damage handlers, playability switches, HUD switches, stats, keyboard/mouse control, safezones functionality, wanted levels and stats loop (interval handling mood, food, water).
– rage-editor – customized rage-editor helper based on user permissions instead (admin module).
– Safezones – safezones handler, determines when and which zone the player is currently in based of constructor data and applies effects. Supports colshapes with elevations.
– Shops – client-sided shops helper, chains CEF and server. Provides details about assets that both sides cannot access at a time, for example vehicle characteristics.
– Static – static objects constructor, assets and IPL initialization. Loads required assets to work with on client, creates world local objects.
– Streaming – synchronization module. Processes and syncs events and attributes of objects related to streaming I/O. This module is important, since game server do not syncronize most of stuff in the game, like vehicle states, players details and equipment, etc.
export const syncVehicleData = (entity: VehicleMp): void
export const syncPlayerData = (entity: PlayerMp): void
export const syncPedData = (entity: PedMp): void
mp.events.add(‘entityStreamIn’, (entity))
mp.events.addDataHandler(‘mods’, (entity))
mp.events.addDataHandler(‘customizationData’, (entity))
mp.events.addDataHandler(‘isCrouched’, (entity, value))
mp.events.addDataHandler(‘walkingStyle’, (entity, value))
mp.events.addDataHandler(‘animationData’, (entity, value))
mp.events.addDataHandler(‘entitySpeech’, (entity, value))
– Vehicles – vehicles states helper. Visualizes and supports custom vehicle mods, state switches, etc.
export const keepEngineState = (vehicle: VehicleMp): void
const playVehicleLockSound = (vehicle: Vector3Mp, state: boolean): void
mp.events.add(‘playerCreateWaypoint’, (position))
rpc.register(‘broadcast.createSharedWaypoint’, (position))
– Application (app.ts) – application index, starts up the core.
– Application Level (index.ts) – index of NodeJS.
Front – CEF package. Built based on React + Redux in SPA style with UX based standartized components, uses less as styles. UI current style is based on cards.
– Application Level
– Content
Authorization page
Character selection page
Character creation page
HUD
Vehicle shop page
– Libs
Keyboard visual mapper
– Routing
– Common elements
UI Components
Constants
Libraries
Pipes
Styles
Utility
– Styles
– Typings
– Assets
– Redux
– Actions
– Reducers
– Selectors
– Storage
Since I am a backend developer I cannot provide more description on this, ask for more code details.
Common – common package to share data betweeen CEF, server and client.
Constants
– customizationData.ts – constants for character creation.
– date.ts – date format constant.
– easingsFunctions.ts – easing functions.
– inputDictionary.ts – input dictionary, associates RAGE strings with actual keyboard values.
– inventory.ts – inventory interfaces and constants.
– referals.ts – content creators referals data.
– regexps.ts – preset of regexes.
– routes.ts – routes for CEF.
– shopdata.ts – shop data – lists, prices, content.
– vehicles.ts – vehicles data – colors, mods indexes, vehicles classes, prices, fuel, inventory size, inventory weight.
Enums
– adminLevels.ts – admin level enums
– chat.ts – chat directives.
– customizationData.ts – character creation data.
– factions.ts – (WIP) factions data.
– leveling.ts – leveling data – exponential caps, level caps.
– nrEvents.ts – full list of events names for RPC calls.
– radioStations – radio stations list.
– saveZoneLevels.ts – safezones levels.
– vipLevels.ts – VIP levels.
Helpers
– character.ts – character creation helper.
Localization
– en.ts
– ru.ts
Pipes
– animate.ts
– date.ts
– deepValue.ts
– enum.ts
– object.ts
– operation.ts
– range.ts
– sleep.ts
– string.ts
Types – all kind of shared types, ideally its better to keep all types here.
Editor – built-in IDE replicating VSCode with InelliSense. Project page (https://rage.mp/files/file/156-rage-editor-in-game-js-editor-w-built-in-intellisense/).

 

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

NRage Framework (RAGE:MP)
NRage Framework (RAGE:MP)

1,000.00

1,000.00

Category:
Add to wishlistAdded to wishlistRemoved from wishlist 2
Register New Account
Reset Password