Utility code for metamod plugins. It handles metamod initialization so that you only need to define PluginInit()
, PluginExit()
, and a Plugin_info
struct to create a functional plugin. Private API headers for Sven Co-op are included so you can use game-specific data/functions for things like CBaseEntity and CBasePlayer.
Some non-trivial utilities included here:
- Text menus
- g_Scheduler (like in Angelscript)
- PlaySound
- Network sockets
MetaHelper.as exists for private APIs and hooks which are not accessible to metamod plugins. As ApiGenerator improves, fewer of those functions will be necessary.
- Download the code and extract the "example_project" folder somewhere
- Open a shell in the example_project folder and run these commands to setup a git repo with the mmlib submodule
git init
git submodule add https://github.com/wootguy/mmlib
- Open
CMakeLists.txt
and edit the name of the project and add source files to theSOURCE_FILES
list. - Open
mmlib/CMakelists.txt
and make sure the path to Sven Co-op is correct. - Run
msvc.bat
to generate Visual Studio project files - Open the Visual Studio solution, then right click the
mmlib_example
project and selectSet as startup project
- Add
win32 addons/metamod/dlls/mmlib_example.dll
to your metamodplugins.ini
file - Press F5 in VS. The game should start up with the debugger attached.
- Type something in chat and the example plugin should tell you something.
To pull updates from this mmlib repo into your project, run:
git submodule update --recursive --remote
Most of my plugins don't change the mmlib build process and so you can follow the instructions below to build them all.
Windows:
- Intall Git for windows, CMake, and Visual Studio 2022 (select "Desktop development with C++")
- Open a command prompt somewhere and run this command to download the code (replace
PluginName
with the name of the plugin repo):git clone --recurse-submodules https://github.com/wootguy/PluginName
- Open the folder that was created and run
build.bat
Linux:
- Install Git, CMake, and a compiler.
Debian:sudo apt install build-essential git cmake
- Open a terminal somewhere and and run these commands, replacing
PluginName
with the name of the plugin repo:git clone --recurse-submodules https://github.com/wootguy/PluginName cd PluginName sh build.sh