🎯 A realistic and professional megaphone system for FiveM
Compatible with QBCore, ESX and PMA-Voice
- 🚔 Emergency vehicle compatibility - Works with police and emergency vehicles (class 18 and 15)
- 🎙️ Realistic audio - Configurable audio effects with custom submix
- 🎭 Detailed animations - Different animations for inside and outside vehicle
- 🔧 Highly configurable - Easy configuration of volume, effects and restrictions
- 🌍 Multi-language - Localization system included (Spanish included)
- 🎯 Automatic framework detection - Compatible with QBCore and ESX
- 📱 Optimized - Clean and efficient code
- FiveM Server (Latest version recommended)
- PMA-Voice or compatible voice system
- QBCore or ESX Framework (optional, automatic detection)
-
Download the resource
git clone https://github.com/SkyStoreOFL/skys_megaphone.git
-
Place the resource in your resources folder
resources/[standalone]/skys_megaphone/ -
Add to server.cfg
ensure skys_megaphone
-
Restart the server
-
Inventory Setup
-
QBCore Setup (if using QBCore framework)
Add the following item to your QBCore items configuration:
megaphone = { name = 'megaphone', label = 'Megaphone', weight = 100, type = 'item', image = 'megaphone.png', unique = false, useable = true, shouldClose = true, description = 'A megaphone to make annoucements' },
The inventory image is located at
install/megaphone.png- copy this file to your inventory images folder. -
ESX Setup (if using ESX framework)
Execute the following SQL query:
INSERT INTO `items` (`name`, `label`, `weight`) VALUES ('megaphone', 'Megaphone', 1);
The inventory image is located at
install/megaphone.png- copy this file to your inventory images folder.
-
The Config.lua file allows you to fully customize the megaphone behavior:
-- Volume level for the megaphone (0.0 to 1.0)
Config.MegaphoneVolume = 0.90
-- Range of the megaphone in meters
Config.Range = 30.0
-- Language for the resource ('es' for Spanish, 'en' for English, etc.)
Config.Locale = 'es'
-- Framework detection ('auto' for automatic detection, 'qb-core' for QBCore, 'es_extended' for ESX)
Config.Framework = 'auto'-- Audio submix configuration for megaphone effects
Config.SubmixData = {
[`default`] = 1, -- Default submix value
[`freq_low`] = 300.0, -- Low frequency cutoff
[`freq_hi`] = 5000.0, -- High frequency cutoff
[`rm_mod_freq`] = 0.0, -- Ring modulation frequency
[`rm_mix`] = 0.2, -- Ring modulation mix
[`fudge`] = 0.0, -- Fudge factor for audio processing
[`o_freq_lo`] = 550.0, -- Output low frequency
[`o_freq_hi`] = 0.0, -- Output high frequency
}Config.AnimConfiguration = {
-- Animations when inside a vehicle
invehicle = {
dict = 'anim@rifle_megaphone', -- Animation dictionary
anim = 'rifle_holding_megaphone', -- Animation name
prop = {
name = 'prop_megaphone_01', -- Prop model name
bone = 60309, -- Bone to attach to
placement = { 0.0480, 0.0190, 0.0160, -94.8944, -2.3093, -10.9030 }
}
},
-- Animations when outside a vehicle
outvehicle = {
dict = 'random@arrests', -- Animation dictionary
anim = 'generic_radio_enter', -- Animation name
prop = {
name = 'prop_cs_hand_radio', -- Prop model name
bone = 28422, -- Bone to attach to
placement = { 0.0750, 0.0230, -0.0230, -90.0000, 0.0, -59.9999 }
}
}
}By default, the megaphone only works with:
- Class 18: Emergency vehicles
- Class 15: Helicopters
- Maximum distance: 5 meters from vehicle
- Enter a compatible emergency vehicle
- Use the megaphone command or item (depending on server configuration)
- Speak into your microphone to transmit through the megaphone
- Use the command/item again to deactivate
-- Activate megaphone (from item or command)
exports['skys_megaphone']:UseMegaphone(isItem)
-- Deactivate megaphone and clear animations/props
exports['skys_megaphone']:ClearMegaphone()
-- Check if player can use megaphone (returns boolean)
local canUse = Config.CanUseVehicleMegaphone()
if canUse then
-- Player can use the megaphone
end
-- Get localized text
local text = Locale('cannot-use')-- Example: Custom item usage
RegisterNetEvent('myresource:useMegaphone')
AddEventHandler('myresource:useMegaphone', function()
if Config.CanUseVehicleMegaphone() then
exports['skys_megaphone']:UseMegaphone(true)
else
-- Show error message
print(Locale('cannot-use'))
end
end)
-- Example: Custom command
RegisterCommand('togglemegaphone', function()
exports['skys_megaphone']:UseMegaphone(false)
end)
-- Example: Stop megaphone usage
RegisterCommand('stopmegaphone', function()
exports['skys_megaphone']:ClearMegaphone()
end)-- Client Events
TriggerEvent('skys_megaphone:client:ToggleMegaphone')
TriggerEvent('skys_megaphone:client:SetMegaphone', isActive, source)
-- Server Events
TriggerServerEvent('skys_megaphone:server:SetMegaphone', isActive)skys_megaphone/
├── 📄 Config.lua # Main configuration
├── 📄 fxmanifest.lua # Resource manifest
├── 📄 README.md # This file
├── 📄 LICENSE # Project license
├── 📁 client/ # Client-side scripts
│ ├── 📄 main.lua # Main client logic
│ └── 📁 custom/ # Customizations
│ ├── 📁 framework/ # Framework integrations
│ │ └── 📄 qb.lua # QBCore integration
│ │ └── 📄 esx.lua # ESX integration
│ └── 📁 voice/ # Voice integrations
│ └── 📄 pma.lua # PMA-Voice integration
├── 📁 server/ # Server-side scripts
│ ├── 📄 main.lua # Main server logic
│ └── 📁 custom/ # Server customizations
│ └── 📁 framework/ # Framework integrations
│ └── 📄 qb.lua # QBCore integration
│ │ └── 📄 esx.lua # ESX integration
└── 📁 locales/ # Language files
└── 📄 es.lua # Spanish translations
- Create a new file in
locales/(e.g:en.lua) - Add the translations:
Locales['en'] = {
['cannot-use'] = 'You cannot use the megaphone in this vehicle.',
}- Change
Config.Locale = 'en'in the configuration file
Edit the Config.CanUseVehicleMegaphone function in Config.lua:
Config.CanUseVehicleMegaphone = function ()
local playerPed = PlayerPedId()
local vehicle = GetVehiclePedIsIn(playerPed, true)
local vehicleClass = GetVehicleClass(vehicle)
-- Add more vehicle classes here
local allowedClasses = {18, 15, 16} -- Emergency, Helicopters, Planes
for _, class in ipairs(allowedClasses) do
if vehicleClass == class then
return true
end
end
return false
end- ✅ Verify you're in a compatible vehicle
- ✅ Make sure PMA-Voice is working
- ✅ Check console for errors
- ✅ Check volume configuration in
Config.lua - ✅ Make sure your microphone is working
- ✅ Check PMA-Voice configuration
- ✅ Verify QBCore or ESX is installed (if you use it)
- ✅ Make sure the resource starts after the framework
Contributions are welcome! Please:
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is under the MIT License. See the LICENSE file for more details.
- Developed by: SkyStore
- Inspired by: Real-life megaphone systems
- Special thanks: To the FiveM community
⭐ If you like this project, don't forget to give it a star! ⭐