--- title: "How to Install ReAPI (AMXX Module) on ReHLDS" excerpt: "Install the ReAPI module for AMX Mod X on a ReHLDS + ReGameDLL server, compile plugins against it, and fix the 'native not found' errors." category: "installation" tags: "reapi, amxmodx" image: "" read_time: "8 min read" ---
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.
In the server console, all four must answer:
version regamedll_version meta version amxx version
version must show a ReHLDS version: line, and the others must print their versions. Anything that does not is a layer you have to install first: ReHLDS, ReGameDLL, Metamod-r, AMX Mod X.
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.9/1.10 dropped into a 1.8.2 install fails to load: amxx modules shows it as newer, and the log has a line like this, naming the core function 1.8.2 does not have (the misspelling is 1.8.2's own):
Module requested a not exisitng function (file "...reapi_amxx_i386.so") (func "...")
See that error.
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.
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.
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.
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.
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.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.running but hooks never fire — you are on a stock Valve cs.so. regamedll_version will tell you in one command.Module requested a not exisitng function, status newer — wrong ReAPI build for your AMXX. Take the one from the matching directory in the archive.regamedll_version answers.amxx modules shows ReAPI running, and N modules, N correct.That last one is the only test that proves the whole chain — module, ReGameDLL, and hook registration — is genuinely wired together.