Skip to content
This repository has been archived by the owner on Dec 24, 2023. It is now read-only.

Server API

tmp64 edited this page Jan 6, 2021 · 2 revisions

Summary

The server exposes IBugfixedServer interface for Metamod plugins and there is also an AMX Mod X module that adds C++ API natives to AMXX.

C++ header and AMXX include are well-documented and can be found here (C++) or here (AMXX).

C++ API (Metamod)

To use the API in your Metamod module you need to do the following:

  1. Copy IBugfixedServer.h from [repo dir]/bugfixedapi.
  2. Copy interface.h, interface.cpp and enum_utils.h from [repo dir]/common.
  3. Copy CGameVersion.h, CGameVersion.cpp and ClientSupportsFlags.h from [repo dir]/game_shared.
  4. Copy (those are the last files, I promise) bhl_api.h and bhl_api.cpp from *[repo dir]/bugfixedapi_amxx.
  5. Include bhl_api.h in the main file of your module.
  6. Call InitServerApi() from void OnAmxxAttach(). This function returns E_ApiInitResult. Check bhl_api.h for details.

The API can be used using serverapi() function which returns a pointer to IBugfixedServer.

AMX Mod X API

  1. Copy bugfixedapi.inc from [repo dir]/gamedir/addons/amxmodx/scripting/include/bugfixedapi.inc to addons/amxmodx/scripting/include.
  2. Include bugfixedapi.inc in your plugin.
  3. You're done.