How I built an ASI plugin that adds custom features to peds, weapons, and vehicle components in GTA San Andreas using C++ and DirectX.
ModelExtras is an open-source ASI plugin for GTA San Andreas that extends the game's ped, weapon, and vehicle systems. Inspired by projects like VehFuncs and ImVehFt, it adds thousands of customizable features.
The plugin hooks into the game's rendering pipeline using a DirectX 9 hook:
// Hook into the rendering pipeline
void InstallRenderHook() {
// Save original function pointer
oDrawFrame = (DrawFrame_t)memcpy_alloc(
(void*)0x53E220, 5
);
// Write detour
*(BYTE*)0x53E220 = 0xE9;
*(DWORD*)(0x53E221) = (DWORD)hkDrawFrame - 0x53E226;
}
When modifying every frame's render call, performance is critical. I implemented:
With over 50,000 downloads, ModelExtras has become a staple in the GTA SA modding community. The open-source nature has led to community contributions and forks that extend its functionality even further.