Unknown ❤ RESPAWN.ZAFEST.RO | VIP FREE | FREE FOR ALL ❤ 0/32
Romania XPlayZM.CSBlackDevil.COM # Zombie Plague UltimateX [ Respawn + FDL + VIP 22-12PM + POINTS] ® 16/32
Promouvoir serveur

Add install-reapi/en.md

Browse Source
Daemon666 committed parent 004dd9139c commit a2011b9c24bdca8250e21db48811ba2216634852
1 changed file with 105 additions and 0 deletions
+105 -0 install-reapi/en.md A
@@ -0,0 +1,105 @@
1 +---
2 +title: "How to Install ReAPI (AMXX Module) on ReHLDS"
3 +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."
4 +category: "installation"
5 +tags: "reapi, amxmodx"
6 +image: ""
7 +read_time: "8 min read"
8 +---
9 +<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>
10 +
11 +<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>
12 +
13 +<h2>1. Confirm the stack below it</h2>
14 +<p>In the server console, all four must answer:</p>
15 +<pre>rehlds_version
16 +regamedll_version
17 +meta version
18 +amxx version</pre>
19 +<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>
20 +
21 +<h2>2. Get a build for your AMXX version</h2>
22 +<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>
23 +<pre>Module was compiled for a newer AMXX version</pre>
24 +
25 +<h2>3. Install the module and the includes</h2>
26 +<pre>cd /home/steam/hlds/cstrike/addons/amxmodx
27 +
28 +# the module
29 +cp /path/to/reapi/modules/reapi_amxx_i386.so modules/
30 +chmod 644 modules/reapi_amxx_i386.so
31 +
32 +# the includes, so you can compile plugins against it
33 +cp /path/to/reapi/scripting/include/*.inc scripting/include/</pre>
34 +<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>
35 +
36 +<h2>4. Enable it</h2>
37 +<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>
38 +<pre>fun
39 +engine
40 +fakemeta
41 +cstrike
42 +csx
43 +hamsandwich
44 +reapi</pre>
45 +<p><strong>Restart the server.</strong> A map change does not load new modules.</p>
46 +
47 +<h2>5. Verify</h2>
48 +<pre>amxx modules</pre>
49 +<pre>Currently loaded modules:
50 + name version author status
51 + [ 7] ReAPI 5.x s1lent running
52 +7 modules, 7 correct</pre>
53 +<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>
54 +
55 +<h2>6. A minimal ReAPI plugin</h2>
56 +<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>
57 +<pre>#include &lt;amxmodx&gt;
58 +#include &lt;reapi&gt;
59 +
60 +public plugin_init()
61 +{
62 + register_plugin("No Fall Damage", "1.0", "you")
63 + RegisterHookChain(RG_CBasePlayer_TakeDamage, "OnTakeDamage_Pre", false)
64 +}
65 +
66 +public OnTakeDamage_Pre(const id, inflictor, attacker, Float:damage, damageBits)
67 +{
68 + if (damageBits &amp; DMG_FALL)
69 + {
70 + SetHookChainReturn(ATYPE_INTEGER, 0)
71 + return HC_SUPERCEDE
72 + }
73 + return HC_CONTINUE
74 +}</pre>
75 +<p>Compile it against your ReAPI includes:</p>
76 +<pre>cd /home/steam/hlds/cstrike/addons/amxmodx/scripting
77 +./amxxpc nofalldamage.sma -o compiled/nofalldamage.amxx
78 +cp compiled/nofalldamage.amxx ../plugins/</pre>
79 +<p>Add <code>nofalldamage.amxx</code> to <code>configs/plugins.ini</code>, change the map, and check <code>amxx plugins</code>.</p>
80 +
81 +<h2>Key concepts</h2>
82 +<ul>
83 +<li><code>RegisterHookChain(hook, "callback", post)</code> — <code>post</code> false = before the original runs, true = after.</li>
84 +<li><code>HC_CONTINUE</code> — let the original run. <code>HC_SUPERCEDE</code> — do not run it at all.</li>
85 +<li><code>SetHookChainReturn()</code> — change what the original would have returned. This is the thing Ham Sandwich cannot reliably do.</li>
86 +<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>
87 +</ul>
88 +
89 +<h2>Common errors</h2>
90 +<ul>
91 +<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>
92 +<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>
93 +<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>
94 +<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>
95 +<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>
96 +</ul>
97 +
98 +<h2>Verification checklist</h2>
99 +<ol>
100 +<li><code>regamedll_version</code> answers.</li>
101 +<li><code>amxx modules</code> shows ReAPI <code>running</code>, and <em>N modules, N correct</em>.</li>
102 +<li>A trivial ReAPI plugin compiles and loads.</li>
103 +<li>Its hook actually fires in game — jump off something high with the fall-damage plugin loaded and take zero damage.</li>
104 +</ol>
105 +<p>That last one is the only test that proves the whole chain — module, ReGameDLL, and hook registration — is genuinely wired together.</p>
0 106