├── .gitignore ├── [inferno-collection] └── inferno-police-panic │ ├── html │ ├── sounds │ │ ├── localpanic.ogg │ │ └── externalpanic.ogg │ └── index.html │ ├── whitelist.json │ ├── fxmanifest.lua │ ├── inferno-police-panic.cfg │ ├── server.lua │ └── client.lua ├── .github └── ISSUE_TEMPLATE │ ├── bug_report.md │ └── suggestion.md ├── LICENCE.txt ├── .travis.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/html/sounds/localpanic.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Police-Panic/HEAD/[inferno-collection]/inferno-police-panic/html/sounds/localpanic.ogg -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/html/sounds/externalpanic.ogg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/inferno-collection/Police-Panic/HEAD/[inferno-collection]/inferno-police-panic/html/sounds/externalpanic.ogg -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/whitelist.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "steamhex" : "steam:1100001076264E1", 4 | "panic" : true, 5 | "panictune" : true, 6 | "panicwhitelist" : true, 7 | "autotune" : true 8 | } 9 | ] -------------------------------------------------------------------------------- /.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-police-panic/fxmanifest.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Police Panic Version 1.22 Beta 2 | -- 3 | -- Copyright (c) 2019 - 2020, 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 "Police Panic - Inferno Collection" 12 | 13 | description "The Police Panic script is a simple Standalone script that allows Officers to tune into a \"Panic Channel\", which allows them to receive Panic Button activations, as well as activate their own Panic Button." 14 | 15 | author "Inferno Collection (inferno-collection.com)" 16 | 17 | version "1.22 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/*.ogg" 31 | } 32 | 33 | fx_version "bodacious" 34 | 35 | game "gta5" -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | # Inferno Collection Police Panic Version 1.22 Beta 2 | # 3 | # Copyright (c) 2019 - 2020, 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 | language: python 12 | sudo: false 13 | 14 | env: 15 | - LUA="lua=5.1" 16 | - LUA="lua=5.2" 17 | - LUA="lua=5.3" 18 | - LUA="luajit=2.0" 19 | - LUA="luajit=2.1" 20 | 21 | before_install: 22 | - pip install hererocks 23 | - hererocks lua_install -r^ --$LUA 24 | - export PATH=$PATH:$PWD/lua_install/bin 25 | 26 | install: 27 | - luarocks install luacheck 28 | 29 | script: 30 | - luacheck -g -a --no-max-line-length --no-max-comment-line-length [inferno-collection]/inferno-police-panic 31 | 32 | after_success: 33 | - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh 34 | - chmod +x send.sh 35 | - ./send.sh success $WEBHOOK_URL 36 | after_failure: 37 | - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh 38 | - chmod +x send.sh 39 | - ./send.sh failure $WEBHOOK_URL -------------------------------------------------------------------------------- /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: Police Panic 7 | [![Build Status](https://travis-ci.com/inferno-collection/Police-Panic.svg?branch=master)](https://travis-ci.com/inferno-collection/Police-Panic) 8 | 9 | __Public Beta Version 1.22__ 10 | 11 | The Police Panic script is a simple Standalone script that allows Officers to tune into a "Panic Channel", which allows them to receive Panic Button activations, as well as activate their own Panic Button. Once a Panic Button is activated, all tuned Officers will hear an Emergency tone, followed by the name of the Officer, their nearest street and cross street, as well as a large flashing blip on their map, with a flashing map route; these will only display for a few seconds. 12 | 13 | Presently, the following can be customized: 14 | - Cooldown time between activations 15 | - Chat Messages 16 | - Amount of time blip and route show for 17 | - Toggleable reminder 18 | - Auto tuning 19 | - Based off of whitelist OR 20 | - Based off of vehicles 21 | - Toggleable notifications and chat suggestions 22 | - Which players can use which command (via a whitelist). 23 | - Choice of three whitelist options: 24 | 1. Steam ID based JSON file 25 | 2. Ace Permissions 26 | 3. No whitelist 27 | 28 | *** 29 | ### Development Showcase Video (Showing an older version) 30 | [![Watch the Development Showcase video](https://img.youtube.com/vi/-usFNl5YXb4/maxresdefault.jpg)](https://www.youtube.com/watch?v=-usFNl5YXb4) 31 | *** 32 | 33 | > Download Link 34 | 35 | https://github.com/inferno-collection/Police-Panic/releases 36 | 37 | > Pictures 38 | 39 | ![SPOILER-unknown|671x328](https://i.ibb.co/HCDXY8B/SPOILER-unknown.png) 40 | 41 | *** 42 | > The Inferno Collection Team 43 | *** 44 | Interested in keeping up-to-date with what we are working on? [Check out our roadmap](https://inferno-collection.com/roadmap). 45 | -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/inferno-police-panic.cfg: -------------------------------------------------------------------------------- 1 | # Inferno Collection Police Panic Version 1.22 Beta 2 | # 3 | # Copyright (c) 2019 - 2020, 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/Police-Panic/wiki/Whitelisting 15 | # 16 | 17 | # User 18 | # Commands: 19 | # - /panic 20 | # - /panictune 21 | add_principal identifier.steam:1100001076264E1 Police-Panic.group.user 22 | 23 | # Auto-tune User 24 | # Commands: 25 | # - /panic 26 | # - /panictune 27 | # Other: 28 | # - Auto-tunes user into Panic Channel 29 | add_principal identifier.steam:1100001076264E1 Police-Panic.group.autotuneuser 30 | 31 | # 32 | # Nothing past this point needs to be edited, all the whitelisting needs to be done ABOVE this line. 33 | # Do not make changes below this line unless you know what you are doing! 34 | # 35 | 36 | add_principal Police-Panic.group.autotuneuser Police-Panic.group.user 37 | add_ace Police-Panic.group.user "Police-Panic.panic" allow 38 | add_ace Police-Panic.group.user "Police-Panic.panictune" allow 39 | add_ace Police-Panic.group.autotuneuser "Police-Panic.autotune" allow -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/html/index.html: -------------------------------------------------------------------------------- 1 | 11 | 12 | 13 | 14 | 19 | 20 | 21 | 40 | 41 | -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/server.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Police Panic Version 1.22 Beta 2 | -- 3 | -- Copyright (c) 2019 - 2020, 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 | -- Play tones on all clients 12 | RegisterServerEvent("Police-Panic:NewPanic") 13 | AddEventHandler("Police-Panic:NewPanic", function(Officer) TriggerClientEvent("Pass-Alarm:Return:NewPanic", -1, source, Officer) end) 14 | 15 | -- Whitelist check on server join 16 | RegisterServerEvent("Police-Panic:WhitelistCheck") 17 | AddEventHandler("Police-Panic:WhitelistCheck", function(Whitelist) 18 | for i in pairs(Whitelist.Command) do Whitelist.Command[i] = "pending" end 19 | 20 | -- If using json file as whitelist 21 | if Whitelist.Enabled:lower() == "json" then 22 | -- Collect all the data from the whitelist.json file 23 | local Data = LoadResourceFile(GetCurrentResourceName(), "whitelist.json") 24 | -- If able to collect data 25 | if Data then 26 | -- Place the decoded whitelist into the array 27 | local Entries = json.decode(Data) 28 | 29 | -- Loop through the whitelist array 30 | for _, Entry in ipairs(Entries) do 31 | -- Check if the player exists in the array. 32 | if GetPlayerIdentifier(source):lower() == Entry.steamhex:lower() then 33 | -- Loop though all values in whitelist entry 34 | for i in pairs(Entry) do 35 | -- If the value is not the player's steam hex 36 | if i ~= "steamhex" then 37 | -- If whitelist value is true, aka they have access to a command 38 | if Entry[i] then 39 | -- If command is a valid command 40 | if Whitelist.Command[i] then 41 | -- Allow player to use that command 42 | Whitelist.Command[i] = true 43 | -- If command is not valid 44 | else 45 | -- Print error message to server console 46 | print("===================================================================") 47 | print("==============================WARNING==============================") 48 | print("/" .. i .. " is not a valid command, but is listed in ") 49 | print(Entry.steamhex:lower() .. "'s whitelist entry. Please correct this") 50 | print("issue, and reload the whitelist with /panicwhitelist reload.") 51 | print("Note: Entries are CaSe SeNsItIvE.") 52 | print("===================================================================") 53 | end 54 | end 55 | end 56 | end 57 | -- Break the loop once whitelist entry found 58 | break 59 | end 60 | end 61 | -- If unable to load json file 62 | else 63 | -- Print error message to server console 64 | print("===================================================================") 65 | print("==============================WARNING==============================") 66 | print("Unable to load whitelist file for Inferno-Police-Panic. The white") 67 | print("list has been disabled. This message will appear every time someone") 68 | print("joins the server until the issue is corrected.") 69 | print("===================================================================") 70 | -- Loop through all commands and grant players all permissions 71 | for i in pairs(Whitelist.Command) do Whitelist.Command[i] = true end 72 | -- Override auto-tune permission 73 | Whitelist.Command.autotune = false 74 | -- Override whitelist permission 75 | Whitelist.Command.panicwhitelist = false 76 | end 77 | 78 | -- Loop through all commands 79 | for i in pairs(Whitelist.Command) do 80 | -- If command is still pending deny access 81 | if Whitelist.Command[i] == "pending" then Whitelist.Command[i] = false end 82 | end 83 | -- If using Ace permissions 84 | elseif Whitelist.Enabled:lower() == "ace" then 85 | -- Loop through all commands and grant player permission to command based on Ace group 86 | for i in pairs(Whitelist.Command) do Whitelist.Command[i] = IsPlayerAceAllowed(source, "Police-Panic." .. i) end 87 | -- If using neither json, Ace, or disabled 88 | else 89 | -- Print error message to server console 90 | print("===================================================================") 91 | print("==============================WARNING==============================") 92 | print("'" .. tostring(Whitelist.Enabled) .. "' is not a valid Whitelist option.") 93 | print("The whitelist has been disabled.") 94 | print("===================================================================") 95 | -- Loop through all commands and grant players all permissions 96 | for i in pairs(Whitelist.Command) do Whitelist.Command[i] = true end 97 | -- Override auto-tune permission 98 | Whitelist.Command.autotune = false 99 | -- Override whitelist permission 100 | Whitelist.Command.panicwhitelist = false 101 | end 102 | -- Return whietlist object to client 103 | TriggerClientEvent("Police-Panic:Return:WhitelistCheck", source, Whitelist) 104 | end) 105 | 106 | -- Whitelist reload on all clients 107 | RegisterServerEvent("Police-Panic:WhitelistReload") 108 | AddEventHandler("Police-Panic:WhitelistReload", function() TriggerClientEvent("Police-Panic:WhitelistRecheck", -1) end) 109 | 110 | -- Add entry to whitelist (json only) 111 | RegisterServerEvent("Police-Panic:WhitelistAdd") 112 | AddEventHandler("Police-Panic:WhitelistAdd", function(ID, Entry) 113 | -- Collect all the data from the whitelist.json file 114 | local Data = json.decode(LoadResourceFile(GetCurrentResourceName(), "whitelist.json")) 115 | 116 | -- If 'steam hex' provided was a number get steam hex based off of number 117 | if tonumber(ID) then ID = GetPlayerIdentifier(ID) end 118 | 119 | -- Add the steam hex to the whitelist entry 120 | Entry.steamhex = ID 121 | -- Add the entry to the existing whitelist 122 | table.insert(Data, Entry) 123 | -- Covert the entire object to a json format, then save it over the existing file 124 | SaveResourceFile(GetCurrentResourceName(), "whitelist.json", json.encode(Data), -1) 125 | -- Force all clients to reload their whitelists 126 | TriggerClientEvent("Police-Panic:WhitelistRecheck", -1) 127 | end) 128 | 129 | -- Remove entry from whitelist (json only) 130 | RegisterServerEvent("Police-Panic:WhitelistRemove") 131 | AddEventHandler("Police-Panic:WhitelistRemove", function(ID) 132 | -- Collect all the data from the whitelist.json file 133 | local Data = json.decode(LoadResourceFile(GetCurrentResourceName(), "whitelist.json")) 134 | local Removed = false 135 | 136 | -- If 'steam hex' provided was a number get steam hex based off of number 137 | if tonumber(ID) then ID = GetPlayerIdentifier(ID) end 138 | 139 | -- Loop through the whitelist array 140 | for EntryID, Entry in ipairs(Data) do 141 | -- Check if the player exists in the array. 142 | if ID:lower() == Entry.steamhex:lower() then Removed = EntryID end 143 | end 144 | 145 | -- Remove the entry from the existing whitelist 146 | table.remove(Data, Removed) 147 | -- Covert the entire object to a json format, then save it over the existing file 148 | SaveResourceFile(GetCurrentResourceName(), "whitelist.json", json.encode(Data), -1) 149 | -- Force all clients to reload their whitelists 150 | TriggerClientEvent("Police-Panic:WhitelistRecheck", -1) 151 | TriggerClientEvent("Police-Panic:Return:WhitelistRemove", source, Removed) 152 | end) -------------------------------------------------------------------------------- /[inferno-collection]/inferno-police-panic/client.lua: -------------------------------------------------------------------------------- 1 | -- Inferno Collection Police Panic Version 1.22 Beta 2 | -- 3 | -- Copyright (c) 2019 - 2020, 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 | -- Time in secs between Panic Button activates PER client 17 | -- Set to 0 to impose no cooldown 18 | Config.Cooldown = 15 19 | -- Time in secs blip flashes and map route appears on tuned 20 | -- clients screens before disappearing 21 | Config.BlipTime = 30 22 | -- Whether or not to disable all on-screen messages 23 | Config.DisableAllMessages = false 24 | -- Whether or not to enable chat suggestions 25 | Config.ChatSuggestions = true 26 | -- Whether or not to enable a reminder for whitelisted people to tune into the 27 | -- panic channel after they join the server, if they have not done so already 28 | Config.Reminder = false 29 | -- Whether or not to enable auto-tuning based off of whitelist entries 30 | -- A.K.A, if a client is whitelisted and has 'autotune' set to true, 31 | -- whether or not to allow this client to be auto-tuned 32 | Config.WhitelistAutoTune = true 33 | -- Whether or not to enable auto-tuning based off of what vehicle a client is in 34 | -- DO NOT have 'WhitelistAutoTune' enabled at the same time as this, use one or the other 35 | Config.VehicleAutoTune = false 36 | -- The model name of the vehicles that will auto-tune a player if 37 | -- 'VehicleAutoTune' is enabled 38 | Config.AutoTuneVehicles = { 39 | "police", 40 | "police1", 41 | "police2", 42 | "police3", 43 | "police4" 44 | } 45 | -- Whether or not to enable command whitelist. 46 | -- "ace" to use Ace permissions, "json" to use whitelist.json file, or false to disable. 47 | Config.WhitelistEnabled = false 48 | -- Default message sender with panic activation 49 | Config.Sender = "Dispatch" 50 | -- Default message displayed with panic activation 51 | Config.Message = "Attention all units, Officer in distress!" 52 | 53 | -- 54 | -- Nothing past this point needs to be edited, all the settings for the resource are found ABOVE this line. 55 | -- Do not make changes below this line unless you know what you are doing! 56 | -- 57 | 58 | -- Local Panic Variables 59 | local Panic = {} 60 | -- Time left on cool down 61 | Panic.Cooling = 0 62 | -- Is the client tuned to the panic channel 63 | Panic.Tuned = false 64 | 65 | -- Local whitelist variable 66 | local Whitelist = {} 67 | -- Boolean for whether the whitelist is enabled 68 | Whitelist.Enabled = Config.WhitelistEnabled 69 | -- Whitelist variable for commands 70 | Whitelist.Command = {} 71 | Whitelist.Command.panic = false 72 | Whitelist.Command.autotune = false 73 | Whitelist.Command.panictune = false 74 | Whitelist.Command.panicwhitelist = false 75 | 76 | -- Placed here so if the resource is restarted, whitelisting does not break 77 | AddEventHandler("onClientResourceStart", function (ResourceName) 78 | if(GetCurrentResourceName() == ResourceName) then 79 | if Whitelist.Enabled then 80 | TriggerServerEvent("Police-Panic:WhitelistCheck", Whitelist) 81 | else 82 | for i in pairs(Whitelist.Command) do Whitelist.Command[i] = true end 83 | 84 | Whitelist.Command.autotune = false 85 | Whitelist.Command.panicwhitelist = false 86 | end 87 | end 88 | end) 89 | 90 | -- On client join server 91 | AddEventHandler("onClientMapStart", function() 92 | if Config.ChatSuggestions then 93 | TriggerEvent("chat:addSuggestion", "/panic", "Activate your Panic Button!") 94 | TriggerEvent("chat:addSuggestion", "/panictune", "Tune into the Panic Button channel.") 95 | TriggerEvent("chat:addSuggestion", "/panicwhitelist", "Add to, and/or reload the command whitelist.", { 96 | { 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 player's steam hex, or put the player's server ID from the player list." }, 97 | { name = "commands", help = "List all the commands you want this person to have access to."} 98 | }) 99 | TriggerEvent("chat:addSuggestion", "/panicunwhitelist", "Remove players from the command whitelist.", { 100 | { name = "{player hex/server id}", help = "Type out the player's steam hex, or put the player's server ID from the player list." } 101 | }) 102 | end 103 | end) 104 | 105 | -- Return from whitelist check 106 | RegisterNetEvent("Police-Panic:Return:WhitelistCheck") 107 | AddEventHandler("Police-Panic:Return:WhitelistCheck", function(NewWhitelist) 108 | Whitelist = NewWhitelist 109 | 110 | if Whitelist.Command.autotune and Config.WhitelistAutoTune then 111 | Citizen.Wait(5000) 112 | PanicTune(true) 113 | elseif Config.Reminder and Whitelist.Command.panictune then 114 | Citizen.CreateThread(function() 115 | -- Wait two minutes after they join the server 116 | Citizen.Wait(120000) 117 | if not Panic.Tuned then NewNoti("~y~Don't forget to tune into the Panic Channel with /panictune!", true) end 118 | end) 119 | end 120 | end) 121 | 122 | -- Forces a whitelist reload on the client 123 | RegisterNetEvent("Police-Panic:WhitelistRecheck") 124 | AddEventHandler("Police-Panic:WhitelistRecheck", function() TriggerServerEvent("Police-Panic:WhitelistCheck", Whitelist) end) 125 | 126 | -- Message return when removing clients from the whitelist 127 | RegisterNetEvent("Police-Panic:Return:WhitelistRemove") 128 | AddEventHandler("Police-Panic:Return:WhitelistRemove", function(Removed) 129 | if Removed then 130 | NewNoti("~g~Entry removed from whitelist.", true) 131 | else 132 | NewNoti("~r~No entry with provided ID found. Unable to remove.", true) 133 | end 134 | end) 135 | 136 | -- /panic command 137 | RegisterCommand("panic", function() 138 | if Whitelist.Command.panic then 139 | if Panic.Cooling == 0 then 140 | local Officer = {} 141 | Officer.Ped = PlayerPedId() 142 | Officer.Name = GetPlayerName(PlayerId()) 143 | Officer.Coords = GetEntityCoords(Officer.Ped) 144 | Officer.Location = {} 145 | Officer.Location.Street, Officer.Location.CrossStreet = GetStreetNameAtCoord(Officer.Coords.x, Officer.Coords.y, Officer.Coords.z) 146 | Officer.Location.Street = GetStreetNameFromHashKey(Officer.Location.Street) 147 | if Officer.Location.CrossStreet ~= 0 then 148 | Officer.Location.CrossStreet = GetStreetNameFromHashKey(Officer.Location.CrossStreet) 149 | Officer.Location = Officer.Location.Street .. " X " .. Officer.Location.CrossStreet 150 | else 151 | Officer.Location = Officer.Location.Street 152 | end 153 | 154 | TriggerServerEvent("Police-Panic:NewPanic", Officer) 155 | 156 | Panic.Cooling = Config.Cooldown 157 | else 158 | NewNoti("~r~Panic Button still cooling down.", true) 159 | end 160 | else 161 | NewNoti("~r~You are not whitelisted for this command.", true) 162 | end 163 | end) 164 | 165 | -- Plays panic on client 166 | RegisterNetEvent("Pass-Alarm:Return:NewPanic") 167 | AddEventHandler("Pass-Alarm:Return:NewPanic", function(source, Officer) 168 | if Panic.Tuned then 169 | if Officer.Ped == PlayerPedId() then 170 | SendNUIMessage({ 171 | PayloadType = {"Panic", "LocalPanic"}, 172 | Payload = source 173 | }) 174 | else 175 | SendNUIMessage({ 176 | PayloadType = {"Panic", "ExternalPanic"}, 177 | Payload = source 178 | }) 179 | end 180 | 181 | -- Only people tuned to the panic channel can see the message 182 | TriggerEvent("chat:addMessage", { 183 | color = {255, 0, 0}, 184 | multiline = true, 185 | args = {Config.Sender, Config.Message .. " - " .. Officer.Name .. " (" .. source .. ") - " .. Officer.Location} 186 | }) 187 | 188 | Citizen.CreateThread(function() 189 | local Blip = AddBlipForRadius(Officer.Coords.x, Officer.Coords.y, Officer.Coords.z, 100.0) 190 | 191 | SetBlipRoute(Blip, true) 192 | 193 | Citizen.CreateThread(function() 194 | while Blip do 195 | SetBlipRouteColour(Blip, 1) 196 | Citizen.Wait(150) 197 | SetBlipRouteColour(Blip, 6) 198 | Citizen.Wait(150) 199 | SetBlipRouteColour(Blip, 35) 200 | Citizen.Wait(150) 201 | SetBlipRouteColour(Blip, 6) 202 | end 203 | end) 204 | 205 | SetBlipAlpha(Blip, 60) 206 | SetBlipColour(Blip, 1) 207 | SetBlipFlashes(Blip, true) 208 | SetBlipFlashInterval(Blip, 200) 209 | 210 | Citizen.Wait(Config.BlipTime * 1000) 211 | 212 | RemoveBlip(Blip) 213 | Blip = nil 214 | end) 215 | end 216 | end) 217 | 218 | -- /panictune command 219 | RegisterCommand("panictune", function() 220 | if Whitelist.Command.panictune then 221 | PanicTune() 222 | else 223 | NewNoti("~r~You are not whitelisted for this command.", true) 224 | end 225 | end) 226 | 227 | -- /panicwhitelist command 228 | RegisterCommand("panicwhitelist", function(_, Args) 229 | if Whitelist.Command.panicwhitelist then 230 | if Args[1] and Args[1]:lower() == "reload" then 231 | NewNoti("~g~Whitelist reload complete.", true) 232 | TriggerServerEvent("Police-Panic:WhitelistReload") 233 | elseif Args[1] then 234 | local ID 235 | local Entry = {} 236 | Entry.panic = "pending" 237 | Entry.panictune = "pending" 238 | Entry.panicwhitelist = "pending" 239 | Entry.autotune = "pending" 240 | 241 | if tonumber(Args[1]) then 242 | ID = Args[1] 243 | -- If the first part of the string contains "steam:" 244 | elseif string.sub(Args[1]:lower(), 1, string.len("steam:")) == "steam:" then 245 | -- Set the steam hex to the string 246 | ID = Args[1] 247 | -- In all other cases 248 | else 249 | -- Set the steam hex to the string, adding "steam:" to the front 250 | ID = "steam:" .. Args[1] 251 | end 252 | 253 | -- Loop though all command arguments 254 | for i in pairs(Args) do 255 | -- If the argument is a valid command allow the player access to the command 256 | if Entry[Args[i]:lower()] then Entry[Args[i]] = true end 257 | end 258 | 259 | -- Loop though all commands 260 | for i in pairs(Entry) do 261 | -- If the command is still pending disallow the player access to the command 262 | if Entry[i] == "pending" then Entry[i] = false end 263 | end 264 | 265 | TriggerServerEvent("Police-Panic:WhitelistAdd", ID, Entry) 266 | NewNoti("~g~Whitelist reload complete.", true) 267 | NewNoti("~g~" .. ID .. " Added to whitelist successfully.", true) 268 | else 269 | NewNoti("~r~Error, not enough arguments.", true) 270 | end 271 | else 272 | NewNoti("~r~You are not whitelisted for this command.", true) 273 | end 274 | end) 275 | 276 | -- /panicwhitelist command 277 | RegisterCommand("panicunwhitelist", function(_, Args) 278 | if Whitelist.Command.panicwhitelist then 279 | if Args[1] then 280 | local ID 281 | 282 | -- If is a number or the first part of the string contains "steam:" 283 | if tonumber(Args[1]) or (string.sub(Args[1]:lower(), 1, string.len("steam:")) == "steam:") then 284 | ID = Args[1] 285 | else 286 | -- Set the steam hex to the string, adding "steam:" to the front 287 | ID = "steam:" .. Args[1] 288 | end 289 | 290 | TriggerServerEvent("Police-Panic:WhitelistRemove", ID) 291 | NewNoti("~g~Whitelist reload complete.", true) 292 | else 293 | NewNoti("~r~Error, not enough arguments.", true) 294 | end 295 | else 296 | NewNoti("~r~You are not whitelisted for this command.", true) 297 | end 298 | end) 299 | 300 | -- Tunes a player to the panic channel 301 | function PanicTune(AutoTune) 302 | AutoTune = AutoTune or false 303 | 304 | if Panic.Tuned then 305 | Panic.Tuned = false 306 | 307 | if AutoTune then 308 | NewNoti("~y~Auto-tuning you OUT of the Panic Channel. Use /panictune to retune.", true) 309 | else 310 | NewNoti("~r~No longer tuned to panic channel.", false) 311 | end 312 | else 313 | if AutoTune then 314 | Panic.Tuned = "autotune" 315 | NewNoti("~y~Auto-tuning you INTO the Panic Channel. Use /panictune to detune.", true) 316 | else 317 | Panic.Tuned = "command" 318 | NewNoti("~g~Tuned to Panic Channel.", false) 319 | end 320 | end 321 | end 322 | 323 | -- Draws notification on client's screen 324 | function NewNoti(Text, Flash) 325 | if not Config.DisableAllMessages then 326 | SetNotificationTextEntry("STRING") 327 | AddTextComponentString(Text) 328 | DrawNotification(Flash, true) 329 | end 330 | end 331 | 332 | -- Cooldown loop 333 | Citizen.CreateThread(function() 334 | while true do 335 | Citizen.Wait(0) 336 | 337 | if Panic.Cooling ~= 0 then 338 | Citizen.Wait(1000) 339 | Panic.Cooling = Panic.Cooling - 1 340 | end 341 | end 342 | end) 343 | 344 | -- If vehicle auto-tune is enabled 345 | if Config.VehicleAutoTune then 346 | local Vehicle = false 347 | 348 | Citizen.CreateThread(function() 349 | while true do 350 | Citizen.Wait(0) 351 | 352 | local PlayerVehicle = GetVehiclePedIsIn(PlayerPedId(), false) 353 | 354 | if PlayerVehicle ~= 0 then 355 | if not Vehicle then 356 | for _, Veh in ipairs(Config.AutoTuneVehicles) do 357 | -- If the current player's vehicle is in the list of auto-tune vehicles 358 | if GetEntityModel(PlayerVehicle) == GetHashKey(Veh) then 359 | Vehicle = PlayerVehicle 360 | 361 | if not Panic.Tuned then PanicTune(true) end 362 | break 363 | end 364 | 365 | -- Player is not in an auto-tune vehicle, but this variable still 366 | -- needs to be set to something 367 | Vehicle = "No Vehicle" 368 | end 369 | elseif Vehicle ~= PlayerVehicle and Vehicle ~= "No Vehicle" then 370 | Vehicle = false 371 | end 372 | else 373 | Vehicle = false 374 | 375 | if Panic.Tuned == "autotune" then PanicTune(true) end 376 | end 377 | end 378 | end) 379 | end 380 | --------------------------------------------------------------------------------