Whitelisting the fire siren - inferno-collection/Fire-EMS-Pager GitHub Wiki
How to whitelist the fire siren to certain players
If you want to whitelist the fire siren so only select people can hear it, follow this guide.
> Warning: Advanced Tutorial
- Open the top level folder (resources/[inferno-collection]/inferno-fire-ems-pager)
If using whitelist.json
The guide joins back together again from step 4
- Open the
whitelist.json
file - Add this key and value to the people who you want to be able to hear the siren:
"hearsiren" : true
For example:
{
"steamhex" : "steam:1100001076264E1",
"pager" : true,
"page" : true,
"firesiren" : true,
"cancelpage" : true,
"hearsiren" : true
}
If using Ace Permissions
The guide joins back together again from step 4
- Open the
inferno-fire-ems-pager.cfg
file - Add this line to the very bottom of the file:
add_ace fire-ems-pager.group.user "fire-ems-pager.hearsiren" allow
- Open the
client.lua
file - Find this section, near the top:
-- Local whitelist variable
local Whitelist = {}
-- Boolean for whether the whitelist is enabled
Whitelist.Enabled = Config.WhitelistEnabled
-- Whitelist variable for commands
Whitelist.Command = {}
-- Boolean for whether player is whitelisted for pager command
Whitelist.Command.pager = false
-- Boolean for whether player is whitelisted for page command
Whitelist.Command.page = false
-- Boolean for whether player is whitelisted for firesiren command
Whitelist.Command.firesiren = false
-- Boolean for whether player is whitelisted for cancelpage command
Whitelist.Command.cancelpage = false
-- Boolean for whether player is whitelisted for pagerwhitelist command
Whitelist.Command.pagerwhitelist = false
- Add this code directly below that section:
-- Boolean for whether player is whitelisted to hear the fire siren
Whitelist.Command.hearsiren = false
- Find this section, near the bottom:
-- Play fire sirens
RegisterNetEvent("fire-ems-pager:PlaySirens")
AddEventHandler("fire-ems-pager:PlaySirens", function(Stations)
-- Stop sirens being paged over the top of others
FireSiren.Enabled = true
-- Loop though all stations
for _, Station in ipairs(Stations) do
Station.Loc = vector3(Station.x, Station.y, Station.z)
-- Insert temporary array into enabled stations
table.insert(FireSiren.EnabledStations, Station)
end
-- Short pause before sirens are played
Citizen.Wait(1000)
-- New NUI message
SendNUIMessage({
-- Tell the NUI to play the siren sound
TransactionType = "PlaySiren"
})
-- Wait for sound to finish
Citizen.Wait(51000)
-- Then allow more sirens to be sounded
FireSiren.Enabled = false
end)
- Replace that entire section with the following:
-- Play fire sirens
RegisterNetEvent("fire-ems-pager:PlaySirens")
AddEventHandler("fire-ems-pager:PlaySirens", function(Stations)
-- Check if the player is whitelisted to hear fire sirens
if Whitelist.Command.hearsiren then
-- Stop sirens being paged over the top of others
FireSiren.Enabled = true
-- Loop though all stations
for _, Station in ipairs(Stations) do
Station.Loc = vector3(Station.x, Station.y, Station.z)
-- Insert temporary array into enabled stations
table.insert(FireSiren.EnabledStations, Station)
end
-- Short pause before sirens are played
Citizen.Wait(1000)
-- New NUI message
SendNUIMessage({
-- Tell the NUI to play the siren sound
TransactionType = "PlaySiren"
})
-- Wait for sound to finish
Citizen.Wait(51000)
-- Then allow more sirens to be sounded
FireSiren.Enabled = false
end
end)
- Find this section, at the bottom:
-- Resource master loop
Citizen.CreateThread(function()
-- Forever
while true do
-- Allows safe looping
Citizen.Wait(0)
-- If fire siren is enabled
if FireSiren.Enabled then
...
end
end
end)
- Replace this line:
if FireSiren.Enabled then
with:
if FireSiren.Enabled and Whitelist.Command.hearsiren then
- Enjoy!
Note: If a user is not on the whitelist, the default value for hearing the fire siren is false.
If you have any troubles, suggestions, feedback, etc, please check the Wiki, create a new issue, and/or contact us on Discord.