-
Notifications
You must be signed in to change notification settings - Fork 8
ASI API
Chrystian Farias edited this page Jan 24, 2022
·
4 revisions
float GetCurrentRPM();
Get current vehicle RPM
int GetCurrentGear();
Get current vehicle Gear
float GetClutchValue();
Get current clutch value (0.0 - 1.0)
void SetVehicleFMODBank(CVehicle* vehicle, char* bank, char* absolutePath);
Set Vehicle instance FMOD Bank
void SetModelIdFMODBank(int id, char* bank, char* absolutePath);
Set Model ID FMOD Bank
void SetEngineSoundIdFMODBank(int id, char* bank, char* absolutePath);
Set Engine Sound ID FMOD Bank
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, char* bank, char* absolutePath);
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, (char*)"ks_mazda_rx7_spirit_r", GAME_PATH((char*)"modloader\\GTAFmod\\banks\\ks_mazda_rx7_spirit_r.bank"));
vehicle is CVehicle instance