Jump to content

[SA] Cleo. Updating(refreshing/reloading) vehicle sounds.


Recommended Posts

I am looking for a way to refresh/reload/update all the vehicle sound that are loaded when player enters a vehicle (or maybe when the vehicle is created).
As far I understand - when a new vehicle appears - the game reads vehicle's data and loads required sound files. So, when I change some of the data on-the-fly - the required sounds are not loaded and thus not playing. I trying to make a siren mod. It works, to a point. 
The idea is that when a player presses a button the game will consider all vehicles as LawEnforcementVehicles. 
This is achieved by changing 2 bytes in 0x6D2370 ; char __thiscall CVehicle::IsLawEnforcementVehicle(CVehicle *vehicle)

0x6D2391 32 C0	xor al, al


0x6D2391 B0 01	mov al, 1

CVehicle::IsLawEnforcementVehicle(CVehicle *vehicle) checks the vehicle models and returns 1 if it is a cop car (COPCARLA, COPCARSF etc). It returns 0 in all other cases. Changing bytes to B0 01 makes it return 1 in all cases, no matter what vehicle it is.
I don't want all cars to always be law enforcement unless a button is press. Yep, that's easy.

    0AB0:   key_pressed 35  //End
0A8C: write_memory 0x6D2391 size 1 value 0x32 virtual_protect 0
0A8C: write_memory 0x6D2392 size 1 value 0xC0 virtual_protect 0

    0AB0:   key_pressed 46  //Del
0A8C: write_memory 0x6D2391 size 1 value 0xB0 virtual_protect 0
0A8C: write_memory 0x6D2392 size 1 value 0x01 virtual_protect 0

Press Del to make them all LawEnforcement, press End to revert everything back. 
So, when I sit in a car, press Del - I got a prompt to start vigilante missions. Siren kinda works because cars move out of the way - but there is no siren sound.
But if I press Del while on foot and only then enter a car - everything works fine. 
I tried this but no luck.

0A97: 21@ = vehicle 20@ struct
0D4E: 24@ = struct 21@ offset 0x138 size 4 //m_vehicleAudio  CAEVehicleAudioEntity
0D4E: 25@ = struct 24@ offset 0x4 size 4 //CAEAudioEntity
0AA6: call_method 0x6D2370 struct 24@ num_params 1 pop 1 25@ //void __thiscall CAEVehicleAudioEntity::Initialise(CAEVehicleAudioEntity *this, CVehicle *pOwner)


Link to comment
Share on other sites

  • 2 weeks later...

pOwner is of type CVehicle pointer.
Call should perhaps look like this:

0A97: 21@ = vehicle 20@ struct
22@ = 21@ + 0x138 // pointer to CVehicle::m_vehicleAudio
0AA6: call_method 0x006D2370 {struct} 22@ {num_args} 1 {pop} 1 {args} 21@ // CAEVehicleAudioEntity.Initialise(CVehicle *pOwner)


Edited by MiranDMC
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.