Skip to content

Developer API

Caner Karaca edited this page Sep 15, 2026 · 1 revision

💻 Developer API (C-ABI)

ModelExtras v3.0+ provides a rich, standard C-ABI export interface allowing other ASI plugins, CLEO / MoonLoader scripts, SA-MP client plugins, or external modding tools to dynamically read and control vehicle lights, sirens, plates, exhausts, gauges, animations, and materials at runtime.


📦 Header & Linking

Include ModelExtrasAPI.h in your C/C++ project or load functions dynamically using GetProcAddress() on ModelExtras.asi:

#include "ModelExtrasAPI.h"

// Check if ModelExtras is loaded and verify API compatibility
if (ME_GetAPIVersion() >= 30001) {
    // API is ready to use
}

🛠️ API Reference

1. Core & Lifecycle Management

Function Description
int ME_GetAPIVersion() Returns API interface version (e.g. 30001).
int ME_GetVersion() Returns ModelExtras version number (e.g. 30000).
bool ME_IsFeatureAvail(ME_FeatureID featureId) Checks whether a specific feature is enabled in INI and initialized.
void ME_Reload() Triggers hot-reload of all configurations and features across all vehicles.
void ME_ReloadVehicle(CVehicle *pVeh) Reloads JSONC configuration for a specific vehicle.

2. Vehicle Lights & Indicators

Function Description
bool ME_GetVehicleLightState(CVehicle *pVeh, ME_LightID lightId) Returns whether a specific light is currently turned on.
void ME_SetVehicleLightState(CVehicle *pVeh, ME_LightID lightId, bool state) Sets the state of a light dummy/material.
bool ME_IsLightAvailable(CVehicle *pVeh, ME_LightID lightId) Returns true if the vehicle has matching nodes/materials for this light type.
int ME_GetIndicatorState(CVehicle *pVeh) Returns current indicator state (0: Off, 1: Left, 2: Right, 3: Hazard).
void ME_SetIndicatorState(CVehicle *pVeh, int state) Sets turn indicator state (ME_IndicatorOff, ME_IndicatorLeft, ME_IndicatorRight, ME_IndicatorBoth).
int ME_GetLightOverride(CVehicle *pVeh) Returns light override mode (0: None, 1: Force Off, 2: Force On).
void ME_SetLightOverride(CVehicle *pVeh, int overrideMode) Forces vehicle headlights/taillights state.

3. Sirens & Emergency Lighting

Function Description
int ME_GetSirenStateCount(CVehicle *pVeh) Returns the number of defined siren pattern states for this vehicle.
int ME_GetSirenStateCountByModel(int modelIndex) Returns siren state count by vehicle model ID.
int ME_GetSirenState(CVehicle *pVeh) Returns the current active siren pattern stage index.
bool ME_SetSirenState(CVehicle *pVeh, int state) Sets active siren stage pattern.
int ME_GetSirenSoundMode(CVehicle *pVeh) Returns current active audio tone index (1 to 9).
bool ME_SetSirenSoundMode(CVehicle *pVeh, int soundMode) Changes the siren sound tone / mode.
bool ME_GetSirenMute(CVehicle *pVeh) Returns whether the siren sound is muted.
void ME_SetSirenMute(CVehicle *pVeh, bool mute) Mutes or unmutes siren audio playback.
bool ME_IsSirenActive(CVehicle *pVeh) Returns true if emergency lighting or sirens are active.
bool ME_IsSirenVehicle(CVehicle *pVeh) Returns true if vehicle model has siren configuration.
bool ME_IsCustomSirenPlaying(CVehicle *pVeh) Returns true if 3D custom siren audio stream is currently playing.

4. HD License Plates

Function Description
bool ME_GetPlateText(CVehicle *pVeh, char *outBuffer, int maxLen) Reads custom license plate string into the buffer.
bool ME_SetPlateText(CVehicle *pVeh, const char *text) Sets a custom plate text string and regenerates the plate texture.
bool ME_HasCustomPlate(CVehicle *pVeh) Returns true if vehicle is using custom HD license plate rendering.

5. Carcols & Vehicle Colors

Function Description
bool ME_GetVehicleColors(CVehicle *pVeh, ME_Color *col1, ME_Color *col2, ME_Color *col3, ME_Color *col4) Retrieves all 4 custom RGBA colors.
bool ME_SetVehicleColors(CVehicle *pVeh, ME_Color col1, ME_Color col2, ME_Color col3, ME_Color col4) Sets all 4 custom RGBA colors.
int ME_GetCarcolVariationCount(int modelIndex) Returns number of custom carcol color variation presets for the model.
int ME_GetCarcolVariation(CVehicle *pVeh) Returns current carcol variation index.
bool ME_SetCarcolVariation(CVehicle *pVeh, int variationIndex) Applies a specific color variation index.

