├── [inferno-collection] └── inferno-fire-ems-pager │ ├── html │ ├── sounds │ │ ├── end.mp3 │ │ ├── fire.mp3 │ │ ├── cancel.mp3 │ │ ├── medical.mp3 │ │ ├── other.mp3 │ │ ├── rescue.mp3 │ │ ├── siren1.mp3 │ │ ├── siren2.mp3 │ │ └── vibrate.mp3 │ └── index.html │ ├── whitelist.json │ ├── fxmanifest.lua │ ├── inferno-fire-ems-pager.cfg │ ├── server.lua │ └── client.lua ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── suggestion.md ├── LICENCE.txt ├── .travis.yml └── README.md /[inferno-collection]/inferno-fire-ems-pager/html/sounds/end.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/end.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/fire.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/fire.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/cancel.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/cancel.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/medical.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/medical.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/other.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/other.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/rescue.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/rescue.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/siren1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/siren1.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/siren2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/siren2.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/sounds/vibrate.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Fire-EMS-Pager/HEAD/[inferno-collection]/inferno-fire-ems-pager/html/sounds/vibrate.mp3 -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/whitelist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "steamhex" : "steam:1100001076264E1", 4 | "pager" : true, 5 | "page" : true, 6 | "firesiren" : true, 7 | "cancelpage" : true, 8 | "pagerwhitelist": true 9 | } 10 | ] -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help squash them 4 | title: "[Bug]" 5 | labels: Unconfirmed Bug 6 | assignees: cm8263 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **Steps to reproduce** 14 | Steps to reproduce the behavior. 15 | 16 | **Expected behavior** 17 | A clear and concise description of what you expected to happen. 18 | 19 | **Screenshots** 20 | If applicable, add screenshots to help explain your problem. 21 | 22 | **Resource version** 23 | What resource version are you running, and have you tried the latest version? 24 | 25 | **Additional context** 26 | Add any other context about the problem here. 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/suggestion.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Suggestion 3 | about: Suggest an idea for this resource 4 | title: "[Suggestion]" 5 | labels: New Suggestion 6 | assignees: cm8263 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you would like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you have considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /LICENCE.txt: -------------------------------------------------------------------------------- 1 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, and merge the software, under the following conditions: 2 | 3 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 4 | 5 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 6 | -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Fire/EMS Pager + Fire Siren Version 4.55 Beta 2 | -- 3 | -- Copyright (c) 2019, Christopher M, Inferno Collection. All rights reserved. 4 | -- 5 | -- This project is licensed under the following: 6 | -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to use, copy, modify, and merge the software, under the following conditions: 7 | -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | -- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 9 | -- 10 | 11 | name 'Fire/EMS Pager + Fire Siren - Inferno Collection' 12 | 13 | description 'The Fire/EMS Pager + Fire Siren is a resource that allows players to have a pager on their person at all times.' 14 | 15 | author 'Inferno Collection (inferno-collection.com)' 16 | 17 | version '4.55 Beta' 18 | 19 | url 'https://inferno-collection.com' 20 | 21 | client_script 'client.lua' 22 | 23 | server_script 'server.lua' 24 | 25 | ui_page 'html/index.html' 26 | 27 | files { 28 | 'whitelist.json', 29 | 'html/index.html', 30 | 'html/sounds/*.mp3' 31 | } 32 | 33 | fx_version 'bodacious' 34 | 35 | game 'gta5' 36 | -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/inferno-fire-ems-pager.cfg: -------------------------------------------------------------------------------- 1 | # Inferno Collection Fire/EMS Pager + Fire Siren Version 4.54 Beta 2 | # 3 | # Copyright (c) 2019, Christopher M, Inferno Collection. All rights reserved. 4 | # 5 | # This project is licensed under the following: 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, and merge the software, under the following conditions: 7 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 9 | # 10 | 11 | # 12 | # Permissions 13 | # Add your player's identifiers in the sections below. 14 | # https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Whitelisting 15 | # 16 | 17 | # User 18 | # Commands: 19 | # - /pager 20 | add_principal identifier.steam:1100001076264E1 fire-ems-pager.group.user 21 | 22 | # Supervisor 23 | # Commands: 24 | # - /pager 25 | # - /page 26 | # - /firesiren 27 | # - /cancelpage 28 | add_principal identifier.steam:1100001076264E1 fire-ems-pager.group.supervisor 29 | 30 | # 31 | # Nothing past this point needs to be edited, all the whitelisting needs to be done ABOVE this line. 32 | # Do not make changes below this line unless you know what you are doing! 33 | # 34 | 35 | add_principal fire-ems-pager.group.supervisor fire-ems-pager.group.user 36 | add_ace fire-ems-pager.group.user "fire-ems-pager.pager" allow 37 | add_ace fire-ems-pager.group.supervisor "fire-ems-pager.page" allow 38 | add_ace fire-ems-pager.group.supervisor "fire-ems-pager.firesiren" allow 39 | add_ace fire-ems-pager.group.supervisor "fire-ems-pager.cancelpage" allow -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Inferno Collection Fire/EMS Pager + Fire Siren Version 4.54 Beta 2 | # 3 | # Copyright (c) 2019, Christopher M, Inferno Collection. All rights reserved. 4 | # 5 | # This project is licensed under the following: 6 | # Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, and merge the software, under the following conditions: 7 | # The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 9 | # 10 | 11 | # 12 | # This file is used by Travis CI to make sure all the code is this project is error free, and up conventional standards. 13 | # This file does not do anything within FiveM, so feel free to delete it. Keeping it will not do any harm to the resource or your server. 14 | # 15 | 16 | language: python 17 | sudo: false 18 | 19 | env: 20 | - LUA="lua=5.1" 21 | - LUA="lua=5.2" 22 | - LUA="lua=5.3" 23 | - LUA="luajit=2.0" 24 | - LUA="luajit=2.1" 25 | 26 | before_install: 27 | - pip install hererocks 28 | - hererocks lua_install -r^ --$LUA 29 | - export PATH=$PATH:$PWD/lua_install/bin 30 | 31 | install: 32 | - luarocks install luacheck 33 | 34 | script: 35 | - luacheck -g -a --no-max-line-length --no-max-comment-line-length [inferno-collection]/inferno-fire-ems-pager 36 | 37 | after_success: 38 | - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh 39 | - chmod +x send.sh 40 | - ./send.sh success $WEBHOOK_URL 41 | after_failure: 42 | - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh 43 | - chmod +x send.sh 44 | - ./send.sh failure $WEBHOOK_URL -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/html/index.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 15 | 16 | 21 | 22 | 23 | 60 | 61 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | > Unsupported as of 03/21/2021 - Downloads still available, but no support will be provided for any issues found. 2 | 3 | *** 4 | 5 | ![channels4_banner|690x114](https://i.ibb.co/CHMD8y6/channels4-banner.jpg) 6 | # Inferno Collection: Fire/EMS Pager + Fire Siren 7 | [![Build Status](https://travis-ci.com/inferno-collection/Fire-EMS-Pager.svg?branch=master)](https://travis-ci.com/inferno-collection/Fire-EMS-Pager) 8 | 9 | __Public Beta Version 4.55__ 10 | 11 | The Fire/EMS Pager + Fire Siren is a resource that allows players to have a pager on their person at all times. The pager is turned off by default, and must be tuned to tones in order to be paged. Once a tone or tones are paged, pagers tuned to these tones will receive the tone/s; if a tone is paged that a player is tuned to, they will hear a vibration sound and a notification will pop-up on their screen informing them of the call type, if a player is not tuned to a paged tone they will hear the tone sound, but not hear a vibration or receive a notification. 12 | 13 | The fire siren allows a custom siren to be sounded at any of the fire stations around the map ([custom stations for the fire siren](https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-stations), as well as [custom tones for the pager](https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-tones) can also be added to the resource). Once sounded, a siren can be heard within a predefined radius per station, and the further from the origin of the siren a player is, the quieter it will sound for them. Multiple sirens can be added, allowing you to choice which stations have what siren sound. 14 | 15 | In the case of the pager, multiple tones can be tuned to, and paged at once; for the fire siren, multiple stations can be sounded at once as well. Once tones are being paged, or a siren sounded, they must finish completely before more tones are paged or sirens sounded, as tones cannot be paged over other tones, and sirens cannot be sounded over other sirens (note however, sirens can be sounded at the same time as tones paged, and vice versa). 16 | 17 | The Fire/EMS Pager + Fire Siren resource is not only designed to be as efficient and lightweight as possible, but also to be customizable, and allow server owners to have as much control as possible over the resource, without the need to edit any code (with the exception of the configuration). 18 | 19 | Presently, the following can be customized: 20 | - [Tones](https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-tones). 21 | - [Stations](https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-stations). 22 | - Including different sirens per station. 23 | - Radius fire siren can be heard in per station. 24 | - Department name in messages. 25 | - Default /page message. 26 | - Wait time between tones played. 27 | - Whether to display chat suggestions. 28 | - Whether to display messages at all. 29 | - I.E. disable all messages for realism. 30 | - Which players can use which command (via a whitelist). 31 | - Choice of three whitelist options:. 32 | 1. Steam ID based JSON file 33 | 2. Ace Permissions 34 | 3. No whitelist 35 | 36 | *** 37 | ### Development Showcase Video (Showing Version 4.2) 38 | [![Watch the Development Showcase video](https://img.youtube.com/vi/ItzmndFpmpc/maxresdefault.jpg)](https://www.youtube.com/watch?v=ItzmndFpmpc) 39 | *** 40 | ### Installation Video (Showing Version 4.2) 41 | [![Watch the Installation Video](https://img.youtube.com/vi/7ri7Ubpy7t8/maxresdefault.jpg)](https://www.youtube.com/watch?v=7ri7Ubpy7t8) 42 | *** 43 | 44 | > Download Link 45 | 46 | https://github.com/inferno-collection/Fire-EMS-Pager/releases 47 | 48 | > Pictures 49 | 50 | ![image|236x74](https://forum.fivem.net/uploads/default/original/3X/0/2/023fb846258e5d5cf74f346569ab6da1ba7a72d0.png) 51 | 52 | ![image|638x198,100%](https://forum.fivem.net/uploads/default/original/3X/9/9/99b130269d56c335d7839eff7438f73b9bf31f1b.png) 53 | 54 | ![image|638x80](https://forum.fivem.net/uploads/default/original/3X/0/f/0f3deac30327635b3130d71b1f35c58caaa3e23d.png) 55 | 56 | ![image|639x81](https://forum.fivem.net/uploads/default/original/3X/2/e/2e38f5471bc8eba915d6b7af09684ef8148e459c.png) 57 | 58 | ![image|637x77](https://forum.fivem.net/uploads/default/original/3X/4/c/4cec02fbaa88dd099c5e23781a0a2b33f54008d9.png) 59 | 60 | ![image|690x114](https://forum.fivem.net/uploads/default/original/3X/b/0/b09f70aa4e950b4a3e823b481f0d9d6f538dc5c4.png) 61 | 62 | ![image|690x95](https://forum.fivem.net/uploads/default/original/3X/4/1/41bf902b29ce067675c57b45faddad058bbc17f5.png) 63 | 64 | ![image|690x50](https://forum.fivem.net/uploads/default/original/3X/c/b/cb48275f018846b0211854501bf4af3848c73bce.png) 65 | *** 66 | Check out the Wiki for an [installation guide](https://github.com/inferno-collection/Fire-EMS-Pager/wiki), as well as to find out how to use the resource. 67 | 68 | If you have any troubles, suggestions, feedback, etc, please [check the Wiki](https://github.com/inferno-collection/Fire-EMS-Pager/wiki) and/or [create a new issue](https://github.com/inferno-collection/Fire-EMS-Pager/issues/new) on GitHub. 69 | 70 | Thank you to everyone that helped tested this resource. 71 | 72 | > The Inferno Collection Team 73 | * @ChristopherM 74 | * @Scott_UK 75 | * @FrozenN00b 76 | *** 77 | Interested in keeping up-to-date with what we are working on? [Check out our roadmap](https://inferno-collection.com/roadmap). 78 | -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/server.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Fire/EMS Pager + Fire Siren Version 4.55 Beta 2 | -- 3 | -- Copyright (c) 2019, Christopher M, Inferno Collection. All rights reserved. 4 | -- 5 | -- This project is licensed under the following: 6 | -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use, copy, modify, and merge the software, under the following conditions: 7 | -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | -- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 9 | -- 10 | 11 | -- 12 | -- Nothing past this point needs to be edited, all the settings for the resource are found ABOVE this line. 13 | -- Do not make changes below this line unless you know what you are doing! 14 | -- 15 | 16 | -- Master Fire Siren storage variable 17 | local FireSirens = {} 18 | 19 | RegisterServerEvent("Fire-EMS-Pager:StoreSiren") 20 | AddEventHandler("Fire-EMS-Pager:StoreSiren", function(Station) 21 | if not FireSirens[Station.Name:lower()] then 22 | FireSirens[Station.Name:lower()] = Station 23 | FireSirens[Station.Name:lower()].ID = source 24 | 25 | TriggerClientEvent("Fire-EMS-Pager:Bounce:ServerValues", -1, FireSirens) 26 | end 27 | end) 28 | 29 | RegisterServerEvent("Fire-EMS-Pager:RemoveSiren") 30 | AddEventHandler("Fire-EMS-Pager:RemoveSiren", function(StationName) 31 | if FireSirens[StationName] then 32 | FireSirens[StationName] = nil 33 | end 34 | end) 35 | 36 | -- Plays tones on all clients 37 | RegisterServerEvent("Fire-EMS-Pager:PageTones") 38 | AddEventHandler("Fire-EMS-Pager:PageTones", function(Tones, HasDetails, Details) 39 | TriggerClientEvent("Fire-EMS-Pager:PlayTones", -1, Tones, HasDetails, Details) 40 | end) 41 | 42 | -- Plays cancel sound on all clients 43 | RegisterServerEvent("Fire-EMS-Pager:CancelPage") 44 | AddEventHandler("Fire-EMS-Pager:CancelPage", function(Tones, HasDetails, Details) 45 | TriggerClientEvent("Fire-EMS-Pager:CancelPage", -1, Tones, HasDetails, Details) 46 | end) 47 | 48 | -- Play fire siren on all clients 49 | RegisterServerEvent("Fire-EMS-Pager:SoundSirens") 50 | AddEventHandler("Fire-EMS-Pager:SoundSirens", function() 51 | TriggerClientEvent("Fire-EMS-Pager:PlaySirens", -1) 52 | end) 53 | 54 | -- Whitelist check on server join 55 | RegisterServerEvent("Fire-EMS-Pager:WhitelistCheck") 56 | AddEventHandler("Fire-EMS-Pager:WhitelistCheck", function(Whitelist) 57 | for i in pairs(Whitelist.Command) do 58 | Whitelist.Command[i] = "pending" 59 | end 60 | 61 | -- If usin json file as whitelist 62 | if Whitelist.Enabled:lower() == "json" then 63 | -- Collect all the data from the whitelist.json file 64 | local Data = LoadResourceFile(GetCurrentResourceName(), "whitelist.json") 65 | if Data then 66 | local Entries = json.decode(Data) 67 | 68 | -- Loop through the whitelist array 69 | for _, Entry in ipairs(Entries) do 70 | -- Check if the player exists in the array. 71 | if GetPlayerIdentifier(source):lower() == Entry.steamhex:lower() then 72 | -- Loop though all values in whitelist entry 73 | for i in pairs(Entry) do 74 | -- If the value is not the player's steam hex 75 | if i ~= "steamhex" then 76 | -- If whitelist value is true, aka they have access to a command 77 | if Entry[i] then 78 | -- If command is a valid command 79 | if Whitelist.Command[i] then 80 | -- Allow player to use that command 81 | Whitelist.Command[i] = true 82 | -- If command is not valid 83 | else 84 | print("===================================================================") 85 | print("==============================WARNING==============================") 86 | print("/" .. i .. " is not a valid command, but is listed in ") 87 | print(Entry.steamhex:lower() .. "'s whitelist entry. Please correct this") 88 | print("issue, and reload the whitelist with /pagerwhitelist reload.") 89 | print("Note: Entries are CaSe SeNsItIvE.") 90 | print("===================================================================") 91 | end 92 | end 93 | end 94 | end 95 | 96 | break 97 | end 98 | end 99 | -- If unable to load json file 100 | else 101 | print("===================================================================") 102 | print("==============================WARNING==============================") 103 | print("Unable to load whitelist file for Inferno-Fire-EMS-Pager. The white") 104 | print("list has been disabled. This message will appear every time someone") 105 | print("joins the server until the issue is corrected.") 106 | print("===================================================================") 107 | -- Loop through all commands 108 | for i in pairs(Whitelist.Command) do 109 | -- Grant players all permissions 110 | Whitelist.Command[i] = true 111 | end 112 | -- Override whitelist permission 113 | Whitelist.Command.pagerwhitelist = false 114 | end 115 | 116 | -- Loop through all commands 117 | for i in pairs(Whitelist.Command) do 118 | -- If command is still pending 119 | if Whitelist.Command[i] == "pending" then 120 | -- Deny access 121 | Whitelist.Command[i] = false 122 | end 123 | end 124 | -- If using Ace permissions 125 | elseif Whitelist.Enabled:lower() == "ace" then 126 | -- Loop through all commands 127 | for i in pairs(Whitelist.Command) do 128 | -- Grant player permission to command based on Ace group 129 | Whitelist.Command[i] = IsPlayerAceAllowed(source, "fire-ems-pager." .. i) 130 | end 131 | -- If using neither json, Ace, or disabled 132 | else 133 | print("===================================================================") 134 | print("==============================WARNING==============================") 135 | print("''" .. tostring(Whitelist.Enabled) .. "'' is not a valid Whitelist option.") 136 | print("The whitelist has been disabled.") 137 | print("===================================================================") 138 | -- Loop through all commands 139 | for i in pairs(Whitelist.Command) do 140 | -- Grant players all permissions 141 | Whitelist.Command[i] = true 142 | end 143 | -- Override whitelist permission 144 | Whitelist.Command.pagerwhitelist = false 145 | end 146 | 147 | TriggerClientEvent("Fire-EMS-Pager:return:WhitelistCheck", source, Whitelist) 148 | end) 149 | 150 | -- Whitelist reload on all clients 151 | RegisterServerEvent("Fire-EMS-Pager:WhitelistReload") 152 | AddEventHandler("Fire-EMS-Pager:WhitelistReload", function() 153 | TriggerClientEvent("Fire-EMS-Pager:WhitelistRecheck", -1) 154 | end) 155 | 156 | -- Add entry to whitelist (json only) 157 | RegisterServerEvent("Fire-EMS-Pager:WhitelistAdd") 158 | AddEventHandler("Fire-EMS-Pager:WhitelistAdd", function(ID, Entry) 159 | -- Collect all the data from the whitelist.json file 160 | local Data = json.decode(LoadResourceFile(GetCurrentResourceName(), "whitelist.json")) 161 | 162 | -- If 'steam hex' provided was a number 163 | if tonumber(ID) then 164 | -- Get steam hex based off of number 165 | ID = GetPlayerIdentifier(ID) 166 | end 167 | 168 | -- Add the steam hex to the whitelist entry 169 | Entry.steamhex = ID 170 | -- Add the entry to the existing whitelist 171 | table.insert(Data, Entry) 172 | -- Covert the entire object to a json format, then save it over the existing file 173 | SaveResourceFile(GetCurrentResourceName(), "whitelist.json", json.encode(Data), -1) 174 | 175 | TriggerClientEvent("Fire-EMS-Pager:WhitelistRecheck", -1) 176 | end) -------------------------------------------------------------------------------- /[inferno-collection]/inferno-fire-ems-pager/client.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Fire/EMS Pager + Fire Siren Version 4.55 Beta 2 | -- 3 | -- Copyright (c) 2019, Christopher M, Inferno Collection. All rights reserved. 4 | -- 5 | -- This project is licensed under the following: 6 | -- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the software'), to use, copy, modify, and merge the software, under the following conditions: 7 | -- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | -- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. THE SOFTWARE MAY NOT BE SOLD. 9 | -- 10 | 11 | -- 12 | -- Resource Configuration 13 | -- PLEASE RESTART SERVER AFTER MAKING CHANGES TO THIS CONFIGURATION 14 | -- 15 | local Config = {} -- Do not edit this line 16 | -- Whether or not to disable all on-screen messages, exect call details 17 | Config.DisableAllMessages = false 18 | -- Whether or not to enable chat suggestions 19 | Config.ChatSuggestions = true 20 | -- Whether or not to enable a reminder for whitelisted people to enable their pagers shortly 21 | -- after they join the server, if they have not done so already 22 | Config.Reminder = true 23 | -- Whether or not to enable command whitelist. 24 | -- 'ace' to use Ace permissions, 'json' to use whitelist.json file, or false to disable. 25 | Config.WhitelistEnabled = false 26 | -- Separator character, goes between tones and details in /page command 27 | Config.PageSep = '-' 28 | -- Default fire department name, used in /page command 29 | Config.DeptName = 'Los Santos Fire' 30 | -- Default text shown when page details are not provided 31 | Config.DefaultDetails = 'Report to Station' 32 | -- Time in ms between the beginning of each tone played. 33 | -- 7.5 seconds by default, do not edit unless you need to 34 | Config.WaitTime = 7500 35 | -- List of tones that can be paged, read the wiki page below to learn how to add more 36 | -- https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-tones 37 | Config.Tones = {'medical', 'rescue', 'fire', 'other'} 38 | -- List of stations fire sirens can be played at, read the wiki page below to learn how to add more 39 | -- https://github.com/inferno-collection/Fire-EMS-Pager/wiki/Adding-custom-stations 40 | Config.Stations = {} -- Do not edit this line 41 | table.insert(Config.Stations, {Name = 'pb', Loc = vector3(-379.53, 6118.32, 31.85), Radius = 800, Siren = 'siren1'}) -- Paleto Bay 42 | table.insert(Config.Stations, {Name = 'fz', Loc = vector3(-2095.92, 2830.22, 32.96), Radius = 1000, Siren = 'siren2'}) -- Fort Zancudo 43 | table.insert(Config.Stations, {Name = 'ss', Loc = vector3(1691.24, 3585.83, 35.62), Radius = 500, Siren = 'siren1'}) -- Sandy Shores 44 | table.insert(Config.Stations, {Name = 'rh', Loc = vector3(-635.09, -124.29, 39.01), Radius = 400, Siren = 'siren1'}) -- Rockford Hills 45 | table.insert(Config.Stations, {Name = 'els', Loc = vector3(1193.42, -1473.72, 34.86), Radius = 400, Siren = 'siren1'}) -- East Los Santos 46 | table.insert(Config.Stations, {Name = 'sls', Loc = vector3(199.83, -1643.38, 29.8), Radius = 400, Siren = 'siren1'}) -- South Los Santos 47 | table.insert(Config.Stations, {Name = 'dpb', Loc = vector3(-1183.13, -1773.91, 4.05), Radius = 400, Siren = 'siren1'}) -- Del Perro Beach 48 | table.insert(Config.Stations, {Name = 'lsia', Loc = vector3(-1068.74, -2379.96, 14.05), Radius = 500, Siren = 'siren2'}) -- LSIA 49 | 50 | -- 51 | -- Nothing past this point needs to be edited, all the settings for the resource are found ABOVE this line. 52 | -- Do not make changes below this line unless you know what you are doing! 53 | -- 54 | 55 | -- Local Pager Variables 56 | local Pager = {} 57 | -- Is the clients local pager enabled 58 | Pager.Enabled = false 59 | -- Are all clients currently being paged 60 | Pager.Paging = false 61 | -- What the clients local pager is tuned to 62 | Pager.TunedTo = {} 63 | -- How long to wait between tones being played 64 | Pager.WaitTime = Config.WaitTime 65 | -- List of tones that can be paged 66 | Pager.Tones = Config.Tones 67 | 68 | -- Local Fire Siren Variables 69 | local FireSiren = {} 70 | -- Stations that currently have a fire siren being played 71 | FireSiren.EnabledStations = {} 72 | -- Fire Station Variables 73 | FireSiren.Stations = Config.Stations 74 | 75 | -- Local whitelist variable 76 | local Whitelist = {} 77 | -- Boolean for whether the whitelist is enabled 78 | Whitelist.Enabled = Config.WhitelistEnabled 79 | -- Whitelist variable for commands 80 | Whitelist.Command = {} 81 | -- Boolean for whether player is whitelisted for pager command 82 | Whitelist.Command.pager = false 83 | -- Boolean for whether player is whitelisted for page command 84 | Whitelist.Command.page = false 85 | -- Boolean for whether player is whitelisted for firesiren command 86 | Whitelist.Command.firesiren = false 87 | -- Boolean for whether player is whitelisted for cancelpage command 88 | Whitelist.Command.cancelpage = false 89 | -- Boolean for whether player is whitelisted for pagerwhitelist command 90 | Whitelist.Command.pagerwhitelist = false 91 | 92 | AddEventHandler('onClientResourceStart', function (ResourceName) 93 | if(GetCurrentResourceName() == ResourceName) then 94 | if Whitelist.Enabled then 95 | TriggerServerEvent('Fire-EMS-Pager:WhitelistCheck', Whitelist) 96 | else 97 | for i in pairs(Whitelist.Command) do 98 | Whitelist.Command[i] = true 99 | end 100 | 101 | Whitelist.Command.pagerwhitelist = false 102 | end 103 | end 104 | end) 105 | 106 | -- On client join server 107 | AddEventHandler('onClientMapStart', function() 108 | if Config.ChatSuggestions then 109 | -- Create a temporary variables to add more text to 110 | local ValidTones = 'Valid tones:' 111 | local ValidStations = 'Valid stations:' 112 | 113 | -- Loop though all the tones 114 | for _, Tone in ipairs(Pager.Tones) do 115 | -- Add a tone to temporary string 116 | ValidTones = ValidTones .. ' ' .. Tone 117 | end 118 | 119 | -- Loop though all the stations 120 | for _, Station in ipairs(FireSiren.Stations) do 121 | -- Add a station to temporary string 122 | ValidStations = ValidStations .. ' ' .. Station.Name 123 | end 124 | 125 | TriggerEvent('chat:addSuggestion', '/pager', 'From already being tuned, will turn off Pager. From the pager being off, enter tones to be tuned to, or if already tuned, tones to be retuned to. Put a space between each tone.', { 126 | { name = 'tone', help = ValidTones } 127 | }) 128 | 129 | TriggerEvent('chat:addSuggestion', '/page', 'If no other tones are currently being paged, will page entered tones. Put a space between each tone.', { 130 | { name = 'tones', help = ValidTones }, 131 | { name = '- call details', help = 'To add optional details, add a space after the last tone, then a '-', then another space, then your details. For example: /page fire medical - Your Details Go Here' } 132 | }) 133 | 134 | TriggerEvent('chat:addSuggestion', '/cancelpage', 'Plays cancel tone for selected tones, and shows disregard notification.', { 135 | { name = 'tones', help = ValidTones }, 136 | { name = '- disregard details', help = 'To add optional disregard details, add a space after the last tone, then a '-', then another space, then your details. For example: /cancelpage fire medical - Your Disregard Details Go Here' } 137 | }) 138 | 139 | TriggerEvent('chat:addSuggestion', '/firesiren', 'If no other sirens are currently being sounded, will page fire siren at entered stations. Put a space between each station.', { 140 | { name = 'stations', help = ValidStations } 141 | }) 142 | 143 | TriggerEvent('chat:addSuggestion', '/pagerwhitelist', 'Add to, and/or reload the command whitelist.', { 144 | { name = '{reload} or {player hex/server id}', help = 'Type "reload" to reload the current whitelist, or if you are adding to the whitelist, type out the players steam hex, or put the players server ID from the player list.' }, 145 | { name = 'commands', help = 'List all the commands you want this person to have access to.'} 146 | }) 147 | end 148 | 149 | if Whitelist.Enabled then 150 | TriggerServerEvent('Fire-EMS-Pager:WhitelistCheck', Whitelist) 151 | else 152 | for i in pairs(Whitelist.Command) do 153 | Whitelist.Command[i] = true 154 | end 155 | 156 | Whitelist.Command.pagerwhitelist = false 157 | end 158 | 159 | -- Adds page command chat template, including pager icon 160 | TriggerEvent('chat:addTemplate', 'page', ' {0}: {1}') 161 | end) 162 | 163 | -- Return from whitelist check 164 | RegisterNetEvent('Fire-EMS-Pager:return:WhitelistCheck') 165 | AddEventHandler('Fire-EMS-Pager:return:WhitelistCheck', function(NewWhitelist) 166 | -- Update local whitelist values with server ones 167 | Whitelist = NewWhitelist 168 | 169 | -- If reminder is enabled and the client is whitelisted to use the /pager command 170 | if Config.Reminder and Whitelist.Command.pager then 171 | -- Wait two minutes after they join the server 172 | Citizen.Wait(120000) 173 | -- If their pager is still not enabled 174 | if not Pager.Enabled then 175 | -- Send reminder 176 | NewNoti('~y~Do not forget to tune your pager!', true) 177 | end 178 | end 179 | end) 180 | 181 | -- Forces a whitelist reload on the client 182 | RegisterNetEvent('Fire-EMS-Pager:WhitelistRecheck') 183 | AddEventHandler('Fire-EMS-Pager:WhitelistRecheck', function() 184 | TriggerServerEvent('Fire-EMS-Pager:WhitelistCheck', Whitelist) 185 | end) 186 | 187 | -- /pager command 188 | -- Used to enable and disable pager, and set tones to be tuned to 189 | RegisterCommand('pager', function(Source, Args) 190 | if Whitelist.Command.pager then 191 | function EnablePager() 192 | -- Loop though all the tones provided by the client 193 | for _, ProvidedTone in ipairs(Args) do 194 | -- Loop through all the valid tones 195 | for _, ValidTone in ipairs(Pager.Tones) do 196 | -- If a provided tone matches a valid tone 197 | if ProvidedTone:lower() == ValidTone then 198 | -- Add it to the list of tones to be tuned to 199 | table.insert(Pager.TunedTo, ValidTone) 200 | end 201 | end 202 | end 203 | 204 | -- If the number of originally provided tones matches the 205 | -- number of tones, and there where tones acutally provided 206 | -- in the first place 207 | if not #Args ~= #Pager.TunedTo and #Args ~= 0 then 208 | -- Create a temporary variable to add more text to 209 | local NotificationText = '~g~Pager tuned to:~y~' 210 | -- Loop though all the tones that the client will be tuned to 211 | for _, Tone in ipairs(Pager.TunedTo) do 212 | -- Add them to the temporary variable 213 | NotificationText = NotificationText .. ' ' .. Tone:upper() 214 | end 215 | NewNoti(NotificationText, false) 216 | -- Locally anable the clients pager 217 | Pager.Enabled = true 218 | -- If there is a mismatch, i.e. invalid/no tone/s provided 219 | else 220 | NewNoti('~r~~h~Invalid tones, please check your command arguments.', true) 221 | -- Ensure the clients pager is locally disabled 222 | Pager.Enabled = false 223 | Pager.TunedTo = {} 224 | end 225 | end 226 | 227 | if not Pager.Enabled then 228 | EnablePager() 229 | else 230 | -- If there are tones provided 231 | if #Args ~= 0 then 232 | -- Clear list of currently tuned tones to avoid duplicates 233 | Pager.TunedTo = {} 234 | EnablePager() 235 | -- If no tones where provided, and they just want it turned off 236 | else 237 | NewNoti('~g~Pager turned off.', false) 238 | -- Ensure the clients pager is locally disabled 239 | Pager.Enabled = false 240 | Pager.TunedTo = {} 241 | end 242 | end 243 | -- If player is not whitelisted 244 | else 245 | NewNoti('~r~You are not whitelisted for this command.', true) 246 | end 247 | end) 248 | 249 | -- /page command 250 | -- Used to page out a tone/s 251 | RegisterCommand('page', function(Source, Args) 252 | local ToneCount = 0 253 | local HasDetails = false 254 | local ToBePaged = {} 255 | 256 | if Whitelist.Command.page then 257 | -- If tones are not already being paged 258 | if not Pager.Paging then 259 | -- Loop though all the tones provided in the command 260 | for _, ProvidedTone in ipairs(Args) do 261 | -- Loop through all the valid tones 262 | for _, ValidTone in ipairs(Pager.Tones) do 263 | -- If a provided tone matches a valid tone 264 | if ProvidedTone:lower() == ValidTone then 265 | -- Add it to the list of tones to be paged 266 | table.insert(ToBePaged, ValidTone) 267 | break 268 | -- Checks for the separator character 269 | elseif ProvidedTone:lower() == Config.PageSep then 270 | HasDetails = true 271 | -- Counts up to the number of valid tones provided 272 | -- plus 1, to include the separator 273 | for _ = ToneCount + 1, 1, -1 do 274 | -- Remove tones from arguments to leave only details 275 | table.remove(Args, 1) 276 | end 277 | 278 | break 279 | end 280 | end 281 | 282 | if HasDetails then 283 | break 284 | end 285 | 286 | ToneCount = ToneCount + 1 287 | end 288 | 289 | -- If the number of originally provided tones matches the 290 | -- number of tones, and there where tones acutally provided 291 | -- in the first place 292 | if not ToneCount ~= #ToBePaged and ToneCount ~= 0 then 293 | -- Create a temporary variable to add more text to 294 | local NotificationText = '~g~Paging:~y~' 295 | -- Loop though all the tones 296 | for _, Tone in ipairs(ToBePaged) do 297 | -- Add a tone to temporary string 298 | NotificationText = NotificationText .. ' ' .. Tone:upper() 299 | end 300 | NewNoti(NotificationText, false) 301 | -- Bounces tones off of server 302 | TriggerServerEvent('Fire-EMS-Pager:PageTones', ToBePaged, HasDetails, Args) 303 | -- If there is a mismatch, i.e. invalid/no tone/s provided 304 | else 305 | NewNoti('~r~~h~Invalid tones, please check your command arguments.', true) 306 | end 307 | else 308 | NewNoti('~r~~h~Tones are already being paged.', true) 309 | end 310 | -- If player is not whitelisted 311 | else 312 | NewNoti('~r~You are not whitelisted for this command.', true) 313 | end 314 | end) 315 | 316 | -- /firesiren command 317 | -- Used to play a fire siren at a specific station/s 318 | RegisterCommand('firesiren', function(Source, Args) 319 | if Whitelist.Command.firesiren then 320 | local ToBeSirened = {} 321 | -- Loop though all the stations provided in the command 322 | for _, ProvidedStation in ipairs(Args) do 323 | -- Loop through all the valid stations 324 | for _, ValidStation in ipairs(FireSiren.Stations) do 325 | -- If a provided station matches a valid station 326 | if ProvidedStation:lower() == ValidStation.Name then 327 | -- If station is not already playing a siren 328 | if not FireSiren.EnabledStations[ProvidedStation:lower()] then 329 | ValidStation.x, ValidStation.y, ValidStation.z = table.unpack(ValidStation.Loc) 330 | table.insert(ToBeSirened, ValidStation) 331 | -- Station is already playing a siren 332 | else 333 | NewNoti('~r~~h~One or more stations provided are already sounding!', true) 334 | return 335 | end 336 | end 337 | end 338 | end 339 | 340 | -- If the number of originally provided stations matches 341 | -- the number of stations, and there where stations acutally 342 | -- provided in the first place 343 | if not #Args ~= #ToBeSirened and #Args ~= 0 then 344 | -- Create a temporary variable to add more text to 345 | local NotificationText = '~g~Sounding:~y~' 346 | -- Loop though all stations 347 | for _, Station in ipairs(ToBeSirened) do 348 | TriggerServerEvent('Fire-EMS-Pager:StoreSiren', Station) 349 | -- Add station to temporary variable 350 | NotificationText = NotificationText .. ' ' .. Station.Name:upper() 351 | end 352 | NewNoti(NotificationText, false) 353 | Citizen.Wait(2000) 354 | TriggerServerEvent('Fire-EMS-Pager:SoundSirens', ToBeSirened) 355 | -- If there is a mismatch, i.e. invalid/no stations/s provided 356 | else 357 | NewNoti('~r~~h~Invalid stations for sounding, please check your command arguments.', true) 358 | end 359 | -- If player is not whitelisted 360 | else 361 | NewNoti('~r~You are not whitelisted for this command.', true) 362 | end 363 | end) 364 | 365 | -- /cancelpage command 366 | -- Used to play a sound to signal a canceled call 367 | RegisterCommand('cancelpage', function(Source, Args) 368 | local ToneCount = 0 369 | local HasDetails = false 370 | local ToBeCanceled = {} 371 | 372 | if Whitelist.Command.cancelpage then 373 | if not Pager.Paging then 374 | -- Loop though all the tones provided in the command 375 | for _, ProvidedTone in ipairs(Args) do 376 | -- Loop through all the valid tones 377 | for _, ValidTone in ipairs(Pager.Tones) do 378 | -- If a provided tone matches a valid tone 379 | if ProvidedTone:lower() == ValidTone then 380 | -- Add it to the list of tones to be paged 381 | table.insert(ToBeCanceled, ValidTone) 382 | break 383 | -- Checks for the separator character 384 | elseif ProvidedTone:lower() == Config.PageSep then 385 | HasDetails = true 386 | -- Counts up to the number of valid tones provided 387 | -- plus 1, to include the separator 388 | for _ = ToneCount + 1, 1, -1 do 389 | -- Remove tones from arguments to leave details 390 | table.remove(Args, 1) 391 | end 392 | 393 | break 394 | end 395 | end 396 | 397 | if HasDetails then 398 | break 399 | end 400 | 401 | ToneCount = ToneCount + 1 402 | end 403 | 404 | -- If the number of originally provided tones matches the 405 | -- number of tones, and there where tones acutally provided 406 | -- in the first place 407 | if not ToneCount ~= #ToBeCanceled and ToneCount ~= 0 then 408 | -- Create a temporary variable to add more text to 409 | local NotificationText = '~g~Canceling:~y~' 410 | -- Loop though all the tones 411 | for _, Tone in ipairs(ToBeCanceled) do 412 | -- Add a tone to temporary string 413 | NotificationText = NotificationText .. ' ' .. Tone:upper() 414 | end 415 | NewNoti(NotificationText, false) 416 | -- Bounces tones off of server 417 | TriggerServerEvent('Fire-EMS-Pager:CancelPage', ToBeCanceled, HasDetails, Args) 418 | -- If there is a mismatch, i.e. invalid/no tone/s provided 419 | else 420 | NewNoti('~r~~h~Invalid tones, please check your command arguments.', true) 421 | end 422 | -- If tones are already being paged 423 | else 424 | NewNoti('~r~~h~Tones are being paged, please wait.', true) 425 | end 426 | -- If player is not whitelisted 427 | else 428 | NewNoti('~r~You are not whitelisted for this command.', true) 429 | end 430 | end) 431 | 432 | -- /pagerwhitelist 433 | -- Reload, and/or add someone to the whitelist 434 | RegisterCommand('pagerwhitelist', function(Source, Args) 435 | if Whitelist.Command.pagerwhitelist then 436 | -- If the first argument is defined and is equal to 'reload' 437 | if Args[1] and Args[1]:lower() == 'reload' then 438 | -- Tell server to reload the whitelist on all clients 439 | TriggerServerEvent('Fire-EMS-Pager:WhitelistReload') 440 | NewNoti('~g~Whitelist reload complete.', true) 441 | elseif Args[1] then 442 | -- Temporary variable for steam hex 443 | local ID 444 | -- Temporary whitelist entry variables 445 | local Entry = {} 446 | -- Declaring valid commands 447 | Entry.pager = 'pending' 448 | Entry.page = 'pending' 449 | Entry.firesiren = 'pending' 450 | Entry.cancelpage = 'pending' 451 | Entry.pagerwhitelist = 'pending' 452 | 453 | -- If the first argument is a number 454 | if tonumber(Args[1]) then 455 | -- Set the steam hex to the number, assuming a server ID has been provided 456 | ID = Args[1] 457 | -- Else if the first part of the string contains steam:' 458 | elseif string.sub(Args[1]:lower(), 1, string.len('steam:')) == 'steam:' then 459 | -- Set the steam hex to the string 460 | ID = Args[1] 461 | -- In all other cases 462 | else 463 | -- Set the steam hex to the string, adding steam:' to the front 464 | ID = 'steam:' .. Args[1] 465 | end 466 | 467 | -- Loop though all command arguments 468 | for i in pairs(Args) do 469 | -- If the argument is a valid command 470 | if Entry[Args[i]:lower()] then 471 | -- Allow the player access to the command 472 | Entry[Args[i]] = true 473 | end 474 | end 475 | 476 | -- Loop though all commands 477 | for i in pairs(Entry) do 478 | -- If the command is still pending 479 | if Entry[i] == 'pending' then 480 | -- Disallow the player access to the command 481 | Entry[i] = false 482 | end 483 | end 484 | 485 | -- Tell the server to add the new entry to the whitelist and reload 486 | TriggerServerEvent('Fire-EMS-Pager:WhitelistAdd', ID, Entry) 487 | NewNoti('~g~' .. ID .. ' Added to whitelist successfully.', true) 488 | -- If first argument not set 489 | else 490 | NewNoti('~r~Error, not enough arguments.', true) 491 | end 492 | -- If player is not whitelisted 493 | else 494 | NewNoti('~r~You are not whitelisted for this command.', true) 495 | end 496 | end) 497 | 498 | -- Plays tones on the client 499 | RegisterNetEvent('Fire-EMS-Pager:PlayTones') 500 | AddEventHandler('Fire-EMS-Pager:PlayTones', function(Tones, HasDetails, Details) 501 | local NeedToPlay = false 502 | local Tuned 503 | Pager.Paging = true 504 | 505 | if Pager.Enabled then 506 | -- Loop though all tones that need to be paged 507 | for _, Tone in ipairs(Tones) do 508 | -- Loop through all the tones the player is tuned to 509 | for _, TunedTone in ipairs(Pager.TunedTo) do 510 | -- If player is tuned to this tone 511 | if Tone == TunedTone then 512 | -- Set temporary variable 513 | NeedToPlay = true 514 | end 515 | end 516 | end 517 | 518 | -- If the player is tuned to one or more of the tones being paged 519 | if NeedToPlay then 520 | NewNoti('~g~~h~Your pager activates!', true) 521 | Citizen.Wait(1500) 522 | -- Loop though all tones that need to be paged 523 | for _, Tone in ipairs(Tones) do 524 | -- Reset to false 525 | Tuned = false 526 | -- Loop through all the tones the player is tuned to 527 | for _, TunedTone in ipairs(Pager.TunedTo) do 528 | -- If player is tuned to this specific tone 529 | if Tone == TunedTone then 530 | -- Set temporary variable 531 | Tuned = true 532 | end 533 | end 534 | 535 | -- If player is tuned to this tone 536 | if Tuned then 537 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'PlayTone', 'vibrate') 538 | NewNoti('~h~~y~' .. Tone:upper() .. ' call!', true) 539 | -- If player is not tuned to it 540 | else 541 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'PlayTone', Tone) 542 | end 543 | Citizen.Wait(Pager.WaitTime) 544 | end 545 | 546 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'PlayTone', 'end') 547 | 548 | local Hours = GetClockHours() 549 | local Minutes = GetClockMinutes() 550 | 551 | if Hours <= 9 then 552 | -- Add a 0 infront 553 | Hours = '0' .. tostring(Hours) 554 | end 555 | 556 | if Minutes <= 9 then 557 | -- Add a 0 infront 558 | Minutes = '0' .. tostring(Minutes) 559 | end 560 | 561 | if HasDetails then 562 | local NewDetails = '' 563 | local NewTones = '' 564 | 565 | -- Loop though details (each word is an element) 566 | for _, l in ipairs(Details) do 567 | -- Add word to temporary variable 568 | NewDetails = NewDetails .. ' ' .. l 569 | end 570 | -- Capitalise first letter 571 | NewDetails = NewDetails:gsub('^%l', string.upper) 572 | 573 | -- Loop though all tones 574 | for _, Tone in ipairs(Tones) do 575 | -- Add tone to string and capitalise 576 | NewTones = NewTones .. Tone:gsub('^%l', string.upper) .. ' ' 577 | end 578 | 579 | -- Send message to chat, only people tuned to specified tones can see the message 580 | TriggerEvent('chat:addMessage', { 581 | --templateId = 'page', 582 | -- Red 583 | color = { 255, 0, 0}, 584 | multiline = true, 585 | args = {'Fire Control', '\nAttention ' .. Config.DeptName .. ' - ' .. NewDetails .. ' - ' .. NewTones .. 'Emergency.\n\nTimeout ' .. Hours .. Minutes.. '.'} 586 | }) 587 | -- If no details provided 588 | else 589 | -- Send message to chat, only people tuned to specified tones can see the message 590 | TriggerEvent('chat:addMessage', { 591 | --templateId = 'page', 592 | -- Red 593 | color = { 255, 0, 0}, 594 | multiline = true, 595 | args = {'Fire Control', '\nAttention ' .. Config.DeptName .. ' - ' .. Config.DefaultDetails .. '.\n\nTimeout ' .. Hours .. Minutes.. '.'} 596 | }) 597 | end 598 | else 599 | for _, _ in ipairs(Tones) do 600 | Citizen.Wait(Pager.WaitTime) 601 | end 602 | 603 | Citizen.Wait(1500) 604 | end 605 | else 606 | for _, _ in ipairs(Tones) do 607 | Citizen.Wait(Pager.WaitTime) 608 | end 609 | end 610 | 611 | Citizen.Wait(3000) 612 | Pager.Paging = false 613 | end) 614 | 615 | -- Play fire sirens 616 | RegisterNetEvent('Fire-EMS-Pager:PlaySirens') 617 | AddEventHandler('Fire-EMS-Pager:PlaySirens', function() 618 | for _, Station in pairs(FireSiren.EnabledStations) do 619 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'PlaySiren', {Station.Name, Station.ID, Station.Siren}) 620 | end 621 | end) 622 | 623 | -- Plays cancelpage sound on the client 624 | RegisterNetEvent('Fire-EMS-Pager:CancelPage') 625 | AddEventHandler('Fire-EMS-Pager:CancelPage', function(Tones, HasDetails, Details) 626 | local NeedToPlay = false 627 | Pager.Paging = true 628 | 629 | if Pager.Enabled then 630 | -- Loop though all tones that need to be paged 631 | for _, Tone in ipairs(Tones) do 632 | -- Loop through all the tones the player is tuned to 633 | for _, TunedTone in ipairs(Pager.TunedTo) do 634 | -- If player is tuned to this tone 635 | if Tone == TunedTone then 636 | -- Set temporary variable 637 | NeedToPlay = true 638 | end 639 | end 640 | end 641 | 642 | -- If the player is tuned to one or more of the tones being paged 643 | if NeedToPlay then 644 | NewNoti('~g~~h~Your pager activates!', true) 645 | Citizen.Wait(1500) 646 | 647 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'PlayTone', 'cancel') 648 | 649 | if HasDetails then 650 | local NewDetails = '' 651 | 652 | -- Loop though details (each word is an element) 653 | for _, l in ipairs(Details) do 654 | -- Add word to temporary variable 655 | NewDetails = NewDetails .. ' ' .. l 656 | end 657 | -- Capitalise first letter 658 | NewDetails = NewDetails:gsub('^%l', string.upper) 659 | 660 | -- Send message to chat, only people tuned to specified tones can see the message 661 | TriggerEvent('chat:addMessage', { 662 | --templateId = 'page', 663 | -- Red 664 | color = { 255, 0, 0}, 665 | multiline = true, 666 | args = {'Fire Control', '\nAttention ' .. Config.DeptName .. ' - Call canceled, disregard response - ' .. NewDetails} 667 | }) 668 | -- If no details provided 669 | else 670 | -- Send message to chat, only people tuned to specified tones can see the message 671 | TriggerEvent('chat:addMessage', { 672 | --templateId = 'page', 673 | -- Red 674 | color = { 255, 0, 0}, 675 | multiline = true, 676 | args = {'Fire Control', '\nAttention ' .. Config.DeptName .. ' - Call canceled, disregard response.'} 677 | }) 678 | end 679 | else 680 | Citizen.Wait(1500) 681 | end 682 | else 683 | Citizen.Wait(1500) 684 | end 685 | 686 | Citizen.Wait(3500) 687 | Pager.Paging = false 688 | end) 689 | 690 | RegisterNUICallback('RemoveSiren', function(Station) 691 | -- If the client is the owner of this fire siren, remove fire siren 692 | -- This check is done so only one event is sent to the server instead of 32+ 693 | if GetPlayerServerId(PlayerId()) == Station.ID then 694 | TriggerServerEvent('Fire-EMS-Pager:RemoveSiren', Station.Name) 695 | end 696 | 697 | FireSiren.EnabledStations[Station.Name] = nil 698 | end) 699 | 700 | -- Bounce between server script and client script 701 | RegisterNetEvent('Fire-EMS-Pager:Bounce:ServerValues') 702 | AddEventHandler('Fire-EMS-Pager:Bounce:ServerValues', function(Sirens) FireSiren.EnabledStations = Sirens end) 703 | 704 | -- Bounce between server & client script and client NUI 705 | RegisterNetEvent('Fire-EMS-Pager:Bounce:NUI') 706 | AddEventHandler('Fire-EMS-Pager:Bounce:NUI', function(Type, Load) 707 | SendNUIMessage({ 708 | PayloadType = Type, 709 | Payload = Load 710 | }) 711 | end) 712 | 713 | -- Draws notification on clients screen 714 | function NewNoti(Text, Flash) 715 | if not Config.DisableAllMessages then 716 | -- Tell GTA that a string will be passed 717 | SetNotificationTextEntry('STRING') 718 | -- Pass temporary variable to notification 719 | AddTextComponentString(Text) 720 | -- Draw new notification on clients screen 721 | DrawNotification(Flash, true) 722 | end 723 | end 724 | 725 | -- Volume loop 726 | -- Sets the volumes of all active fire sirens 727 | Citizen.CreateThread(function() 728 | while true do 729 | Citizen.Wait(0) 730 | 731 | local FireSirenCount = 0 732 | for _, _ in pairs(FireSiren.EnabledStations) do FireSirenCount = FireSirenCount + 1 end 733 | 734 | if FireSirenCount >= 1 then 735 | local PlayerPed = PlayerPedId() 736 | local PlayerCoords = GetEntityCoords(PlayerPed, false) 737 | 738 | for _, Station in pairs(FireSiren.EnabledStations) do 739 | local Distance = Vdist(PlayerCoords.x, PlayerCoords.y, PlayerCoords.z, Station.x, Station.y, Station.z) + 0.01 -- Stops divide by 0 errors 740 | if (Distance <= Station.Radius) then 741 | 742 | local SirenVolume = 1 - (Distance / Station.Radius) 743 | if IsPedInAnyVehicle(PlayerPedId(), false) then 744 | local VC = GetVehicleClass(GetVehiclePedIsIn(PlayerPedId()), false) 745 | -- If vehicle is not a motobike or a bicycle 746 | if VC ~= 8 or VC ~= 13 then 747 | -- Lower the alarm volume by 45% 748 | SirenVolume = SirenVolume * 0.45 749 | end 750 | end 751 | 752 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'SetSirenVolume', {Station.Name, SirenVolume}) 753 | else 754 | TriggerEvent('Fire-EMS-Pager:Bounce:NUI', 'SetSirenVolume', {Station.Name, 0}) 755 | end 756 | end 757 | end 758 | 759 | end 760 | end) 761 | --------------------------------------------------------------------------------