How to Install ReAPI (AMXX Module) on ReHLDS

May 13, 2026 Daemon666 8 min read 313 vues

ReAPI is an AMX Mod X module that exposes the internals of ReHLDS and ReGameDLL_CS to Pawn plugins as proper hooks — RegisterHookChain() — instead of the entity-poking and message-intercepting tricks plugins used for fifteen years. A ReAPI hook on RG_CBasePlayer_TakeDamage is faster, cleaner, and can change the outcome of the call, which Ham Sandwich cannot always do.

Hard prerequisite: ReAPI needs ReGameDLL_CS. It hooks functions that only exist there. It will not give you game hooks on a stock cs.so, and installing it on a Valve game DLL is the source of most "ReAPI natives don't work" reports.

1. Confirm the stack below it

In the server console, all four must answer:

rehlds_version
regamedll_version
meta version
amxx version

Anything that comes back Unknown command is a layer you have to install first: ReHLDS, ReGameDLL, Metamod-r, AMX Mod X.

2. Get a build for your AMXX version

Download the ReAPI release from the project's GitHub releases page. The archive contains builds for both AMXX 1.8.2 and 1.9/1.10 — take the one matching your AMXX. A ReAPI built for 1.10 dropped into a 1.9 install produces:

Module was compiled for a newer AMXX version

3. Install the module and the includes

cd /home/steam/hlds/cstrike/addons/amxmodx

# the module
cp /path/to/reapi/modules/reapi_amxx_i386.so modules/
chmod 644 modules/reapi_amxx_i386.so

# the includes, so you can compile plugins against it
cp /path/to/reapi/scripting/include/*.inc scripting/include/

The includes matter as much as the module. ReAPI ships reapi.inc plus a set of supporting includes (reapi_engine.inc, reapi_gamedll.inc, hook-chain constants, entity offsets). Copy all of them, not just reapi.inc, or your compiles will fail on undefined symbols like RG_CBasePlayer_Spawn.

4. Enable it

ReAPI is auto-loaded when a plugin requires it, but list it explicitly in configs/modules.ini so you can see it in amxx modules even with no plugins using it yet:

fun
engine
fakemeta
cstrike
csx
hamsandwich
reapi

Restart the server. A map change does not load new modules.

5. Verify

amxx modules
Currently loaded modules:
      name        version   author    status
 [ 7] ReAPI       5.x       s1lent    running
7 modules, 7 correct

"N correct" must equal "N modules". A ReAPI line showing error means the module loaded but could not find ReGameDLL — go back and check regamedll_version.

6. A minimal ReAPI plugin

This is the shape of every ReAPI plugin. It blocks fall damage — something that used to take a Ham Sandwich hook and a bit of guesswork:

#include <amxmodx>
#include <reapi>

public plugin_init()
{
    register_plugin("No Fall Damage", "1.0", "you")
    RegisterHookChain(RG_CBasePlayer_TakeDamage, "OnTakeDamage_Pre", false)
}

public OnTakeDamage_Pre(const id, inflictor, attacker, Float:damage, damageBits)
{
    if (damageBits & DMG_FALL)
    {
        SetHookChainReturn(ATYPE_INTEGER, 0)
        return HC_SUPERCEDE
    }
    return HC_CONTINUE
}

Compile it against your ReAPI includes:

cd /home/steam/hlds/cstrike/addons/amxmodx/scripting
./amxxpc nofalldamage.sma -o compiled/nofalldamage.amxx
cp compiled/nofalldamage.amxx ../plugins/

Add nofalldamage.amxx to configs/plugins.ini, change the map, and check amxx plugins.

Key concepts

  • RegisterHookChain(hook, "callback", post)post false = before the original runs, true = after.
  • HC_CONTINUE — let the original run. HC_SUPERCEDE — do not run it at all.
  • SetHookChainReturn() — change what the original would have returned. This is the thing Ham Sandwich cannot reliably do.
  • RG_* hooks are ReGameDLL (game logic). RH_* hooks are ReHLDS (engine). If you only have ReHLDS and not ReGameDLL, the RH_* hooks work and the RG_* ones do not — which is exactly the half-broken state that generates confused forum posts.

Common errors

  • Function not found: RegisterHookChain / Native not found — the module is not loaded. Check amxx modules. If ReAPI is not listed, the .so is missing from modules/ or is the wrong AMXX build. Full walkthrough: native not found after installing ReAPI.
  • error 017: undefined symbol "RG_CBasePlayer_TakeDamage" at compile time — you copied reapi.inc but not the rest of the includes.
  • The module is running but hooks never fire — you are on a stock Valve cs.so. regamedll_version will tell you in one command.
  • Module was compiled for a newer AMXX version — wrong ReAPI build for your AMXX. Take the one from the matching directory in the archive.
  • Server crashes at map start after adding ReAPI — a ReAPI far newer than your ReGameDLL, or vice versa. Update both to current releases from the same period.

Verification checklist

  1. regamedll_version answers.
  2. amxx modules shows ReAPI running, and N modules, N correct.
  3. A trivial ReAPI plugin compiles and loads.
  4. Its hook actually fires in game — jump off something high with the fall-damage plugin loaded and take zero damage.

That last one is the only test that proves the whole chain — module, ReGameDLL, and hook registration — is genuinely wired together.

Contributeurs: Daemon666 ✦
Partager :