6. Exhausts, Nitro & Backfire

Function Description
unsigned int ME_GetExhaustCount(CVehicle *pVeh) Returns the number of active exhaust points on the vehicle.
ME_ExhaustInfo ME_GetExhaustData(CVehicle *pVeh, int index) Retrieves exhaust particle size, speed, lifetime, and color data.
void ME_SetExhaustData(CVehicle *pVeh, int index, ME_ExhaustInfo &data) Updates exhaust particle properties at runtime.
void ME_TriggerNitro(CVehicle *pVeh, bool enable) Activates / deactivates NOS exhaust flames and dynamic point lights.
void ME_TriggerBackfire(CVehicle *pVeh, bool bPlaySound) Manually triggers an exhaust flame pop-and-bang effect.
bool ME_IsBackfireActive(CVehicle *pVeh) Returns true if backfire flames are actively discharging.

7. Dashboard Gauges, LEDs & Odometer

Function Description
float ME_GetVehicleMileage(CVehicle *pVeh) Returns vehicle total accumulated mileage in kilometers.
void ME_SetVehicleMileage(CVehicle *pVeh, float mileageKm) Sets total vehicle odometer mileage.
bool ME_GetDashboardLEDState(CVehicle *pVeh, ME_LightID ledId) Checks state of dashboard warning / status LED indicators.
void ME_SetDashboardLEDState(CVehicle *pVeh, ME_LightID ledId, bool state) Manually sets dashboard indicator LED state.

8. Dirt FX & Texture Remapping

Function Description
float ME_GetDirtLevel(CVehicle *pVeh) Returns current vehicle dirtiness level (0.0 = clean, 15.0 = max dirt).
void ME_SetDirtLevel(CVehicle *pVeh, float dirtLevel) Sets vehicle dirtiness level and updates texture blending.
int ME_GetRemapIndex(CVehicle *pVeh) Returns active texture remapping index.
void ME_SetRemapIndex(CVehicle *pVeh, int remapIndex) Changes active texture remapping livery / variation.

9. Dynamic Animations & Features

Function Description
bool ME_IsRoofOpen(CVehicle *pVeh) Returns convertible roof open/closed state.
void ME_SetRoofOpen(CVehicle *pVeh, bool open) Controls convertible roof animation.
float ME_GetSpoilerAngle(CVehicle *pVeh, int spoilerIndex) Returns current angle of active aerodynamic spoiler.
bool ME_IsRollbackBedExpanded(CVehicle *pVeh) Returns whether tow truck rollback bed is extended.
void ME_SetRollbackBedExpanded(CVehicle *pVeh, bool expanded) Extends or retracts rollback recovery bed.
bool ME_IsSpotlightActive(CVehicle *pVeh) Returns whether police/utility spotlight beam is active.
void ME_SetSpotlightActive(CVehicle *pVeh, bool active) Toggles spotlight illumination.
int ME_GetPedVariationCount(int modelIndex) Returns number of PedCols color variations for a ped model.

📑 Type Enums & Structs

ME_LightID

enum ME_LightID {
    ME_HeadLightLeft, ME_HeadLightRight,
    ME_TailLightLeft, ME_TailLightRight,
    ME_ReverseLightLeft, ME_ReverseLightRight,
    ME_BrakeLightLeft, ME_BrakeLightRight,
    ME_AllDayLight, ME_DayLight, ME_NightLight,
    ME_FogLightLeft, ME_FogLightRight,
    ME_SideLightLeft, ME_SideLightRight,
    ME_STTLightLeft, ME_STTLightRight,
    ME_NABrakeLightLeft, ME_NABrakeLightRight,
    ME_SpotLight, ME_StrobeLight, ME_SirenLight,
    ME_IndicatorLightLeftFront, ME_IndicatorLightLeftMiddle, ME_IndicatorLightLeftRear,
    ME_IndicatorLightRightFront, ME_IndicatorLightRightMiddle, ME_IndicatorLightRightRear,
    ME_EngineOnLed, ME_EngineBrokenLed, ME_FogLightLed, ME_HighBeamLed, ME_LowBeamLed,
    ME_IndicatorLeftLed, ME_IndicatorRightLed, ME_SirenLed,
    ME_BootOpenLed, ME_BonnetOpenLed, ME_DoorOpenLed, ME_RoofOpenLed,
    ME_LightCount
};

ME_IndicatorState

enum ME_IndicatorState {
    ME_IndicatorOff   = 0,
    ME_IndicatorLeft  = 1,
    ME_IndicatorRight = 2,
    ME_IndicatorBoth  = 3
};

ME_LightOverride

enum ME_LightOverride {
    ME_LightOverrideNone     = 0,
    ME_LightOverrideForceOff = 1,
    ME_LightOverrideForceOn  = 2
};

Clone this wiki locally