Quick Start
Create application
In this section, we will describe how to build the Infernus
application locally.
It is strongly recommended that you use infernus-starter template to create a very simple template example based on TypeScript
.
You need to have a foundation for native pawn
development and node
.
CLI
The project uses pnpm
to manage dependencies, so you need to install pnpm.
You can easily create a project according to the command line prompts.
pnpm dlx @infernus/create-app@latest create
TIP
Because the CLI internally calls the github HTTP API
, if your network environment is poor, you may not be able to create the app successfully. In this case, you can refer to Manual.
@infernus/create-app
is a tool similar to sampctl
that manages package dependencies by parsing pawn.json
rules. You can use it to simply manage plugin or open.mp
base dependencies.
Example
# Install the CLI tool globally
pnpm add @infernus/create-app -g
# Create a project
infernus create <appName>
# Install one or more dependencies,
# all operations' dependencies can be followed by a version number,
# it is similar to the syntax of npm packages.
infernus add openmultiplayer/open.mp samp-incognito/samp-streamer-plugin@^2.9.6
# production mode install deps (not copy inc files)
infernus add samp-incognito/samp-streamer-plugin@^2.9.6 -p
# Install all existing dependencies, similar to sampctl ensure
infernus install
# same as above, production mode install deps (not copy inc files)
infernus install -p
# Uninstall one or more dependencies
infernus remove openmultiplayer/open.mp samp-incognito/samp-streamer-plugin@^2.9.6
# Update a dependency (update global cache and apply to current directory)
infernus update openmultiplayer/open.mp
# Update a dependency to a specific version
infernus update openmultiplayer/open.mp@^1.2.0.2670
# Clear the lowest matching version of a single global dependency
infernus cache clean samp-incognito/samp-streamer-plugin@^2.9.6
# Clear all versions of a single global dependency
infernus cache clean samp-incognito/samp-streamer-plugin
# Clear all global cache dependencies
infernus cache clean -a
# Set a GitHub token to resolve API rate limit issues (on-demand).
# Note: environment variable gh_token will take precedence over the global config.
infernus config gh_token <your_github_token>
# Display global configuration information
infernus config -l
# Delete a global configuration
infernus config gh_token
Feature
- It only handles the most basic plugin dependency management, and does not manage pure
include
library. - Installed packages are cached in
~/infernus/dependencies
, and subsequent installations of the same version are copied directly instead of downloaded. - The configuration file is located at
~/infernus/config.json
, and currently only has agh_token
configuration item to solve the frequency limit of thegithub api
.
Manual
# Clone the repository through https protocol.
git clone https://github.com/dockfries/infernus-starter.git
# or use ssh protocol.
git clone git@github.com:dockfries/infernus-starter.git
# If you need raknet, clone the raknet branch
# git clone https://github.com/dockfries/infernus-starter.git -b raknet
# or use ssh protocol.
# git clone git@github.com:dockfries/infernus-starter.git -b raknet
# you can also download the repository directly from the github page.
# enter the project root directory.
cd infernus-starter
# modify the rcon password in config.json.
vim config.json # you don't necessarily need to use vim, any editor is fine.
# "rcon": {
# "password": "changeme" # change changeme to your own password.
#}
WARNING
The repository deleted the necessary files, to ensure that you always use the latest version dependencies and reduce the repository file size, which means you need to complete the files manually
The so/dll
depends on the environment in which you want to run the server, and you need to select the corresponding version to download according to the environment. Only so
is needed under linux
, and only dll
is needed under windows
.
Download omp game server, and later extract the
omp-server[.exe]
andcomponents
folders to the project root directory.Download samp-node plugin, and later extract the
libnode.so/dll
in the root directory of the project, andplugins
in theplugins
folder (if the root directory does not have aplugins
folder, you need to create it manually).Download streamer plugin, and later put
streamer.so/dll
in theplugins
folder.(If you needs to use raknet) download raknet plugin, and later put all files except the
.inc
suffix into thecomponents
folder.- replace
gamemodes/polyfill_raknet.amx
withgamemodes/polyfill.amx
, or modify thepawn.main_scripts
section of the root fileconfig.json
.
- replace
"pawn": {
"main_scripts": ["polyfill_raknet 1"],
},
Install dependency & dev
# installation dependency
pnpm install
# run development mode commands (start compilation, listen for changes and restart automatically)
pnpm dev
Build
# build for production environment
pnpm build
# run the server
pnpm serve