| name | gtamodx-plugins-dev |
|---|---|
| description | GTAMODX 插件(ASI / plugin-sdk)子 skill — Call、Events、Patch、Pattern、Command、Extender、实体 C++。写 .asi、plugin:: 时加载。 |
Docs Root: https://gtadev.miomoe.cn/docs/plugins
Loaded from parent SKILL.md. Hard constraints for plugin-sdk ASI work.
Upstream: DK22Pac/plugin-sdk. Site = 高频精选; long-tail headers = local SDK.
#include "plugin.h"| Macro | Meaning |
|---|---|
GTA3 / GTAVC / GTASA |
build target |
BY_GAME(iii, vc, sa) |
pick per game |
Priority (from plugin-base):
existing C++ wrapper → Command → Call → patch last
Doc: plugins/plugin-base.mdx · namespace plugin
| Scene | Use |
|---|---|
| compile-time addr, cdecl | Call / CallAndReturn |
| thiscall | CallMethod / CallMethodAndReturn |
| runtime addr (Pattern / relocate) | CallDyn* |
| absolute addr, no base add | *DynGlobal |
| vtable slot | CallVirtualMethod* |
plugin::Call<0x53BEE0>();
int value = plugin::CallAndReturn<int, 0x53BEE0>();MUST NOT Call game logic from static ctor / DllMain / before pools / after device Lost (render path).
Doc: plugins/events.mdx · plugin::Events
- Register with
+=in static global object ctor; instance must exist. - Touch game objects only inside callbacks.
| Phase | OK | Avoid |
|---|---|---|
| static ctor | +=, own ini |
FindPlayerPed, spawn |
initRwEvent |
textures, Pattern, config | assume player exists |
initPoolsEvent |
Extender pool alloc | iterate missing entities |
processScriptsEvent |
logic, Command, keys | heavy IO |
drawing / drawHud |
2D draw | create/delete entities |
*DtorEvent |
free side data | use pointer after |
class MyPlugin {
public:
MyPlugin() {
plugin::Events::processScriptsEvent += OnProcessScripts;
plugin::Events::drawingEvent += OnDraw;
}
private:
static void OnProcessScripts() {}
static void OnDraw() {}
};
MyPlugin g_my_plugin;- Patch (
plugins/patch.mdx):plugin::patch::Nop/ r/w / jumps; reversible mods MUST backup. - Pattern (
plugins/pattern.mdx): locate thenCallDynor patch.
Doc: plugins/commands.mdx
- Call from
processScriptsEvent(or equally safe script tick). plugin::Command<plugin::Commands::NAME>(...).- Return = script condition result, not vague “success”.
- NOT CLEO Lua/Redux — script opcodes → cleo-dev.md.
| Topic | Path |
|---|---|
| Ped/Vehicle/Object data | plugins/extender.mdx |
| paths / screen / Config / KeyCheck | plugins/extensions/** |
| sprites / audio / shaders | plugins/utils/** |
| SA game classes | plugins/entities/** |
| recipes | plugins/index.mdx, plugins/recipes.mdx |
Entity pages: module note → <Api> (desc + signature + call). Page signatures win.
#include "plugin.h"
class Minimal {
public:
Minimal() {
plugin::Events::initRwEvent += [] {};
plugin::Events::processScriptsEvent += [] {};
plugin::Events::drawingEvent += [] {};
}
} g_minimal;FindPlayer*/ spawn / render fromDllMainor static ctor.- Treat CLEO
writeMemory/Car.Createas C++ APIs. - Assume full
game_saheaders or fullScriptCommandsenum are on-site.
- State selection reason (why Call vs Patch, etc.).
- Examples include needed
#includeand event hook point. - Addresses/RVA are version-sensitive; prefer docs; Pattern when available.