Skip to content

Unlock sirens for all vehicle types, including custom models - #4959

Open
TheCrazy17 wants to merge 7 commits into
multitheftauto:masterfrom
TheCrazy17:fix/siren-custom-vehicles
Open

Unlock sirens for all vehicle types, including custom models#4959
TheCrazy17 wants to merge 7 commits into
multitheftauto:masterfrom
TheCrazy17:fix/siren-custom-vehicles

Conversation

@TheCrazy17

@TheCrazy17 TheCrazy17 commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Summary

addVehicleSirens / setVehicleSirens previously only had a visible effect on stock
cars (and the HPV1000 bike), because GTA only renders siren coronas for models 407-599.
This makes scripted sirens render — lights and sound, on every vehicle type:

  • Custom (engineRequestModel) vehicles and out-of-range stock models (400-406,
    600-611) now render sirens (the CAutomobile::PreRender model-id gate is bypassed for
    vehicles that carry scripted sirens).
  • Bikes, BMX, boats, planes, helis and trains now draw siren coronas via new
    PreRender entry hooks, these classes had no native siren rendering at all.
  • The siren sound now plays for boat/aircraft/train audio types
    (CAEVehicleAudioEntity::ProcessVehicle only ran it for car/bike/bmx).
  • The vehicle-type checks in addVehicleSirens / setVehicleSirens (client + server)
    were relaxed to allow every vehicle class; only typeless/invalid vehicles are rejected.
mta-screen_2026-06-17_00-30-24

Motivation

Closes #4090
Closes #1375

It also ticks one item off #1861 sirens being one of those features. It doesn't close, but it's one
less thing on the list. And honestly, I just enjoy closing issues and expanding what
you can do in MTA. :)

Test plan

Run this in client-side, get in a vehicle and enjoy:

addEventHandler('onClientPlayerVehicleEnter', root, function(vehicle, seat)
      addVehicleSirens(vehicle, 2, 2)
      setVehicleSirens(vehicle, 1, -0.4, 0, 3, 0, 0, 255, 255, 255)
      setVehicleSirens(vehicle, 2, 0.4, 0, 3, 255, 0, 0, 255, 255)
      setVehicleSirensOn(vehicle, true)
end)

addEventHandler('onClientPlayerVehicleExit', root, function(vehicle, seat)
   removeVehicleSirens(vehicle)
end)

Checklist

  • Your code should follow the coding guidelines.
  • Smaller pull requests are easier to review. If your pull request is beefy, your pull request should be reviewable commit-by-commit.

addVehicleSirens now renders on custom (engineRequestModel) vehicles and
every vehicle class (bikes, BMX, boats, planes, helis, trains), with siren
sound on boat/aircraft/train audio types. Closes multitheftauto#4090.
@Fernando-A-Rocha

Copy link
Copy Markdown
Contributor

This is awesome, thank you 🤩 we're on the right path

@FileEX FileEX added the enhancement New feature or request label Jul 23, 2026
@FileEX FileEX added bugfix Solution to a bug of any kind and removed enhancement New feature or request labels Aug 15, 2026

@FileEX FileEX left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move all these hooks to CMultiplayerSA_Vehicles or create a new CMultiplayerSA_VehicleSirens file for them.

Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_1.3.cpp Outdated
Passes hook arguments straight through instead of shuttling them through globals, drops the pushad/popad and vehicle type checks that turned out unnecessary, and shares one vehicle lookup helper across the three new functions.
Splits the whole siren subsystem out of CMultiplayerSA_1.3.cpp into CMultiplayerSA_VehicleSirens.cpp, and drops a few unused globals and one orphaned forward declaration found along the way.
@TheCrazy17

Copy link
Copy Markdown
Contributor Author

Done ✅

Comment thread Client/multiplayer_sa/CMultiplayerSA_VehicleSirens.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_VehicleSirens.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_VehicleSirens.cpp Outdated
Comment thread Client/multiplayer_sa/CMultiplayerSA_VehicleSirens.cpp
Verified with Ghidra that all three just replayed the exact call they replaced with the exact same register state, then jumped back to the same continuation point; installing them changed nothing.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Solution to a bug of any kind

Projects

None yet

Development

Successfully merging this pull request may close these issues.

addVehicleSirens doesn't work with custom vehicles Allow SetVehicleSirens for every vehicle ID

3 participants