要求#
- 带 txAdmin 的 RedM 服务器(最新 artifacts)
- MariaDB 或 MySQL 数据库
- 来自 portal.cfx.re 的服务器密钥
- 开启 OneSync
docs.fivem.net - the official step by step guide to install txAdmin and create a server.
- 打开 txAdmin,选择 Remote URL Template。
- 粘贴配方链接:
https://raw.githubusercontent.com/NQ3Z/jrscore/main/recipe/jrscore.yaml- txAdmin 会下载脚本、创建数据库并自动写好 server.cfg。
- 启动服务器。
- 运行 INSTALL.bat。
- 输入服务器文件夹、MySQL 信息和服务器密钥。
- 安装器会复制脚本、创建数据库并写入 server.cfg。
- 在 txAdmin 中把 Server Data Folder 设为该文件夹并开启 OneSync。
- 把 resources 文件夹复制到服务器。
- 把 sql/jrscore.sql 导入空数据库。
- 复制 server.cfg 并修改 {{ }} 中的值。
数据库(XAMPP、HeidiSQL 或不用 XAMPP)#
JRS Core 把角色、物品和金钱保存在 MariaDB / MySQL 数据库中。选择一种运行方式,导入 sql/jrscore.sql,然后设置连接字符串。
- Download and install XAMPP. It includes MariaDB.
- Open the XAMPP Control Panel and press Start next to MySQL. Apache is not needed.
- Download and install HeidiSQL, the program used to manage the database.
- In HeidiSQL press New, set Network type to MariaDB or MySQL (TCP/IP), host
127.0.0.1, userroot, port3306, and press Open. - Right click the empty left panel, Create new > Database, name it
jrscoreand use the collationutf8mb4_general_ci. - Select
jrscore, choose File > Run SQL file... and picksql/jrscore.sql.
XAMPP starts with the user root and no password. That is fine on your own PC. On a public server create a dedicated user with a password (see the SQL below) and never open port 3306 to the internet.
- Install one database server: MariaDB Server (recommended) or MySQL Community Server. Write down the root password you choose.
- Create the database and a user. Open HeidiSQL or the command line and run:
CREATE DATABASE jrscore CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
CREATE USER 'jrs'@'localhost' IDENTIFIED BY 'change_this_password';
CREATE USER 'jrs'@'127.0.0.1' IDENTIFIED BY 'change_this_password';
GRANT ALL PRIVILEGES ON jrscore.* TO 'jrs'@'localhost';
GRANT ALL PRIVILEGES ON jrscore.* TO 'jrs'@'127.0.0.1';
FLUSH PRIVILEGES;- Import the tables:
mariadb -u jrs -p jrscore < sql/jrscore.sql(with MySQL the program is called mysql). Or use HeidiSQL: File > Run SQL file....
4. Manage it with HeidiSQL or DBeaver (works on Windows, Linux and macOS).
- Install Docker, then start a MariaDB container:
docker run -d --name jrs-db --restart unless-stopped \
-e MARIADB_ROOT_PASSWORD=change_this_password \
-e MARIADB_DATABASE=jrscore \
-p 127.0.0.1:3306:3306 \
-v jrs-db:/var/lib/mysql \
mariadb:11- Import the tables (works in any shell):
docker cp sql/jrscore.sql jrs-db:/jrscore.sql
docker exec jrs-db sh -c "mariadb -uroot -pchange_this_password jrscore < /jrscore.sql"The image page: hub.docker.com/_/mariadb. The 127.0.0.1: in -p keeps the database private to the machine.
Any MariaDB or MySQL host that your game server can reach works (a managed database, or a database on another VPS).
- Create a database
jrscoreand a user for it in the provider panel. - Allow the IP address of your game server only.
- Import
sql/jrscore.sqlwith HeidiSQL connected to that host. - Use the host name in the connection string below instead of
127.0.0.1.
Then tell the server how to connect. Put this line in server.cfg above ensure oxmysql:
set mysql_connection_string "mysql://jrs:[email protected]:3306/jrscore?charset=utf8mb4"With XAMPP and the root user without password it is mysql://[email protected]:3306/jrscore?charset=utf8mb4. If the password has special characters (@, :, /, #) replace them with their percent code (@ = %40) or choose a simpler password.
To check the connection start the server and look for [oxmysql] Database server connection established in the console. Not there? Check that MySQL is running, the port is 3306 and the database name is exact.
设置自己为所有者#
在 jrs_core/config/config.lua 的 Config.CoreOwners 中加入你的 Steam:
Config.CoreOwners = {
['steam:110000xxxxxxxxx'] = true,
}或在 jrs_users 表中把 group 设为 owner 或 admin。
加载顺序#
ensure oxmysql
ensure jrs_core
ensure jrs_inventory
ensure jrs_character自带的 server.cfg 已经是正确顺序。
不要在 ensure 行末尾写 # 注释,fxmanifest.lua 请保存为无 BOM 的 UTF-8。