This addon allows players with a police job to use a megaphone while in a vehicle. It significantly increases the voice range in the voice chat, making instructions and announcements understandable even outside the vehicle and over greater distances – ideal for traffic stops, operations, or large-scale events.
I wrote it while working on a FiveM Server as a freelancer.
The script is compatible with the most common FiveM frameworks (ESX, QBCore, ox_core) as well as standalone operation. Framework detection is automatic.
- Megaphone Function: Increases voice range up to 50 meters while the megaphone key is held down.
- Framework Compatibility: Supports ESX, QBCore, ox_core, and standalone.
- Job and Vehicle Check: Only players with an allowed police job (e.g., "police", "fib", "immigration") and in a police vehicle can use the megaphone.
- Optional Audio Submix: (Configurable) For a more realistic megaphone sound.
- Easy Operation: Activation via freely assignable key.
- Central Configuration: All settings can be adjusted in the
config/config.lua
file. - Cooldown System: Protection against spam through configurable cooldown.
- Visual Effects: Vehicle lights flash when the megaphone is active (optional).
- Server-side Logging: Megaphone usage is logged with player info.
- Upload files: Copy the addon to your
resources
folder. - Start in server.cfg:
63BF
ensure mm_megaphone
- Dependencies:
- pma-voice (voice plugin)
- One of the supported frameworks (ESX, QBCore, ox_core) or standalone
All settings can be found in the config/config.lua
file:
- Config.AllowedJobs: List of allowed jobs (e.g., 'police', 'fib', 'immigration')
- Config.AllowedVehicleClasses: Allowed vehicle classes (e.g., 18 for Emergency)
- Config.AllowedVehicleModels: Allowed vehicle models (spawn names)
- Config.MegaphoneRange: Voice range in meters
- Config.ActivationKey: Empty by default, can be assigned in-game
- Config.UseSubmix: true/false for megaphone sound effect
- Config.SubmixName/SubmixEffects: Name and parameters of the submix
- Config.Cooldown: Cooldown time in milliseconds
- Config.Notifications: Customizable notifications
- Get into a police vehicle as a police officer.
- Press and hold the configured key (can be assigned in the menu, e.g., F5).
- Your voice will now be transmitted within a 50-meter radius (and optionally with a megaphone effect).
- Release the key to restore the normal voice range.
config/config.lua
– central configurationbridge/framework.lua
– framework detection & wrappersclient/main.lua
– client main logic (keys, checks, voice)client/submix.lua
– submix logic (audio effect)server/main.lua
– server events for submix & logginglogs/logs.lua
– logic for server-side loggingfxmanifest.lua
– resource definition
If you have questions or issues, you can open an issue on GitHub or contact the developer.
Please submit issues here: GitHub Issues. Without an issue submission, I cannot address bugs or provide fixes.