Skip to content

ASI API

Chrystian Farias edited this page Jan 18, 2022 · 4 revisions

Exported Functions

float GetCurrentRPM();

Get current vehicle RPM

int GetCurrentGear();

Get current vehicle Gear

void SetCurrentGear(int gear);

Set current vehicle Gear

float GetClutchValue();

Get current clutch value (0.0 - 1.0)

void SetClutchValue(float clutch);

Set current clutch value (0.0 - 1.0)

void SetVehicleFMODBank(CVehicle* vehicle, string bank);

Set Vehicle instance FMOD Bank

How to use

See GTAFmodDashBoard.cpp example.

Declare external function:

typedef float (__cdecl* GTAFmod_Ext_GetCurrentRPM)();
GTAFmod_Ext_GetCurrentRPM gtaFmod_Ext_GetCurrentRPM;

typedef void(__cdecl* GTAFmod_Ext_SetVehicleFMODBank)(CVehicle* vehicle, std::string bank);
GTAFmod_Ext_SetVehicleFMODBank gtaFmod_Ext_SetVehicleFMODBank;

Load GTAFmod module instance (in script start)

HINSTANCE moduleGTAFmod = GetModuleHandleA("GTAFmod.SA.asi");
if (moduleGTAFmod) {
    gtaFmod_Ext_GetCurrentRPM = (GTAFmod_Ext_GetCurrentRPM)GetProcAddress(moduleGTAFmod, "Ext_GetCurrentRPM");
    gtaFmod_Ext_SetVehicleFMODBank = (GTAFmod_Ext_SetVehicleFMODBank)GetProcAddress(moduleGTAFmod, "Ext_SetVehicleFMODBank");
}
else {
    moduleGTAFmod = 0;
    gtaFmod_Ext_GetCurrentRPM = 0;
    gtaFmod_Ext_SetVehicleFMODBank = 0;
}

Use Function

gtaFmod_Ext_SetVehicleFMODBank(vehicle, "ks_mazda_rx7_spirit_r");

vehicle is CVehicle instance

Clone this wiki locally