Romania XPlayZM.CSBlackDevil.COM # Zombie Plague UltimateX [ Respawn + FDL + VIP 22-12PM + POINTS] ® 31/32
Unknown ❤ RESPAWN.ZAFEST.RO | VIP FREE | FREE FOR ALL ❤ 0/32
France EMIRATES.KiNGS 亗 GAMEAREA ||͇̿P͇̿U͇̿B͇̿L͇̿I͇̿C͇̿| ✪ 32/32
Promocionar servidor
105 lines 6.5 KiB Markdown Source Rendered Raw Permalink History
---
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"
---
<p>ReAPI is an AMX Mod X module that exposes the internals of ReHLDS and ReGameDLL_CS to Pawn plugins as proper hooks — <code>RegisterHookChain()</code> — instead of the entity-poking and message-intercepting tricks plugins used for fifteen years. A ReAPI hook on <code>RG_CBasePlayer_TakeDamage</code> is faster, cleaner, and can change the outcome of the call, which Ham Sandwich cannot always do.</p>

<p><strong>Hard prerequisite:</strong> ReAPI needs <a href="/tutorials/install-regamedll-cs16">ReGameDLL_CS</a>. It hooks functions that only exist there. It will not give you game hooks on a stock <code>cs.so</code>, and installing it on a Valve game DLL is the source of most "ReAPI natives don't work" reports.</p>

<h2>1. Confirm the stack below it</h2>
<p>In the server console, all four must answer:</p>
<pre>rehlds_version
regamedll_version
meta version
amxx version</pre>
<p>Anything that comes back <code>Unknown command</code> is a layer you have to install first: <a href="/tutorials/install-rehlds-on-linux">ReHLDS</a>, <a href="/tutorials/install-regamedll-cs16">ReGameDLL</a>, <a href="/tutorials/install-metamod-r">Metamod-r</a>, <a href="/tutorials/install-amx-mod-x-1-9">AMX Mod X</a>.</p>

<h2>2. Get a build for your AMXX version</h2>
<p>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 — <strong>take the one matching your AMXX</strong>. A ReAPI built for 1.10 dropped into a 1.9 install produces:</p>
<pre>Module was compiled for a newer AMXX version</pre>

<h2>3. Install the module and the includes</h2>
<pre>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/</pre>
<p>The includes matter as much as the module. ReAPI ships <code>reapi.inc</code> plus a set of supporting includes (<code>reapi_engine.inc</code>, <code>reapi_gamedll.inc</code>, hook-chain constants, entity offsets). Copy all of them, not just <code>reapi.inc</code>, or your compiles will fail on undefined symbols like <code>RG_CBasePlayer_Spawn</code>.</p>

<h2>4. Enable it</h2>
<p>ReAPI is auto-loaded when a plugin requires it, but list it explicitly in <code>configs/modules.ini</code> so you can see it in <code>amxx modules</code> even with no plugins using it yet:</p>
<pre>fun
engine
fakemeta
cstrike
csx
hamsandwich
reapi</pre>
<p><strong>Restart the server.</strong> A map change does not load new modules.</p>

<h2>5. Verify</h2>
<pre>amxx modules</pre>
<pre>Currently loaded modules:
      name        version   author    status
 [ 7] ReAPI       5.x       s1lent    running
7 modules, 7 correct</pre>
<p>"N correct" must equal "N modules". A ReAPI line showing <code>error</code> means the module loaded but could not find ReGameDLL — go back and check <code>regamedll_version</code>.</p>

<h2>6. A minimal ReAPI plugin</h2>
<p>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:</p>
<pre>#include &lt;amxmodx&gt;
#include &lt;reapi&gt;

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 &amp; DMG_FALL)
    {
        SetHookChainReturn(ATYPE_INTEGER, 0)
        return HC_SUPERCEDE
    }
    return HC_CONTINUE
}</pre>
<p>Compile it against your ReAPI includes:</p>
<pre>cd /home/steam/hlds/cstrike/addons/amxmodx/scripting
./amxxpc nofalldamage.sma -o compiled/nofalldamage.amxx
cp compiled/nofalldamage.amxx ../plugins/</pre>
<p>Add <code>nofalldamage.amxx</code> to <code>configs/plugins.ini</code>, change the map, and check <code>amxx plugins</code>.</p>

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

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

<h2>Verification checklist</h2>
<ol>
<li><code>regamedll_version</code> answers.</li>
<li><code>amxx modules</code> shows ReAPI <code>running</code>, and <em>N modules, N correct</em>.</li>
<li>A trivial ReAPI plugin compiles and loads.</li>
<li>Its hook actually fires in game — jump off something high with the fall-damage plugin loaded and take zero damage.</li>
</ol>
<p>That last one is the only test that proves the whole chain — module, ReGameDLL, and hook registration — is genuinely wired together.</p>