samp.directory
← Scripts et bibliothèques

itsneufox/omp-test-bench

Community-built open.mp server. Send a PR, CI tests it, it ships.

Gamemode★ 1mis à jour il y a 4 joursGPL-3.0Pawn
Ouvrir sur GitHub

README.md

neufox's OMP Test Bench

Community test server for open.mp: accounts, class selection, an NPC playground exposing every NPC native as a command, NPC-driven trains, and the shell game. Modules are added by pull request; CI compiles with warnings as errors and runs the runtime, SQL and boot tests on every PR. Nothing merges red.

Live server: 57.128.171.112:7777, always running the latest release from main (check the build rule in the server browser).

Run

Release zip (precompiled): grab neufoxs-omp-test-bench.zip from the latest release. Rebuilt on every green push to main.

From source:

# MySQL/MariaDB running, empty database `basescript`
cp mysql.ini.example mysql.ini   # defaults: [email protected], no password
./build.sh                       # or build.bat / Ctrl+Shift+B in VS Code
./omp-server                     # or omp-server.exe

The first registered account becomes admin. The server stays locked (passworded) until startup finishes and relocks if MySQL drops.

Layout

gamemodes/
├── basescript.pwn          entry point (includes source/entry)
└── source/
    ├── entry.inc           module list, in load order
    ├── dependencies/       third-party includes (don't edit)
    ├── _template/          module skeleton to copy
    ├── server/             server-wide modules
    ├── playground/         every open.mp native as commands + tests (/pghelp)
    └── player/             per-player modules
filterscripts/npc_trains.pwn  5 NPC-driven trains (side script)
filterscripts/creator.pwn   Ultimate Creator map editor (side script, see creator.md)
filterscripts/tdstudio.pwn    Textdraw Studio, in-game textdraw editor (side script, tdstudio.md)
models/                     custom models served by artwork (Textdraw Studio icons)
npcmodes/recordings/        NPC recordings (trains, /startplayback)
components/
├── LINUX/default/          open.mp components (.so)
├── LINUX/*.so              third-party components (sscanf, Pawn.CMD)
├── WINDOWS/default/        open.mp components (.dll)
└── WINDOWS/*.dll           third-party components
plugins/                    legacy plugins (.so + .dll)
qawno/                      Pawn compiler + open.mp includes
tests/                      test harness, lint, native coverage, SQL suite
deploy/                     VPS setup + auto-updater

Modules

ModuleWhat it does
server/miscconstants, colours, message helpers
server/buildbuild tag, commit and date as query rules (build, commit, built)
server/operationstartup/outage lock, OnServerReady
server/databaseMySQL connection, Database_Query / Database_Execute
server/clockin-game time
server/vehiclespersonal vehicles
server/worldplayground vehicles/object/actor, per-player tracking, /cleanup
server/npcsevery NPC native as a command, debug panel, patrols, playback, nodes
server/shellgame8 shell game tables, bets use account money
playground/*15 areas (players, vehicles, actors, textdraws, menus, gang zones, objects, pickups, checkpoints, labels, variables, database, network, core, files): a command for every native and a test against its docs page. /pghelp lists them
server/autotestNPC/vehicle/object/actor self-test (/runautotest, also run in CI)
player/variablesper-player state, getters/setters
player/accountsregister/login (bcrypt), saving, OnPlayerLogin
player/spawnsclass selection (Spawn_Classes), spawn points
player/commandscore commands + login/permission gate

Each module has a README.md with its API.

Commands

Two levels: everyone (0) and admin (1). It's a test server, so only moderation and server-wide NPC state are admin-only.

LevelCommands
0/help /stats /pm /time /kill /skin /pos /changepassword /v /myvehicles /dv
0 (testing)/goto /gethere /heal /givemoney /setmoney /settime /runautotest
0 (playground)/npchelp (~150 NPC commands), /worldhelp, /spawnvehicles, /createobject, /createactor, /playgroundstatus, /cleanup
0 (map editor)/edit (or /flymode) enters and leaves Ultimate Creator; its other commands work inside it. Maps are kept in virtual world 9000 (filterscripts/creator.md)
0 (textdraw studio)/tdstudio (enter/leave), /tdmouse — filterscripts/tdstudio.md
0 (shell game)/table [0-7], /table0–/table7, /shell, /left, /centre /center, /right, /shellstop, /shellstatus, /togglelog
1/acmds /kick /ban /announce /setadmin /lockserver /unlockserver /npcloadrecord /npcunloadrecord /npcunloadallrecords /npcopennode /npcclosenode /npcsetnodepoint, /claimnpc on any NPC

No global textdraws: config.json sets "textdraw": {"global_limit": 0, "player_limit": 2304} (the client's 2304 slots all go to player textdraws), so everything uses player textdraws.

All commands require login (player/commands/gate.inc); the map editor's commands are handled by the filterscript before the gate, but /edit needs a spawned player, so a login. RCON admins bypass levels. Playground resources are per-player and freed on disconnect. NPCs use player slots: max_bots in config.json (20), the trains take 5.

Every native in the bundled includes is called by a test and checked against its open.mp docs page (tests/coverage.py, 1014 of 1029; the 15 others are allowlisted in tests/coverage_allow/ with a reason). What that turned up, including server crashes, is in FINDINGS.md.

Build

pawncc gamemodes/basescript.pwn -Dgamemodes \
  -igamemodes/source/dependencies -iqawno/include \
  '-;+' '-(+' '-d3' '-Z+'        # CI adds -E (warnings are errors)

Filterscripts: pawncc filterscripts/<name>.pwn -igamemodes/source/dependencies -iqawno/include -ofilterscripts/<name>.amx '-;+' '-(+' '-d3' '-Z+' (the release zip has them compiled).

Tests

python3 tests/lint.py                          # repo rules
python3 tests/run.py [--seed N] [--iterations N] # runtime + every module's tests.inc
python3 tests/run.py --smoke                   # boot + gmx on the real entry point
python3 tests/coverage.py --report             # every native used by a test
python3 tests/sql.py                           # SQL templates vs real MariaDB

Needs 32-bit libs (libc6:i386 libstdc++6:i386 libatomic1:i386) or --qemu. Details in TESTING.md, how to write tests in CONTRIBUTING.md.

CI

Every PR: lint + native coverage → runtime (seeds 723104, 42, per-run random) · smoke · SQL · Windows compile → All checks passed (the required check). Green pushes to main publish a release.

Deploy

The live server pulls releases; GitHub has no access to it. deploy/testbench-update (systemd timer, every 2 min) installs a new release into /srv/testbench/releases/<tag>, switches current, restarts testbench.service and waits for Startup complete. A build that doesn't boot is rolled back and skipped until a newer one. Server data (mysql.ini, scriptfiles/, logs, bans, config.local.json overrides) lives in /srv/testbench/shared.

sudo sh deploy/setup.sh                 # one time: MariaDB, 32-bit libs, user, DB, firewall, first install
sudo testbench-update --rollback        # back to the previous release
journalctl -u testbench -f              # server console

Bundled

PartVersion
open.mp server + components1.6.7.3235, built from open.mp#1250 (configurable textdraw pools)
Pawn compiler + open.mp includes3.10.11
PawnPlus1.5.3
MySQLR41-4
samp-bcrypt0.4.1
crashdetect4.22
sscanf2.13.8
Pawn.CMD3.4.0-omp
Streamer2.9.6
Ultimate Creator (filterscript, AGPL-3.0, patched: creator.md)1.4.6
foreach (MPL-1.1)2.2.8
neufox's shell game
Textdraw Studio (devbluen)1.9.1, ported as filterscripts/tdstudio, permission pending
pp_hooks, tdialogs, y_unique

Local patches: pp_hooks (crashdetect startup warning), tdialogs (% in dialog input), Ultimate Creator (open.mp includes, editor virtual world; listed in creator.md).

License

GPL-3.0 for this repo's code. Bundled third-party binaries and includes keep their own licenses. Module layout from LongWayDrivers.

communitygamemodeopen-mppawnsamp

Cette page est construite à partir de ce que GitHub publie sur le dépôt. samp.directory n’héberge pas le code. Signaler un problème avec cette fiche

itsneufox/omp-test-bench : Gamemode SA-MP | samp.directory