├── .gitattributes ├── .gitignore ├── CameraTech.sln ├── CameraTech ├── ANPRInterface.cs ├── ANPRModel.cs ├── CameraTech.cs ├── CameraTech.csproj ├── FixedANPR.cs ├── Properties │ └── AssemblyInfo.cs ├── ShapeTest.cs ├── VehicleANPR.cs ├── VehicleColour.cs └── packages.config ├── LICENSE.txt ├── README.md ├── anprvehicles.default.json ├── fixedanprcameras.default.json ├── fxmanifest.lua ├── sv_CameraTech.lua └── vars.lua /.gitattributes: -------------------------------------------------------------------------------- 1 | /releases 2 | 3 | ############################################################################### 4 | # Set default behavior to automatically normalize line endings. 5 | ############################################################################### 6 | * text=auto 7 | 8 | ############################################################################### 9 | # Set default behavior for command prompt diff. 10 | # 11 | # This is need for earlier builds of msysgit that does not have it on by 12 | # default for csharp files. 13 | # Note: This is only used by command line 14 | ############################################################################### 15 | #*.cs diff=csharp 16 | 17 | ############################################################################### 18 | # Set the merge driver for project and solution files 19 | # 20 | # Merging from the command prompt will add diff markers to the files if there 21 | # are conflicts (Merging from VS is not affected by the settings below, in VS 22 | # the diff markers are never inserted). Diff markers may cause the following 23 | # file extensions to fail to load in VS. An alternative would be to treat 24 | # these files as binary and thus will always conflict and require user 25 | # intervention with every merge. To do so, just uncomment the entries below 26 | ############################################################################### 27 | #*.sln merge=binary 28 | #*.csproj merge=binary 29 | #*.vbproj merge=binary 30 | #*.vcxproj merge=binary 31 | #*.vcproj merge=binary 32 | #*.dbproj merge=binary 33 | #*.fsproj merge=binary 34 | #*.lsproj merge=binary 35 | #*.wixproj merge=binary 36 | #*.modelproj merge=binary 37 | #*.sqlproj merge=binary 38 | #*.wwaproj merge=binary 39 | 40 | ############################################################################### 41 | # behavior for image files 42 | # 43 | # image files are treated as binary by default. 44 | ############################################################################### 45 | #*.jpg binary 46 | #*.png binary 47 | #*.gif binary 48 | 49 | ############################################################################### 50 | # diff behavior for common document formats 51 | # 52 | # Convert binary document formats to text before diffing them. This feature 53 | # is only available from the command line. Turn it on by uncommenting the 54 | # entries below. 55 | ############################################################################### 56 | #*.doc diff=astextplain 57 | #*.DOC diff=astextplain 58 | #*.docx diff=astextplain 59 | #*.DOCX diff=astextplain 60 | #*.dot diff=astextplain 61 | #*.DOT diff=astextplain 62 | #*.pdf diff=astextplain 63 | #*.PDF diff=astextplain 64 | #*.rtf diff=astextplain 65 | #*.RTF diff=astextplain 66 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /CameraTech.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27428.2037 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CameraTech", "CameraTech\CameraTech.csproj", "{F70B6322-6DBD-4830-B920-1342A48A595C}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Release|Any CPU = Release|Any CPU 12 | EndGlobalSection 13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 14 | {F70B6322-6DBD-4830-B920-1342A48A595C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 15 | {F70B6322-6DBD-4830-B920-1342A48A595C}.Debug|Any CPU.Build.0 = Debug|Any CPU 16 | {F70B6322-6DBD-4830-B920-1342A48A595C}.Release|Any CPU.ActiveCfg = Release|Any CPU 17 | {F70B6322-6DBD-4830-B920-1342A48A595C}.Release|Any CPU.Build.0 = Release|Any CPU 18 | EndGlobalSection 19 | GlobalSection(SolutionProperties) = preSolution 20 | HideSolutionNode = FALSE 21 | EndGlobalSection 22 | GlobalSection(ExtensibilityGlobals) = postSolution 23 | SolutionGuid = {11D98072-8F94-49A0-B66A-696C643FFBCD} 24 | EndGlobalSection 25 | EndGlobal 26 | -------------------------------------------------------------------------------- /CameraTech/ANPRInterface.cs: -------------------------------------------------------------------------------- 1 | using CitizenFX.Core; 2 | using CitizenFX.Core.Native; 3 | using CitizenFX.Core.UI; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Drawing; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | using Font = CitizenFX.Core.UI.Font; 11 | using Rectangle = CitizenFX.Core.UI.Rectangle; 12 | 13 | namespace CameraTech 14 | { 15 | internal class ANPRInterface : BaseScript 16 | { 17 | public static string VehicleANPRHeaderString = ""; 18 | public static string FixedANPRHeaderString = ""; 19 | public static string VehicleANPRInfo = "~g~ACTIVATED"; 20 | public static string FixedANPRInfo = "~g~ACTIVATED"; 21 | public static string VehicleANPRMarkers = ""; 22 | public static string FixedANPRMarkers = ""; 23 | private const float scale = 0.345f; 24 | 25 | public static bool MasterInterfaceToggle = false; 26 | public static Vehicle ANPRvehicle; 27 | 28 | public ANPRInterface() 29 | { 30 | EventHandlers["CameraTech:MasterInterfaceToggle"] += new Action((dynamic) => 31 | { 32 | 33 | if (MasterInterfaceToggle) 34 | { 35 | toggleMasterInterface(false); 36 | CameraTech.toggleFixedANPR(false); 37 | VehicleANPR.toggleVehicleANPR(false); 38 | Screen.ShowNotification("ANPR deactivated."); 39 | } 40 | else 41 | { 42 | if (!CameraTech.usingJsonFile && CameraTech.currentANPRModelsJsonString == null) 43 | { 44 | TriggerServerEvent("CameraTech:GetANPRModelsJsonString"); 45 | } 46 | else 47 | { 48 | runAnprCommandEnable(); 49 | } 50 | } 51 | }); 52 | drawingAsync(); 53 | } 54 | 55 | public static void runAnprCommandEnable() 56 | { 57 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 58 | { 59 | bool isVehicleANPRModel = CameraTech.VehicleANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model); 60 | bool isFixedANPRModel = CameraTech.FixedANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model); 61 | if (isVehicleANPRModel || isFixedANPRModel) 62 | { 63 | toggleMasterInterface(true); 64 | VehicleANPR.toggleVehicleANPR(isVehicleANPRModel); 65 | CameraTech.toggleFixedANPR(isFixedANPRModel); 66 | Screen.ShowNotification("ANPR activated."); 67 | } 68 | else 69 | { 70 | Screen.ShowNotification("This vehicle does not have ANPR technology."); 71 | } 72 | } 73 | } 74 | public static void toggleMasterInterface(bool toggle) 75 | { 76 | if (toggle) 77 | { 78 | MasterInterfaceToggle = true; 79 | ANPRvehicle = Game.Player.Character.CurrentVehicle; 80 | } 81 | else 82 | { 83 | MasterInterfaceToggle = false; 84 | ANPRvehicle = null; 85 | } 86 | } 87 | 88 | private async Task drawingAsync() 89 | { 90 | while (true) 91 | { 92 | await Delay(0); 93 | 94 | if (MasterInterfaceToggle && ANPRvehicle != null) 95 | { 96 | Rectangle rect = new Rectangle(new PointF(Screen.Width * 0.001f, Screen.Height * 0.5f), new SizeF(Screen.Width * 0.16f, Screen.Height * 0.140f), Color.FromArgb(150, 0, 0, 0)); 97 | Text vehicleANPRHeader = new Text("Vehicle ANPR - " + VehicleANPRHeaderString, new PointF(Screen.Width * 0.08f, Screen.Height * 0.501f), scale, Color.FromArgb(255, 0, 191, 255), Font.ChaletComprimeCologne, Alignment.Center); 98 | Text vehicleANPRInfoText = new Text(VehicleANPRInfo, new PointF(Screen.Width * 0.08f, Screen.Height * 0.519f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center); 99 | Text vehicleANPRMarkersText = new Text(VehicleANPRMarkers, new PointF(Screen.Width * 0.08f, Screen.Height * 0.537f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center); 100 | if (!VehicleANPR.Active) 101 | { 102 | vehicleANPRInfoText.Caption = "~r~DISABLED"; 103 | vehicleANPRMarkersText.Caption = ""; 104 | } 105 | 106 | string focusedString = "Fixed ANPR"; 107 | if (CameraTech.FocusedPlate != null || CameraTech.ForceFocusedAnpr) 108 | { 109 | focusedString = "Focused ANPR"; 110 | if (CameraTech.FocusedPlate != null) 111 | { 112 | focusedString += " (" + CameraTech.FocusedPlate + ")"; 113 | } else 114 | { 115 | focusedString += " (No Plate)"; 116 | } 117 | } 118 | Text fixedANPRHeader = new Text(focusedString, new PointF(Screen.Width * 0.08f, Screen.Height * 0.555f), scale, Color.FromArgb(255, 0, 191, 255), Font.ChaletComprimeCologne, Alignment.Center); 119 | Text fixedANPRLocationText = new Text(FixedANPRHeaderString, new PointF(Screen.Width * 0.08f, Screen.Height * 0.573f), scale, Color.FromArgb(255, 0, 191, 255), Font.ChaletComprimeCologne, Alignment.Center); 120 | Text fixedANPRInfoText = new Text(FixedANPRInfo, new PointF(Screen.Width * 0.08f, Screen.Height * 0.591f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center); 121 | Text fixedANPRMarkersText = new Text(FixedANPRMarkers, new PointF(Screen.Width * 0.08f, Screen.Height * 0.609f), scale, Color.FromArgb(255, 255, 255, 255), Font.ChaletComprimeCologne, Alignment.Center); 122 | if (!CameraTech.FixedANPRAlertsToggle) 123 | { 124 | fixedANPRInfoText.Caption = "~r~DISABLED"; 125 | fixedANPRMarkersText.Caption = ""; 126 | fixedANPRLocationText.Caption = ""; 127 | } 128 | 129 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 130 | { 131 | rect.Draw(); 132 | vehicleANPRHeader.Draw(); 133 | vehicleANPRInfoText.Draw(); 134 | vehicleANPRMarkersText.Draw(); 135 | fixedANPRHeader.Draw(); 136 | fixedANPRLocationText.Draw(); 137 | fixedANPRInfoText.Draw(); 138 | fixedANPRMarkersText.Draw(); 139 | } 140 | } 141 | } 142 | } 143 | 144 | public static async Task FlashVehicleANPR(int count = 10) 145 | { 146 | for (int i = 0; i < count; i++) 147 | { 148 | VehicleANPRHeaderString = "~r~" + VehicleANPRHeaderString; 149 | await Delay(200); 150 | VehicleANPRHeaderString = VehicleANPRHeaderString.Replace("~r~", ""); 151 | await Delay(200); 152 | } 153 | } 154 | 155 | public static async Task FlashFixedANPR(int count = 10) 156 | { 157 | for (int i = 0; i < count; i++) 158 | { 159 | FixedANPRHeaderString = "~r~" + FixedANPRHeaderString; 160 | await Delay(200); 161 | FixedANPRHeaderString = FixedANPRHeaderString.Replace("~r~", ""); 162 | await Delay(200); 163 | } 164 | } 165 | } 166 | } 167 | -------------------------------------------------------------------------------- /CameraTech/ANPRModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace CameraTech 8 | { 9 | public class ANPRModel 10 | { 11 | public string ModelName = ""; 12 | public string ANPRAccessType = ""; 13 | 14 | public bool CanAccessFixedANPR => ANPRAccessType == "fixed only" || ANPRAccessType == "full"; 15 | public bool CanAccessVehicleANPR => ANPRAccessType == "vehicle only" || ANPRAccessType == "full"; 16 | 17 | public ANPRModel(string modelName, string aNPRAccessType) 18 | { 19 | ModelName = modelName; 20 | ANPRAccessType = aNPRAccessType.ToLower(); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /CameraTech/CameraTech.cs: -------------------------------------------------------------------------------- 1 | using CitizenFX.Core; 2 | using CitizenFX.Core.Native; 3 | using CitizenFX.Core.UI; 4 | using Newtonsoft.Json; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Linq; 8 | using System.Text; 9 | using System.Threading.Tasks; 10 | 11 | namespace CameraTech 12 | { 13 | public class CameraTech : BaseScript 14 | { 15 | public static HashSet VehicleANPRModels = new HashSet(); 16 | public static HashSet FixedANPRModels = new HashSet(); 17 | public static Dictionary PlateInfo = new Dictionary(); 18 | public static FixedANPR[] FixedANPRCameras = new FixedANPR[] { }; 19 | public float FixedANPRRadius = 28f; 20 | public static bool FixedANPRAlertsToggle = false; 21 | public static bool BlipsCreated = false; 22 | public static string FocusedPlate = null; 23 | public static Blip RouteBlip = null; 24 | private static int ANPRHitChance = 95; 25 | private static string lastFixedPlate = null; 26 | public static bool usingJsonFile = false; 27 | public static string currentANPRModelsJsonString = null; 28 | public static bool ForceFocusedAnpr = false; // If true, Fixed ANPR only works if a plate is focused (useful if you want control to circulate ANPR hits initially). 29 | 30 | public CameraTech() 31 | { 32 | Debug.WriteLine("CameraTech by Albo1125."); 33 | 34 | TriggerEvent("chat:addSuggestion", "/anpr", "Toggles the ANPR interface"); 35 | TriggerEvent("chat:addSuggestion", "/vehanpr", "Toggles the vehicle ANPR system"); 36 | TriggerEvent("chat:addSuggestion", "/fixedanpr", "Toggles the fixed ANPR system"); 37 | 38 | TriggerEvent("chat:addSuggestion", "/setplateinfo", "Sets markers for the specified plate", new[] 39 | { 40 | new { name = "param", help = "Type the plate, followed by semicolon (;), followed by the ANPR markers (leave markers blank to remove). Ex: AB12CDE;Stolen" }, 41 | }); 42 | 43 | TriggerEvent("chat:addSuggestion", "/setvehinfo", "Sets markers for the plate of the vehicle you're currently in", new[] 44 | { 45 | new { name = "markers", help = "The markers for this vehicle's plate, leave blank to remove from the system. Ex: Stolen" }, 46 | }); 47 | 48 | EventHandlers["CameraTech:ClUpdateVehicleInfo"] += new Action((string plateinfo) => 49 | { 50 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 51 | { 52 | string plate = API.GetVehicleNumberPlateText(Game.Player.Character.CurrentVehicle.Handle).Replace(" ", string.Empty); 53 | TriggerServerEvent("CameraTech:UpdateVehicleInfo", plate, plateinfo); 54 | if (plateinfo != null) 55 | { 56 | TriggerEvent("chatMessage", "SYSTEM", new int[] { 0, 0, 0 }, "Plate: " + plate + ". Info: " + plateinfo); 57 | } 58 | else 59 | { 60 | TriggerEvent("chatMessage", "SYSTEM", new int[] { 0, 0, 0 }, "Plate: " + plate + ". No info."); 61 | } 62 | } 63 | }); 64 | 65 | EventHandlers["CameraTech:ClFixedANPRAlert"] += new Action((string colour, string modelName, string anprname, string dir, string plate) => 66 | { 67 | if (ANPRInterface.MasterInterfaceToggle && FixedANPRAlertsToggle && Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 68 | { 69 | if (FocusedPlate != null && FocusedPlate == plate) 70 | { 71 | TriggerEvent("chatMessage", "Fixed ANPR", new int[] { 0, 191, 255 }, colour + " " + modelName + ". " + plate + ". " + anprname + " (" + dir + "). ^*Markers: ^r" + PlateInfo[plate]); 72 | PlayANPRAlertSound(false); 73 | if (BlipsCreated) { 74 | FixedANPR fixedanpr = FixedANPRCameras.Where(x => x.Name == anprname).FirstOrDefault(); 75 | if (fixedanpr != null && fixedanpr.blip.Exists()) 76 | { 77 | fixedanpr.blip.ShowRoute = true; 78 | RouteBlip = fixedanpr.blip; 79 | } 80 | } 81 | ANPRInterface.FixedANPRHeaderString = anprname + " (" + dir + ")"; 82 | ANPRInterface.FixedANPRInfo = colour + " " + modelName + ". " + plate + "."; 83 | ANPRInterface.FixedANPRMarkers = "~r~" + PlateInfo[plate]; 84 | lastFixedPlate = plate; 85 | ANPRInterface.FlashFixedANPR(); 86 | } 87 | else if (FocusedPlate == null && !ForceFocusedAnpr) 88 | { 89 | TriggerEvent("chatMessage", "Fixed ANPR", new int[] { 0, 191, 255 }, colour + " " + modelName + ". " + plate + ". " + anprname + " (" + dir + "). ^*Markers: ^r" + PlateInfo[plate]); 90 | PlayANPRAlertSound(false); 91 | ANPRInterface.FixedANPRHeaderString = anprname + " (" + dir + ")"; 92 | ANPRInterface.FixedANPRInfo = colour + " " + modelName + ". " + plate + "."; 93 | ANPRInterface.FixedANPRMarkers = "~r~" + PlateInfo[plate]; 94 | lastFixedPlate = plate; 95 | ANPRInterface.FlashFixedANPR(); 96 | } 97 | 98 | } 99 | }); 100 | 101 | EventHandlers["CameraTech:FixedANPRToggle"] += new Action((dynamic) => 102 | { 103 | if (FixedANPRAlertsToggle) 104 | { 105 | toggleFixedANPR(false); 106 | Screen.ShowNotification("Fixed ANPR alerts deactivated."); 107 | } 108 | else if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 109 | { 110 | if (FixedANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model)) 111 | { 112 | toggleFixedANPR(true); 113 | Screen.ShowNotification("Fixed ANPR alerts activated."); 114 | 115 | if (!ANPRInterface.MasterInterfaceToggle) 116 | { 117 | ANPRInterface.toggleMasterInterface(true); 118 | } 119 | if (!VehicleANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model)) 120 | { 121 | VehicleANPR.toggleVehicleANPR(false); 122 | } 123 | } 124 | else 125 | { 126 | Screen.ShowNotification("This vehicle does not have Fixed ANPR technology."); 127 | } 128 | } 129 | }); 130 | 131 | EventHandlers["CameraTech:SyncPlateInfo"] += new Action((dynamic plateinfo) => 132 | { 133 | PlateInfo.Clear(); 134 | if (plateinfo != null) 135 | { 136 | foreach (KeyValuePair item in plateinfo) 137 | { 138 | PlateInfo[item.Key] = item.Value.ToString(); 139 | } 140 | } 141 | }); 142 | 143 | EventHandlers["CameraTech:FocusANPR"] += new Action((string plate) => 144 | { 145 | if (FixedANPRAlertsToggle && Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 146 | { 147 | if (plate == null) 148 | { 149 | if (FocusedPlate == null) 150 | { 151 | FocusedPlate = lastFixedPlate; 152 | } 153 | else 154 | { 155 | FocusedPlate = null; 156 | } 157 | } 158 | else 159 | { 160 | FocusedPlate = plate; 161 | } 162 | 163 | if (FocusedPlate == null) 164 | { 165 | TriggerEvent("chatMessage", "Fixed ANPR", new int[] { 0, 191, 255 }, "Removed fixed ANPR plate focus."); 166 | if (RouteBlip != null && RouteBlip.Exists()) 167 | { 168 | RouteBlip.ShowRoute = false; 169 | RouteBlip = null; 170 | } 171 | } 172 | else 173 | { 174 | TriggerEvent("chatMessage", "Fixed ANPR", new int[] { 0, 191, 255 }, "Fixed ANPR plate focus: " + FocusedPlate); 175 | } 176 | } 177 | }); 178 | 179 | EventHandlers["CameraTech:ANPRModelsJsonString"] += new Action((string jsonString, bool runAnprCommandEnable) => 180 | { 181 | if (!usingJsonFile) 182 | { 183 | if (currentANPRModelsJsonString != jsonString) 184 | { 185 | populateANPRModels(jsonString); 186 | currentANPRModelsJsonString = jsonString; 187 | if (VehicleANPR.Active && ANPRInterface.ANPRvehicle != null && !VehicleANPRModels.Contains(ANPRInterface.ANPRvehicle.Model)) 188 | { 189 | VehicleANPR.toggleVehicleANPR(false); 190 | } 191 | 192 | if (FixedANPRAlertsToggle && ANPRInterface.ANPRvehicle != null && !FixedANPRModels.Contains(ANPRInterface.ANPRvehicle.Model)) 193 | { 194 | toggleFixedANPR(false); 195 | } 196 | } 197 | } 198 | 199 | if (runAnprCommandEnable) 200 | { 201 | ANPRInterface.runAnprCommandEnable(); 202 | } 203 | }); 204 | 205 | string resourceName = API.GetCurrentResourceName(); 206 | string anprvehs = API.LoadResourceFile(resourceName, "anprvehicles.json"); 207 | 208 | if (!string.IsNullOrWhiteSpace(anprvehs)) 209 | { 210 | usingJsonFile = true; 211 | Debug.WriteLine("Loading ANPR vehicles from anprvehicles.json file"); 212 | populateANPRModels(anprvehs); 213 | } 214 | 215 | string fixedanprjson = API.LoadResourceFile(resourceName, "fixedanprcameras.json"); 216 | if (string.IsNullOrWhiteSpace(fixedanprjson)) 217 | { 218 | Debug.WriteLine("Could not load fixedanprcameras.json"); 219 | } 220 | else 221 | { 222 | FixedANPRCameras = JsonConvert.DeserializeObject(fixedanprjson); 223 | } 224 | 225 | ForceFocusedAnpr = API.GetResourceMetadata(resourceName, "ForceFocusedAnpr", 0) == "true"; 226 | 227 | Main(); 228 | } 229 | 230 | public static void populateANPRModels(string jsonString) 231 | { 232 | ANPRModel[] AllModels = JsonConvert.DeserializeObject(jsonString, new JsonSerializerSettings 233 | { 234 | TypeNameHandling = TypeNameHandling.Auto 235 | }); 236 | 237 | FixedANPRModels.Clear(); 238 | VehicleANPRModels.Clear(); 239 | 240 | foreach (ANPRModel m in AllModels) 241 | { 242 | if (m.CanAccessFixedANPR) 243 | { 244 | FixedANPRModels.Add(new Model(m.ModelName)); 245 | } 246 | 247 | if (m.CanAccessVehicleANPR) 248 | { 249 | VehicleANPRModels.Add(new Model(m.ModelName)); 250 | } 251 | } 252 | } 253 | 254 | public static void toggleFixedANPR(bool toggle) 255 | { 256 | if (!toggle) 257 | { 258 | FixedANPRAlertsToggle = false; 259 | RemoveANPRBlips(); 260 | } else if (toggle) 261 | { 262 | FixedANPRAlertsToggle = true; 263 | CreateFixedANPRBlips(); 264 | } 265 | } 266 | 267 | public static string DegreesToCardinal(double degrees) 268 | { 269 | string[] caridnals = { "N", "NW", "W", "SW", "S", "SE", "E", "NE", "N" }; 270 | return caridnals[(int)Math.Round(((double)degrees % 360) / 45)]; 271 | } 272 | 273 | public async void Main() 274 | { 275 | FixedANPR lastTriggeredANPRCamera = null; 276 | DateTime timeLastTriggeredANPRCamera = DateTime.Now; 277 | string lastTriggeredDir = ""; 278 | 279 | FixedANPR LastBlockedFixedANPR = null; 280 | DateTime timeLastBlockedANPR = DateTime.Now; 281 | while (true) 282 | { 283 | await Delay(5); 284 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 285 | { 286 | Vehicle playerVeh = Game.Player.Character.CurrentVehicle; 287 | 288 | if (!ANPRInterface.MasterInterfaceToggle && ANPRInterface.ANPRvehicle != null && playerVeh == ANPRInterface.ANPRvehicle) 289 | { 290 | ANPRInterface.toggleMasterInterface(true); 291 | Screen.ShowNotification("ANPR Activated"); 292 | } 293 | else if (ANPRInterface.MasterInterfaceToggle && playerVeh != ANPRInterface.ANPRvehicle) 294 | { 295 | ANPRInterface.MasterInterfaceToggle = false; //Set property directly because preserve vehicle. 296 | } 297 | 298 | if (BlipsCreated && (!FixedANPRAlertsToggle || !ANPRInterface.MasterInterfaceToggle)) 299 | { 300 | RemoveANPRBlips(); 301 | } 302 | else if (FixedANPRAlertsToggle && ANPRInterface.MasterInterfaceToggle && !BlipsCreated) 303 | { 304 | CreateFixedANPRBlips(); 305 | } 306 | 307 | 308 | if (RouteBlip != null && RouteBlip.Exists() && Vector3.Distance(playerVeh.Position, RouteBlip.Position) < 140) 309 | { 310 | RouteBlip.ShowRoute = false; 311 | RouteBlip = null; 312 | } 313 | 314 | //Fixed ANPR Detection 315 | if (playerVeh.Driver == Game.Player.Character && playerVeh.Speed > 0.2f) 316 | { 317 | string plate = API.GetVehicleNumberPlateText(playerVeh.Handle).Replace(" ", string.Empty); 318 | 319 | if (PlateInfo.ContainsKey(plate)) 320 | { 321 | FixedANPR anpr = FixedANPRCameras.OrderBy(x => Vector3.Distance(x.Location, playerVeh.Position)).FirstOrDefault(); 322 | 323 | if (anpr != null) 324 | { 325 | float ZDiff = Math.Abs(anpr.Z - playerVeh.Position.Z); 326 | string dir = DegreesToCardinal(playerVeh.Heading); 327 | if (Vector3.Distance(anpr.Location, playerVeh.Position) <= FixedANPRRadius && ZDiff < 3.5f && (lastTriggeredANPRCamera != anpr || (DateTime.Now - timeLastTriggeredANPRCamera).Seconds > 20 || lastTriggeredDir != dir)) 328 | { 329 | if ((anpr != LastBlockedFixedANPR || (DateTime.Now - timeLastTriggeredANPRCamera).Seconds > 120) && API.GetRandomIntInRange(0, 100) < ANPRHitChance) 330 | { 331 | //alert hit 332 | await Delay(1300); 333 | dir = DegreesToCardinal(playerVeh.Heading); 334 | string modelName = API.GetDisplayNameFromVehicleModel((uint)API.GetEntityModel(playerVeh.Handle)); 335 | 336 | string colour = VehicleColour.GetVehicleColour(playerVeh.Handle).PrimarySimpleColourName; 337 | TriggerServerEvent("CameraTech:FixedANPRAlert", colour, modelName, anpr.Name, dir, plate, anpr.X, anpr.Y, anpr.Z); 338 | lastTriggeredANPRCamera = anpr; 339 | timeLastTriggeredANPRCamera = DateTime.Now; 340 | lastTriggeredDir = dir; 341 | LastBlockedFixedANPR = null; 342 | } 343 | else 344 | { 345 | if (LastBlockedFixedANPR != anpr) 346 | { 347 | timeLastBlockedANPR = DateTime.Now; 348 | } 349 | LastBlockedFixedANPR = anpr; 350 | } 351 | } 352 | } 353 | } 354 | } 355 | } 356 | else 357 | { 358 | if (BlipsCreated) 359 | { 360 | RemoveANPRBlips(); 361 | } 362 | 363 | if (ANPRInterface.MasterInterfaceToggle) 364 | { 365 | ANPRInterface.MasterInterfaceToggle = false; //Set property directly because preserve vehicle. 366 | } 367 | } 368 | 369 | } 370 | } 371 | 372 | public static void PlayANPRAlertSound(bool inVehicle) 373 | { 374 | if (inVehicle) 375 | { 376 | PlayInteractSound("VehicleANPR", 0.7f); 377 | } 378 | else 379 | { 380 | PlayInteractSound("FixedANPR", 0.7f); 381 | //API.PlaySound(-1, "TIMER_STOP", "HUD_MINI_GAME_SOUNDSET", false, 0, false); 382 | } 383 | } 384 | 385 | public static void CreateFixedANPRBlips() 386 | { 387 | RemoveANPRBlips(); 388 | foreach (FixedANPR anpr in FixedANPRCameras) 389 | { 390 | Blip blip = World.CreateBlip(anpr.Location); 391 | blip.Sprite = BlipSprite.Camera; 392 | blip.Color = BlipColor.White; 393 | blip.Scale = 0.7f; 394 | blip.IsShortRange = true; 395 | blip.Name = "ANPR"; 396 | 397 | anpr.blip = blip; 398 | } 399 | BlipsCreated = true; 400 | } 401 | 402 | public static void RemoveANPRBlips() 403 | { 404 | foreach (FixedANPR anpr in FixedANPRCameras) 405 | { 406 | if (anpr.blip != null && anpr.blip.Exists()) 407 | { 408 | anpr.blip.ShowRoute = false; 409 | anpr.blip.Delete(); 410 | } 411 | anpr.blip = null; 412 | } 413 | BlipsCreated = false; 414 | } 415 | 416 | public static void PlayInteractSound(string soundname, float volume) 417 | { 418 | TriggerEvent("InteractSound_CL:PlayOnOne", soundname, volume); 419 | } 420 | } 421 | } 422 | -------------------------------------------------------------------------------- /CameraTech/CameraTech.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {F70B6322-6DBD-4830-B920-1342A48A595C} 8 | Library 9 | Properties 10 | CameraTech 11 | CameraTech.net 12 | v4.5.2 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | ..\packages\CitizenFX.Core.Client.1.0.5944\lib\net45\CitizenFX.Core.Client.dll 35 | 36 | 37 | ..\packages\Newtonsoft.Json.12.0.2\lib\portable-net40+sl5+win8+wp8+wpa81\Newtonsoft.Json.dll 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | Designer 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | -------------------------------------------------------------------------------- /CameraTech/FixedANPR.cs: -------------------------------------------------------------------------------- 1 | using CitizenFX.Core; 2 | using Newtonsoft.Json; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CameraTech 10 | { 11 | public class FixedANPR 12 | { 13 | public string Name; 14 | public float X, Y, Z; 15 | 16 | public Vector3 Location => new Vector3(X, Y, Z); 17 | 18 | [JsonIgnore] 19 | public Blip blip; 20 | 21 | public FixedANPR(string name, float x, float y, float z) 22 | { 23 | Name = name; 24 | X = x; 25 | Y = y; 26 | Z = z; 27 | } 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /CameraTech/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("CameraTech")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Albo1125")] 12 | [assembly: AssemblyProduct("CameraTech")] 13 | [assembly: AssemblyCopyright("Copyright © 2024 - Albo1125")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("f70b6322-6dbd-4830-b920-1342a48a595c")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.6.2.0")] 36 | [assembly: AssemblyFileVersion("1.6.2.0")] 37 | -------------------------------------------------------------------------------- /CameraTech/ShapeTest.cs: -------------------------------------------------------------------------------- 1 | using CitizenFX.Core; 2 | using CitizenFX.Core.Native; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Linq; 6 | using System.Text; 7 | using System.Threading.Tasks; 8 | 9 | namespace CameraTech 10 | { 11 | internal class ShapeTest 12 | { 13 | public int raycast { get; private set; } 14 | public int hitEntity { get; private set; } 15 | public bool hit { get; private set; } 16 | public Vector3 endCoords { get; private set; } 17 | public Vector3 surfaceNormal { get; private set; } 18 | public Vector3 from { get; private set; } 19 | public Vector3 to { get; private set; } 20 | 21 | public ShapeTest(int raycast, bool hit, Vector3 endCoords, Vector3 surfaceNormal, int hitEntity, Vector3 from, Vector3 to) 22 | { 23 | this.raycast = raycast; 24 | this.hitEntity = hitEntity; 25 | this.hit = hit; 26 | this.endCoords = endCoords; 27 | this.surfaceNormal = surfaceNormal; 28 | this.from = from; 29 | this.to = to; 30 | } 31 | 32 | public static ShapeTest StartShapeTest(Vector3 From, Vector3 To, float Radius, Entity Ignored, int flag = 10) 33 | { 34 | int raycast = API.StartShapeTestCapsule(From.X, From.Y, From.Z, To.X, To.Y, To.Z, Radius, 10, Ignored.Handle, 7); 35 | int hitEntity = 0; 36 | bool hit = false; 37 | Vector3 endCoords = Vector3.Zero; 38 | Vector3 surfaceNormal = Vector3.Zero; 39 | API.GetShapeTestResult(raycast, ref hit, ref endCoords, ref surfaceNormal, ref hitEntity); 40 | return new ShapeTest(raycast, hit, endCoords, surfaceNormal, hitEntity, From, To); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /CameraTech/VehicleANPR.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using CitizenFX.Core; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using CitizenFX.Core.Native; 8 | using CitizenFX.Core.UI; 9 | using System.Dynamic; 10 | 11 | namespace CameraTech 12 | { 13 | internal class VehicleANPR : BaseScript 14 | { 15 | public static bool Active = false; 16 | private float frontRange = 75; 17 | private float backRange = -75; 18 | private float raycastRadius = 6.2f; 19 | 20 | public static List checkedPlates = new List(); 21 | 22 | public VehicleANPR() 23 | { 24 | EventHandlers["fivemskillsreset"] += new Action((dynamic) => 25 | { 26 | ANPRInterface.toggleMasterInterface(false); 27 | toggleVehicleANPR(false); 28 | CameraTech.toggleFixedANPR(false); 29 | }); 30 | 31 | EventHandlers["CameraTech:ToggleVehicleANPR"] += new Action((dynamic) => 32 | { 33 | if (Active) 34 | { 35 | toggleVehicleANPR(false); 36 | Screen.ShowNotification("Vehicle ANPR deactivated."); 37 | } 38 | else if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 39 | { 40 | if (CameraTech.VehicleANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model)) 41 | { 42 | toggleVehicleANPR(true); 43 | Screen.ShowNotification("Vehicle ANPR activated."); 44 | if (!ANPRInterface.MasterInterfaceToggle) 45 | { 46 | ANPRInterface.toggleMasterInterface(true); 47 | } 48 | if (!CameraTech.FixedANPRModels.Contains(Game.Player.Character.CurrentVehicle.Model)) 49 | { 50 | CameraTech.toggleFixedANPR(false); 51 | } 52 | } 53 | else 54 | { 55 | Screen.ShowNotification("This vehicle does not have Vehicle ANPR technology."); 56 | } 57 | } 58 | }); 59 | 60 | EventHandlers["CameraTech:ReadPlateInFront"] += new Action((dynamic) => 61 | { 62 | ReadPlateFront(); 63 | }); 64 | 65 | EventHandlers["CameraTech:SyncPlateInfo"] += new Action((dynamic plateinfo) => 66 | { 67 | checkedPlates.Clear(); 68 | }); 69 | 70 | RunChecks(); 71 | } 72 | 73 | public static void toggleVehicleANPR(bool toggle) 74 | { 75 | if (!toggle) 76 | { 77 | Active = false; 78 | checkedPlates.Clear(); 79 | } 80 | else 81 | { 82 | Active = true; 83 | checkedPlates.Clear(); 84 | } 85 | } 86 | 87 | public async void RunChecks() 88 | { 89 | 90 | while (true) 91 | { 92 | await Delay(5); 93 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 94 | { 95 | Vehicle playerVeh = Game.Player.Character.CurrentVehicle; 96 | 97 | if (ANPRInterface.MasterInterfaceToggle && Active && playerVeh == ANPRInterface.ANPRvehicle) 98 | { 99 | 100 | Vector3 frontCoord = playerVeh.GetOffsetPosition(new Vector3(0, raycastRadius - 0.5f, 0)); 101 | 102 | Vector3 frontCoordC = playerVeh.GetOffsetPosition(new Vector3(-raycastRadius + 0.1f, frontRange, 0)); 103 | CheckANPRShapeTest("Front ANPR (L)", ShapeTest.StartShapeTest(frontCoord, frontCoordC, raycastRadius, playerVeh), playerVeh, true); 104 | 105 | Vector3 frontCoordD = playerVeh.GetOffsetPosition(new Vector3(raycastRadius - 0.1f, frontRange, 0)); 106 | CheckANPRShapeTest("Front ANPR (R)", ShapeTest.StartShapeTest(frontCoord, frontCoordD, raycastRadius, playerVeh), playerVeh, false); 107 | 108 | Vector3 backCoord = playerVeh.GetOffsetPosition(new Vector3(0, -raycastRadius + 0.5f, 0)); 109 | 110 | Vector3 backCoordA = playerVeh.GetOffsetPosition(new Vector3(-raycastRadius + 0.1f, backRange, 0)); 111 | CheckANPRShapeTest("Rear ANPR (L)", ShapeTest.StartShapeTest(backCoord, backCoordA, raycastRadius, playerVeh), playerVeh, true); 112 | 113 | Vector3 backCoordB = playerVeh.GetOffsetPosition(new Vector3(raycastRadius - 0.1f, backRange, 0)); 114 | CheckANPRShapeTest("Rear ANPR (R)", ShapeTest.StartShapeTest(backCoord, backCoordB, raycastRadius, playerVeh), playerVeh, false); 115 | } 116 | } 117 | } 118 | } 119 | 120 | public void ReadPlateFront() 121 | { 122 | if (Game.Player != null && Game.Player.Character != null && Game.Player.Character.Exists() && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.Exists()) 123 | { 124 | Vehicle playerVeh = Game.Player.Character.CurrentVehicle; 125 | Vector3 frontCoordA = playerVeh.GetOffsetPosition(new Vector3(0, 1, 0)); 126 | Vector3 frontCoordB = playerVeh.GetOffsetPosition(new Vector3(0, 30, 0)); 127 | ShapeTest stest = ShapeTest.StartShapeTest(frontCoordA, frontCoordB, 7, playerVeh); 128 | if (stest.hit && API.IsEntityAVehicle(stest.hitEntity)) 129 | { 130 | TriggerEvent("chatMessage", "Read Plate (Front)", new int[] { 0, 191, 255 }, API.GetVehicleNumberPlateText(stest.hitEntity).Trim() + "."); 131 | } 132 | } 133 | } 134 | 135 | private void CheckANPRShapeTest(string cameraname, ShapeTest stest, Vehicle originVeh, bool left) 136 | { 137 | if (stest.hit && API.IsEntityAVehicle(stest.hitEntity)) 138 | { 139 | Vehicle hitVeh = (Vehicle)Vehicle.FromHandle(stest.hitEntity); 140 | bool positionedRight = Vector3.Distance(originVeh.GetOffsetPosition(Vector3.Left), hitVeh.Position) > Vector3.Distance(originVeh.GetOffsetPosition(Vector3.Right), hitVeh.Position); 141 | if ((left && positionedRight) || (positionedRight && !positionedRight)) 142 | { 143 | return; 144 | } 145 | 146 | string modelName = API.GetDisplayNameFromVehicleModel((uint)API.GetEntityModel(stest.hitEntity)); 147 | string plate = API.GetVehicleNumberPlateText(stest.hitEntity).Replace(" ", string.Empty); 148 | 149 | if (!checkedPlates.Contains(plate)) 150 | { 151 | checkedPlates.Add(plate); 152 | if (CameraTech.PlateInfo != null && CameraTech.PlateInfo.ContainsKey(plate)) 153 | { 154 | float distance = Vector3.Distance(stest.from, hitVeh.Position); 155 | string colour = VehicleColour.GetVehicleColour(stest.hitEntity).PrimarySimpleColourName; 156 | TriggerEvent("chatMessage", cameraname, new int[] { 255, 128, 0 }, colour + " " + modelName + ". " + plate + ". Dist: " + (int)Math.Round(distance) + ". ^*Markers: ^r" + CameraTech.PlateInfo[plate]); 157 | TriggerServerEvent("CameraTech:VehicleANPRAlert", colour, modelName, cameraname, (int)Math.Round(distance), plate, originVeh.Position.X, originVeh.Position.Y, originVeh.Position.Z); 158 | CameraTech.PlayANPRAlertSound(true); 159 | ANPRInterface.VehicleANPRHeaderString = cameraname; 160 | ANPRInterface.VehicleANPRInfo = colour + " " + modelName + ". " + plate + "."; 161 | ANPRInterface.VehicleANPRMarkers = "~r~" + CameraTech.PlateInfo[plate]; 162 | ANPRInterface.FlashVehicleANPR(); 163 | } 164 | else 165 | { 166 | PlayANPRScanSound(); 167 | } 168 | } 169 | } 170 | } 171 | 172 | 173 | private void PlayANPRScanSound() 174 | { 175 | //API.PlaySoundFrontend(-1, "PIN_BUTTON", "ATM_SOUNDS", true); 176 | } 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /CameraTech/VehicleColour.cs: -------------------------------------------------------------------------------- 1 | using CameraTech; 2 | using CitizenFX.Core; 3 | using CitizenFX.Core.Native; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace CameraTech 11 | { 12 | /// 13 | /// Thank you Stealth22 and Alexguirre for their contributions, which I have used as a base for this struct. 14 | /// 15 | public struct VehicleColour 16 | { 17 | public static string[] SimpleColours = new string[] { "Black", "Graphite", "Steel", "Silver", "Red", "Pink", "Orange", "Yellow", "Green", "Blue", "Brown", "Purple", "White", "Gray", "Gold", "Steel", "Aluminium", "Beige" }; 18 | 19 | public static VehicleColour GetVehicleColour(int handle) 20 | { 21 | int primary = -1; 22 | int secondary = -1; 23 | API.GetVehicleColours(handle, ref primary, ref secondary); 24 | VehicleColour vc = new VehicleColour(); 25 | vc.PrimaryColour = (EPaint)primary; 26 | vc.SecondaryColour = (EPaint)secondary; 27 | return vc; 28 | } 29 | 30 | /// 31 | /// Gets the colour name 32 | /// 33 | /// Colour to get the name from 34 | /// 35 | public static string GetColourName(EPaint paint) 36 | { 37 | String name = Enum.GetName(typeof(EPaint), paint); 38 | return name.Replace("_", " "); 39 | } 40 | 41 | /// 42 | /// Gets the simple colour name 43 | /// 44 | /// Colour to get the simple name from 45 | /// 46 | public static string GetSimpleColourName(EPaint paint) 47 | { 48 | String name = Enum.GetName(typeof(EPaint), paint).Replace("_", " "); 49 | foreach (string simplecolour in SimpleColours) 50 | { 51 | if (name.ToLower().Contains(simplecolour.ToLower())) 52 | { 53 | return simplecolour; 54 | } 55 | } 56 | return name; 57 | } 58 | 59 | /// 60 | /// The primary colour paint index 61 | /// 62 | public EPaint PrimaryColour { get; set; } 63 | 64 | /// 65 | /// The secondary colour paint index 66 | /// 67 | public EPaint SecondaryColour { get; set; } 68 | 69 | /// 70 | /// Gets the primary colour name 71 | /// 72 | public string PrimaryColourName 73 | { 74 | get { return GetColourName(PrimaryColour); } 75 | } 76 | /// 77 | /// Gets the secondary colour name 78 | /// 79 | public string SecondaryColourName 80 | { 81 | get { return GetColourName(SecondaryColour); } 82 | } 83 | 84 | /// 85 | /// Gets the primary simple colour name 86 | /// 87 | public string PrimarySimpleColourName 88 | { 89 | get { return GetSimpleColourName(PrimaryColour); } 90 | } 91 | /// 92 | /// Gets the secondary simple colour name 93 | /// 94 | public string SecondarySimpleColourName 95 | { 96 | get { return GetSimpleColourName(SecondaryColour); } 97 | } 98 | } 99 | 100 | public enum EPaint 101 | { 102 | Unknown = -1, 103 | /* CLASSIC|METALLIC */ 104 | Black = 0, 105 | Carbon_Black = 147, 106 | Graphite = 1, 107 | Anhracite_Black = 11, 108 | Black_Steel = 2, 109 | Dark_Steel = 3, 110 | Silver = 4, 111 | Bluish_Silver = 5, 112 | Rolled_Steel = 6, 113 | Shadow_Silver = 7, 114 | Stone_Silver = 8, 115 | Midnight_Silver = 9, 116 | Cast_Iron_Silver = 10, 117 | Red = 27, 118 | Torino_Red = 28, 119 | Formula_Red = 29, 120 | Lava_Red = 150, 121 | Blaze_Red = 30, 122 | Grace_Red = 31, 123 | Garnet_Red = 32, 124 | Sunset_Red = 33, 125 | Cabernet_Red = 34, 126 | Wine_Red = 143, 127 | Candy_Red = 35, 128 | Hot_Pink = 135, 129 | Pfister_Pink = 137, 130 | Salmon_Pink = 136, 131 | Sunrise_Orange = 36, 132 | Orange = 38, 133 | Bright_Orange = 138, 134 | Gold = 37, 135 | Bronze = 90, 136 | Yellow = 88, 137 | Race_Yellow = 89, 138 | Dew_Yellow = 91, 139 | Green = 139, 140 | Dark_Green = 49, 141 | Racing_Green = 50, 142 | Sea_Green = 51, 143 | Olive_Green = 52, 144 | Bright_Green = 53, 145 | Gasoline_Green = 54, 146 | Lime_Green = 92, 147 | Hunter_Green = 144, 148 | Securiror_Green = 125, 149 | Midnight_Blue = 141, 150 | Galaxy_Blue = 61, 151 | Dark_Blue = 62, 152 | Saxon_Blue = 63, 153 | Blue = 64, 154 | Bright_Blue = 140, 155 | Mariner_Blue = 65, 156 | Harbor_Blue = 66, 157 | Diamond_Blue = 67, 158 | Surf_Blue = 68, 159 | Nautical_Blue = 69, 160 | Racing_Blue = 73, 161 | Ultra_Blue = 70, 162 | Light_Blue = 74, 163 | Police_Car_Blue = 127, 164 | Epsilon_Blue = 157, 165 | Chocolate_Brown = 96, 166 | Bison_Brown = 101, 167 | Creek_Brown = 95, 168 | Feltzer_Brown = 94, 169 | Maple_Brown = 97, 170 | Beechwood_Brown = 103, 171 | Sienna_Brown = 104, 172 | Saddle_Brown = 98, 173 | Moss_Brown = 100, 174 | Woodbeech_Brown = 102, 175 | Straw_Brown = 99, 176 | Sandy_Brown = 105, 177 | Bleached_Brown = 106, 178 | Schafter_Purple = 71, 179 | Spinnaker_Purple = 72, 180 | Midnight_Purple = 142, 181 | Metallic_Midnight_Purple = 146, 182 | Bright_Purple = 145, 183 | Cream = 107, 184 | Ice_White = 111, 185 | Frost_White = 112, 186 | Pure_White = 134, 187 | Default_Alloy = 156, 188 | Champagne = 93, 189 | 190 | /* MATTE */ 191 | Matte_Black = 12, 192 | Matte_Gray = 13, 193 | Matte_Light_Gray = 14, 194 | Matte_Ice_White = 131, 195 | Matte_Blue = 83, 196 | Matte_Dark_Blue = 82, 197 | Matte_Midnight_Blue = 84, 198 | Matte_Midnight_Purple = 149, 199 | Matte_Schafter_Purple = 148, 200 | Matte_Red = 39, 201 | Matte_Dark_Red = 40, 202 | Matte_Orange = 41, 203 | Matte_Yellow = 42, 204 | Matte_Lime_Green = 55, 205 | Matte_Green = 128, 206 | Matte_Forest_Green = 151, 207 | Matte_Foliage_Green = 155, 208 | Matte_Brown = 129, 209 | Matte_Olive_Darb = 152, 210 | Matte_Dark_Earth = 153, 211 | Matte_Desert_Tan = 154, 212 | 213 | /* Util */ 214 | Util_Black = 15, 215 | Util_Black_Poly = 16, 216 | Util_Dark_Silver = 17, 217 | Util_Silver = 18, 218 | Util_Gun_Metal = 19, 219 | Util_Shadow_Silver = 20, 220 | Util_Red = 43, 221 | Util_Bright_Red = 44, 222 | Util_Garnet_Red = 45, 223 | Util_Dark_Green = 56, 224 | Util_Green = 57, 225 | Util_Dark_Blue = 75, 226 | Util_Midnight_Blue = 76, 227 | Util_Blue = 77, 228 | Util_Sea_Foam_Blue = 78, 229 | Util_Lightning_Blue = 79, 230 | Util_Maui_Blue_Poly = 80, 231 | Util_Bright_Blue = 81, 232 | Util_Brown = 108, 233 | Util_Medium_Brown = 109, 234 | Util_Light_Brown = 110, 235 | Util_Off_White = 122, 236 | 237 | /* Worn */ 238 | Worn_Black = 21, 239 | Worn_Graphite = 22, 240 | Worn_Silver_Gray = 23, 241 | Worn_Silver = 24, 242 | Worn_Blue_Silver = 25, 243 | Worn_Shadow_Silver = 26, 244 | Worn_Red = 46, 245 | Worn_Golden_Red = 47, 246 | Worn_Dark_Red = 48, 247 | Worn_Dark_Green = 58, 248 | Worn_Green = 59, 249 | Worn_Sea_Wash = 60, 250 | Worn_Dark_Blue = 85, 251 | Worn_Blue = 86, 252 | Worn_Light_Blue = 87, 253 | Worn_Honey_Beige = 113, 254 | Worn_Brown = 114, 255 | Worn_Dark_Brown = 115, 256 | Worn_Straw_Beige = 116, 257 | Worn_Off_White = 121, 258 | Worn_Yellow = 123, 259 | Worn_Light_Orange = 124, 260 | Worn_Taxi_Yellow = 126, 261 | Worn_Orange = 130, 262 | Worn_White = 132, 263 | Worn_Olive_Army_Green = 133, 264 | 265 | /* METALS */ 266 | Brushed_Steel = 117, 267 | Brushed_Black_Steel = 118, 268 | Brushed_Aluminum = 119, 269 | Pure_Gold = 158, 270 | Brushed_Gold = 159, 271 | Secret_Gold = 160, 272 | 273 | /* CHROME */ 274 | Chrome = 120, 275 | } 276 | } 277 | -------------------------------------------------------------------------------- /CameraTech/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # CameraTech 2 | CameraTech is a resource for FiveM by Albo1125 that provides for an indepth Automatic Number Plate Recognition (ANPR/ALPR) system simulation. 3 | 4 | [![CameraTechVideo](https://i.imgur.com/KXHgPBk.jpg)](https://youtu.be/LLJ7NG_gUE4) 5 | 6 | ## Installation & Usage 7 | 1. Download the latest [Release](https://github.com/Albo1125/CameraTech/releases). 8 | 2. Unzip the CameraTech folder into your resources folder on your FiveM server. 9 | 3. Create a file called `fixedanprcameras.json` in the CameraTech folder. You can usually simply rename the `fixedanprcameras.default.json` to do so. Optionally, add or remove fixed ANPR cameras on the map, following the format of the provided default file. 10 | 4. Add the following to your server.cfg file: 11 | ```text 12 | start CameraTech 13 | ``` 14 | 5. Install the [InteractSound](https://github.com/plunkettscott/interact-sound) resource. Add sound files of your choice to InteractSound called `FixedANPR.ogg` and `VehicleANPR.ogg`. Examples have been included in this release. 15 | 6. Optionally, create a new file called `anprvehicles.json` in the CameraTech folder. See `Customising your ANPR vehicles` below for further guidance. 16 | 7. Optionally, enable the ANPR whitelist in `vars.lua` and add identifiers. This only affects commands for use of police. 17 | 8. Optionally, in `sv_CameraTech.lua`, uncomment lines 5 to 7 and 16 to 18 and in `fxmanifest.lua` uncomment line 14. This will make the script insert a new row into a MySQL database whenever a fixed ANPR hit comes in (e.g. for web-based control purposes). 18 | 9. Optionally, in `fxmanifest.lua`, change the `ForceFocusedAnpr` setting to `true`. This means users will not be able to receive fixed ANPR alerts unless they have a plate focused. This is useful if you want your control room to initially circulate ANPR hits to units before the units see the hits themselves. 19 | 20 | ## Customising your vehicles 21 | You have two options for customising your ANPR vehicles. 22 | 23 | * Firstly, you can add a `anprvehicles.json` file to the CameraTech folder. If this file is present, it will always be used. See `anprvehicles.default.json` for an example. 24 | * Secondly, you can load your `anprvehicles.json` contents dynamically. If no `anprvehicles.json` file is present in the resource folder, the client will trigger a server event `CameraTech:GetANPRModelsJsonString()` when they use the /anpr command for the first time. The client will listen for a `CameraTech:ANPRModelsJsonString(jsonString, runAnprCommandEnable)` event from the server. `jsonString` should be a valid JSON string in the `anprvehicles.json` format, `runAnprCommandEnable` should be true if the event was triggered by a specific player using the ANPR command, false otherwise. The `CameraTech:ANPRModelsJsonString(jsonString, runAnprCommandEnable)` event can also be triggered periodically by the server to update the ANPR vehicle models for all players (-1), make sure `runAnprCommandEnable` is set to false in that case. 25 | 26 | You can add as many entries to the root array as you like. If a vehicle model appears in the file multiple times, all ANPR Access Types will be added on top of the others. JSON reference is as follows. 27 | ### ANPRVehicle JSON Object Entry 28 | * "ModelName" string indicating the ingame Model Name of the vehicle. 29 | * "ANPRAccessType" which should be one of: "full", "fixed only", "vehicle only". 30 | 31 | ## Commands 32 | * /anpr - Toggles the ANPR interface if you are in a vehicle that has access to ANPR (Whitelisted). 33 | * /fixedanpr - Toggles ANPR alerts from fixed ANPR cameras on the map (Whitelisted). 34 | * /vehicleanpr (alias /vehanpr) - Toggles ANPR alerts from vehicle ANPR cameras (Whitelisted). 35 | * /readplate (alias /rp) - Reads the plate of the vehicle in front of you and puts it in chat. 36 | * /checkplate PLATE - Returns the ANPR markers currently active for the specified plate. 37 | * /focusanpr PLATE - Only displays fixed ANPR alerts for the specified PLATE and automatically draws a route if any hit comes in. Leave PLATE blank to unfocus or to focus the plate that last triggered a fixed ANPR alert. 38 | * /setplateinfo PLATE;INFO - Adds ANPR markers (INFO) for the specified plate. Leave INFO blank to remove markers. Example: /setplateinfo AB12CDE;STOLEN 39 | * /setvehinfo INFO - Adds ANPR markers (INFO) for the plate of the vehicle you're currently in. Leave INFO blank to remove markers. Example: /setvehinfo STOLEN 40 | 41 | ## Improvements & Licencing 42 | Please view the license. Improvements and new feature additions are very welcome, please feel free to create a pull request. As a guideline, please do not release separate versions with minor modifications, but contribute to this repository directly. However, if you really do wish to release modified versions of my work, permission & proper credit is always required and you should always link back to this original source and respect the licence. 43 | 44 | ## Libraries used (many thanks to their authors) 45 | * [CitizenFX.Core.Client](https://github.com/citizenfx/fivem) 46 | * [Newtonsoft.Json](https://www.newtonsoft.com/json) 47 | 48 | ## Video 49 | [Click here (please note setup instructions have changed slightly)](https://youtu.be/LLJ7NG_gUE4) 50 | 51 | ## Screenshots 52 | ![CameraTech](https://i.imgur.com/KlhjVos.jpg) 53 | -------------------------------------------------------------------------------- /anprvehicles.default.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "ModelName":"POLICE", 4 | "ANPRAccessType":"fixed only" 5 | }, 6 | { 7 | "ModelName":"POLICE2", 8 | "ANPRAccessType":"vehicle only" 9 | }, 10 | { 11 | "ModelName":"POLICE3", 12 | "ANPRAccessType":"full" 13 | }, 14 | ] -------------------------------------------------------------------------------- /fixedanprcameras.default.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Name":"Strawberry Ave/Vespucci Blvd", 4 | "X":223.00, 5 | "Y":-1042.60, 6 | "Z":29.12 7 | }, 8 | { 9 | "Name":"Innocence Blvd/Elgin Ave", 10 | "X":104.11, 11 | "Y":-1363.77, 12 | "Z":29.10 13 | }, 14 | { 15 | "Name":"Strawberry Ave/Davis Ave", 16 | "X":-127.66, 17 | "Y":-1738.60, 18 | "Z":29.89 19 | }, 20 | { 21 | "Name":"New Empire Way", 22 | "X":-763.85, 23 | "Y":-2182.47, 24 | "Z":15.26 25 | }, 26 | { 27 | "Name":"Palomino Ave/South Rockford Drive", 28 | "X":-770.00, 29 | "Y":-1116.10, 30 | "Z":10.46 31 | }, 32 | { 33 | "Name":"Boulevard Del Perro/Dorset Drive", 34 | "X":-1038.81, 35 | "Y":-192.10, 36 | "Z":37.62 37 | }, 38 | { 39 | "Name":"Elgin Ave/Hawick Ave", 40 | "X":470.93, 41 | "Y":-311.69, 42 | "Z":46.85 43 | }, 44 | { 45 | "Name":"Elysian Fields FWY Bridge", 46 | "X":814.19, 47 | "Y":-2623.73, 48 | "Z":52.42 49 | }, 50 | { 51 | "Name":"La Puerta FWY Bridge", 52 | "X":-498.72, 53 | "Y":-2265.92, 54 | "Z":61.43 55 | }, 56 | { 57 | "Name":"Palomino FWY 1", 58 | "X":1573.21, 59 | "Y":-983.65, 60 | "Z":59.78 61 | }, 62 | { 63 | "Name":"Los Santos FWY 1", 64 | "X":1307.31, 65 | "Y":599.01, 66 | "Z":80.05 67 | }, 68 | { 69 | "Name":"Palomino FWY 2", 70 | "X":2118.76, 71 | "Y":1362.79, 72 | "Z":75.37 73 | }, 74 | { 75 | "Name":"Senora FWY 1", 76 | "X":2113.76, 77 | "Y":2670.40, 78 | "Z":50.46 79 | }, 80 | { 81 | "Name":"Tongva Drive", 82 | "X":-1602.98, 83 | "Y":1347.34, 84 | "Z":132.23 85 | }, 86 | { 87 | "Name":"West Eclipse Blvd/Great Ocean HWY", 88 | "X":-2171.84, 89 | "Y":-345.79, 90 | "Z":13.18 91 | }, 92 | { 93 | "Name":"Great Ocean HWY/Route 68", 94 | "X":-2720.00, 95 | "Y":2284.16, 96 | "Z":19.15 97 | }, 98 | { 99 | "Name":"Route 68/Senora Road", 100 | "X":285.95, 101 | "Y":2636.20, 102 | "Z":44.67 103 | }, 104 | { 105 | "Name":"Panorama Drive/Joshua Road", 106 | "X":1697.04, 107 | "Y":3509.38, 108 | "Z":36.47 109 | }, 110 | { 111 | "Name":"Great Ocean HWY/Paleto Blvd", 112 | "X":-396.31, 113 | "Y":5976.88, 114 | "Z":31.66 115 | }, 116 | { 117 | "Name":"East Joshua Road/Senora FWY", 118 | "X":2793.14, 119 | "Y":4408.23, 120 | "Z":49.03 121 | }, 122 | { 123 | "Name":"San Andreas Ave (Above Del Perro Fwy)", 124 | "X":1029.14, 125 | "Y":-837.73, 126 | "Z":48.43 127 | }, 128 | { 129 | "Name":"Capital Blvd/Popular St", 130 | "X":797.48, 131 | "Y":-1435.33, 132 | "Z":27.03 133 | }, 134 | { 135 | "Name":"Del Perro Fwy Tunnel", 136 | "X":-1214.03, 137 | "Y":-697.71, 138 | "Z":10.90 139 | }, 140 | { 141 | "Name":"Greenwich Pkwy/Exceptionalists Way", 142 | "X":-718.42, 143 | "Y":-2390.95, 144 | "Z":14.58 145 | }, 146 | { 147 | "Name":"Olympic Fwy 1", 148 | "X":-718.42, 149 | "Y":-2390.95, 150 | "Z":14.58 151 | }, 152 | { 153 | "Name":"Elysian Fields Fwy 1", 154 | "X":1064.87, 155 | "Y":-1540.35, 156 | "Z":28.19 157 | }, 158 | { 159 | "Name":"Las Lagunas Blvd (Above Del Perro Fwy)", 160 | "X":-209.46, 161 | "Y":-517.60, 162 | "Z":34.58 163 | }, 164 | { 165 | "Name":"Dutch London St/Autopia Pkwy", 166 | "X":-157.09, 167 | "Y":-2094.66, 168 | "Z":25.33 169 | }, 170 | { 171 | "Name":"Sustancia Rd/El Rancho Blvd", 172 | "X":1336.22, 173 | "Y":-1612.47, 174 | "Z":52.31 175 | }, 176 | { 177 | "Name":"Mirror Park Blvd/Vinewood Park Dr", 178 | "X":796.44, 179 | "Y":-48.97, 180 | "Z":80.45 181 | }, 182 | { 183 | "Name":"Baytree Canyon Rd/Marlowe Dr", 184 | "X":317.39, 185 | "Y":1003.02, 186 | "Z":210.36 187 | }, 188 | { 189 | "Name":"Vinewood Blvd/Alta St", 190 | "X":201.13, 191 | "Y":192.52, 192 | "Z":105.40 193 | }, 194 | { 195 | "Name":"Bay City Ave/San Andreas Ave", 196 | "X":-1284.58, 197 | "Y":-915.40, 198 | "Z":11.22 199 | }, 200 | { 201 | "Name":"Great Ocean Hway/Banham Canyon Dr", 202 | "X":-3103.37, 203 | "Y":1184.33, 204 | "Z":20.16 205 | }, 206 | { 207 | "Name":"Buccaneer Way (Port)", 208 | "X":727.53, 209 | "Y":-2784.06, 210 | "Z":6.25 211 | }, 212 | { 213 | "Name":"Innocence Blvd/Alta St", 214 | "X":-274.85, 215 | "Y":-1431.61, 216 | "Z":31.18 217 | }, 218 | { 219 | "Name":"Dutch London St/Signal St", 220 | "X":375.65, 221 | "Y":-2175.23, 222 | "Z":14.58 223 | }, 224 | { 225 | "Name":"Upper Power St/San Andreas Ave", 226 | "X":31.27, 227 | "Y":-769.02, 228 | "Z":44.06 229 | }, 230 | { 231 | "Name":"Lower Power St/San Andreas Ave", 232 | "X":34.44, 233 | "Y":-771.14, 234 | "Z":31.43 235 | }, 236 | { 237 | "Name":"San Vitus Blvd/Hawick Ave", 238 | "X":-256.15, 239 | "Y":-49.45, 240 | "Z":49.36 241 | }, 242 | { 243 | "Name":"Great Ocean Hway 1", 244 | "X":1571.56, 245 | "Y":6425.96, 246 | "Z":24.54 247 | }, 248 | { 249 | "Name":"Grapeseed Main St", 250 | "X":1680.99, 251 | "Y":4949.79, 252 | "Z":42.28 253 | }, 254 | { 255 | "Name":"Route 68/Cat Claw Ave", 256 | "X":2282.88, 257 | "Y":3000.73, 258 | "Z":46.01 259 | }, 260 | { 261 | "Name":"La Puerta Fwy 1", 262 | "X":-402.67, 263 | "Y":-784.82, 264 | "Z":36.81 265 | }, 266 | { 267 | "Name":"Dutch London St/La Puerta", 268 | "X":-756.00, 269 | "Y":-1732.56, 270 | "Z":29.15 271 | }, 272 | { 273 | "Name":"West Eclipse Blvd/Portola Dr", 274 | "X":-855.88, 275 | "Y":220.11, 276 | "Z":73.62 277 | }, 278 | { 279 | "Name":"Sustancia Rd/El Burro Blvd", 280 | "X":1969.35, 281 | "Y":-918.35, 282 | "Z":78.98 283 | }, 284 | { 285 | "Name":"Palamino Fwy 3", 286 | "X":2437.49, 287 | "Y":-183.21, 288 | "Z":87.49 289 | }, 290 | { 291 | "Name":"Strawberry Ave/Integrity Way", 292 | "X":359.20, 293 | "Y":-665.35, 294 | "Z":29.16 295 | }, 296 | { 297 | "Name":"Meteor St/Fenwell Pl", 298 | "X":572.88, 299 | "Y":241.83, 300 | "Z":102.98 301 | }, 302 | { 303 | "Name":"Popular St/Vespucci Blvd", 304 | "X":784.10, 305 | "Y":-1009.11, 306 | "Z":25.97 307 | }, 308 | { 309 | "Name":"Olympic Fwy (Above Power St)", 310 | "X":-149.04, 311 | "Y":-1183.77, 312 | "Z":37.13 313 | }, 314 | { 315 | "Name":"Olympic Fwy (Above Strawberry Ave)", 316 | "X":230.74, 317 | "Y":-1236.45, 318 | "Z":38.02 319 | }, 320 | { 321 | "Name":"North Rockford Dr/Picture Perfect Dr", 322 | "X":-1772.26, 323 | "Y":71.22, 324 | "Z":68.62 325 | }, 326 | { 327 | "Name":"Milton Rd/Picture Perfect Dr", 328 | "X":-562.60, 329 | "Y":514.78, 330 | "Z":105.49 331 | }, 332 | { 333 | "Name":"Dorset Dr/Carcer Way", 334 | "X":-631.87, 335 | "Y":-358.71, 336 | "Z":34.64 337 | }, 338 | { 339 | "Name":"Roy Lowenstein Blvd/Innocence Blvd", 340 | "X":458.93, 341 | "Y":-1634.29, 342 | "Z":29.10 343 | }, 344 | { 345 | "Name":"Los Santos Freeway 2", 346 | "X":902.12, 347 | "Y":178.07, 348 | "Z":75.03 349 | }, 350 | { 351 | "Name":"West Mirror Dr/Mirror Park Blvd", 352 | "X":1199.44, 353 | "Y":-363.63, 354 | "Z":68.67 355 | }, 356 | { 357 | "Name":"Del Perro Fwy (Under Movie Star Way)", 358 | "X":-921.26, 359 | "Y":-542.54, 360 | "Z":19.01 361 | }, 362 | { 363 | "Name":"Del Perro Fwy 2", 364 | "X":864.89, 365 | "Y":-699.25, 366 | "Z":42.49 367 | }, 368 | { 369 | "Name":"Adam's Apple Blvd/Calais Ave", 370 | "X":-530.31, 371 | "Y":-1083.70, 372 | "Z":22.25 373 | }, 374 | { 375 | "Name":"Adam's Apple Blvd/Calais Ave", 376 | "X":-530.31, 377 | "Y":-1083.70, 378 | "Z":22.25 379 | }, 380 | { 381 | "Name":"Adam's Apple Blvd/Little Bighorn Ave", 382 | "X":500.11, 383 | "Y":-1131.62, 384 | "Z":29.28 385 | }, 386 | { 387 | "Name":"Alta St (Over Del Perro Fwy)", 388 | "X":-44.79, 389 | "Y":-491.11, 390 | "Z":40.29 391 | }, 392 | { 393 | "Name":"Popular St/El Rancho Blvd", 394 | "X":772.30, 395 | "Y":-2065.26, 396 | "Z":29.20 397 | }, 398 | { 399 | "Name":"Banham Canyon Dr/North Rockford Dr", 400 | "X":-1754.08, 401 | "Y":806.96, 402 | "Z":140.91 403 | }, 404 | { 405 | "Name":"Popular St/Chum St/Hanger Way", 406 | "X":733.22, 407 | "Y":-2464.10, 408 | "Z":19.96 409 | }, 410 | { 411 | "Name":"New Empire Way (Airport Entrance)", 412 | "X":-1028.99, 413 | "Y":-2712.77, 414 | "Z":13.64 415 | }, 416 | { 417 | "Name":"Ace Jones Dr/Mad Wayne Thunder Dr", 418 | "X":-1434.69, 419 | "Y":527.71, 420 | "Z":118.80 421 | }, 422 | { 423 | "Name":"Swiss St/Elgin Ave", 424 | "X":242.80, 425 | "Y":-623.49, 426 | "Z":41.02 427 | }, 428 | { 429 | "Name":"Roy Lowenstein Blvd/Carson Ave", 430 | "X":275.30, 431 | "Y":-1860.52, 432 | "Z":26.68 433 | }, 434 | { 435 | "Name":"San Andreas Ave/Palomino Ave", 436 | "X":-637.60, 437 | "Y":-659.22, 438 | "Z":31.55 439 | }, 440 | { 441 | "Name":"Vespucci Blvd/Peaceful St", 442 | "X":-285.47, 443 | "Y":-855.09, 444 | "Z":31.58 445 | }, 446 | { 447 | "Name":"West Eclipse Blvd/Americano Way", 448 | "X":-1434.06, 449 | "Y":60.60, 450 | "Z":52.22 451 | }, 452 | { 453 | "Name":"Boulevard Del Perro/North Rockford Dr", 454 | "X":-1378.71, 455 | "Y":-394.49, 456 | "Z":36.69 457 | }, 458 | { 459 | "Name":"Popular Street (Above Los Santos Fwy)", 460 | "X":601.80, 461 | "Y":-375.87, 462 | "Z":43.38 463 | }, 464 | { 465 | "Name":"La Puerta Fwy (Lower)", 466 | "X":-404.82, 467 | "Y":-1289.68, 468 | "Z":21.19 469 | }, 470 | { 471 | "Name":"Vinewood Park Dr/Senora Rd", 472 | "X":1028.51, 473 | "Y":488.50, 474 | "Z":96.07 475 | }, 476 | { 477 | "Name":"West Eclipse Blvd/Bay City Ave", 478 | "X":-1711.22, 479 | "Y":-370.50, 480 | "Z":47.30 481 | }, 482 | { 483 | "Name":"Magellan Ave/Palomino Ave", 484 | "X":-1227.51, 485 | "Y":-1373.29, 486 | "Z":3.89 487 | }, 488 | { 489 | "Name":"Tavatiam Mountains Dam", 490 | "X":1675.01, 491 | "Y":-70.02, 492 | "Z":173.52 493 | }, 494 | { 495 | "Name":"Senora Way (Petrol Station)", 496 | "X":2560.64, 497 | "Y":2626.03, 498 | "Z":37.46 499 | }, 500 | { 501 | "Name":"Route 68/Zancudo Grande Valley", 502 | "X":-366.26, 503 | "Y":2877.52, 504 | "Z":42.42 505 | }, 506 | { 507 | "Name":"Route 68/Fort Zancudo Approach Rd", 508 | "X":-1288.06, 509 | "Y":2522.84, 510 | "Z":19.76 511 | }, 512 | { 513 | "Name":"Davis Ave/Alta St", 514 | "X":-386.18, 515 | "Y":-1829.63, 516 | "Z":21.39 517 | }, 518 | { 519 | "Name":"Vespucci Blvd/South Rockford Dr", 520 | "X":-949.90, 521 | "Y":-841.81, 522 | "Z":15.38 523 | }, 524 | { 525 | "Name":"Bay City Ave/Red Desert Ave", 526 | "X":-1440.65, 527 | "Y":-754.32, 528 | "Z":15.38 529 | }, 530 | { 531 | "Name":"Bay City Incline", 532 | "X":-1880.38, 533 | "Y":-471.43, 534 | "Z":23.31 535 | }, 536 | { 537 | "Name":"Equality Way (Exit)", 538 | "X":-1549.77, 539 | "Y":-801.19, 540 | "Z":13.15 541 | }, 542 | { 543 | "Name":"Equality Way (on-slip)", 544 | "X":-1577.42, 545 | "Y":-726.07, 546 | "Z":18.55 547 | }, 548 | { 549 | "Name":"Magellan Ave/Sandcastle Way", 550 | "X":-1416.13, 551 | "Y":-914.83, 552 | "Z":10.81 553 | }, 554 | { 555 | "Name":"Great Ocean Hwy/Inseno Rd 1", 556 | "X":-3029.89, 557 | "Y":222.96, 558 | "Z":15.89 559 | }, 560 | { 561 | "Name":"Great Ocean Hwy/Zancudo Road", 562 | "X":-2479.27, 563 | "Y":3660.72, 564 | "Z":13.55 565 | }, 566 | { 567 | "Name":"Great Ocean Hwy/Zancudo Tunnel", 568 | "X":-2592.38, 569 | "Y":3120.09, 570 | "Z":14.76 571 | }, 572 | { 573 | "Name":"Great Ocean Hwy/Raton Canyon Bridge", 574 | "X":-1903.28, 575 | "Y":4614.71, 576 | "Z":56.80 577 | }, 578 | { 579 | "Name":"Great Ocean Hwy/Procopio Promenade", 580 | "X":-771.77, 581 | "Y":5491.96, 582 | "Z":34.46 583 | }, 584 | { 585 | "Name":"Paleto Blvd/Cascabel Ave", 586 | "X":-110.09, 587 | "Y":6421.06, 588 | "Z":31.22 589 | }, 590 | { 591 | "Name":"Great Ocean Hwy/Paleto Bay Petrol Station", 592 | "X":179.73, 593 | "Y":6582.76, 594 | "Z":31.63 595 | }, 596 | { 597 | "Name":"Great Ocean Hwy/Procopio Dr", 598 | "X":149.27, 599 | "Y":6527.46, 600 | "Z":31.46 601 | }, 602 | { 603 | "Name":"Senora Fwy/Braddock Pass (Tunnel)", 604 | "X":2119.48, 605 | "Y":6025.09, 606 | "Z":50.85 607 | }, 608 | { 609 | "Name":"Senora Fwy/Braddock Pass", 610 | "X":2399.84, 611 | "Y":5788.28, 612 | "Z":45.75 613 | }, 614 | { 615 | "Name":"Senora Fwy/Union Rd", 616 | "X":2625.67, 617 | "Y":5110.90, 618 | "Z":44.64 619 | }, 620 | { 621 | "Name":"Seaview Rd/Grapeseed Ave", 622 | "X":2444.93, 623 | "Y":4598.39, 624 | "Z":36.73 625 | }, 626 | { 627 | "Name":"North Calafia Way", 628 | "X":169.99, 629 | "Y":4418.34, 630 | "Z":75.10 631 | }, 632 | { 633 | "Name":"Mount Chiliad Tunnel", 634 | "X":-324.79, 635 | "Y":4791.61, 636 | "Z":141.04 637 | }, 638 | { 639 | "Name":"Marina Dr/Easty Joshua Rd", 640 | "X":2061.40, 641 | "Y":3721.39, 642 | "Z":32.85 643 | }, 644 | { 645 | "Name":"Algonquin Blvd/Joshua Rd", 646 | "X":1277.47, 647 | "Y":3536.09, 648 | "Z":35.05 649 | }, 650 | { 651 | "Name":"Joshua Rd/Calafia Rd", 652 | "X":283.89, 653 | "Y":3404.00, 654 | "Z":37.40 655 | }, 656 | { 657 | "Name":"Route 68 Approach/Joshua Rd", 658 | "X":225.84, 659 | "Y":2989.70, 660 | "Z":42.36 661 | }, 662 | { 663 | "Name":"Calafia Rd/Cassidy Trail", 664 | "X":225.84, 665 | "Y":2989.70, 666 | "Z":42.36 667 | }, 668 | { 669 | "Name":"Route 68/Grand Senora Desert", 670 | "X":1035.59, 671 | "Y":2685.46, 672 | "Z":39.15 673 | }, 674 | { 675 | "Name":"Panorama Dr/Cholla Rd", 676 | "X":1829.61, 677 | "Y":3276.35, 678 | "Z":43.57 679 | }, 680 | { 681 | "Name":"Route 68/Panorama Dr", 682 | "X":1931.85, 683 | "Y":2970.57, 684 | "Z":45.51 685 | }, 686 | { 687 | "Name":"Bolingbroke Penitentiary", 688 | "X":1885.83, 689 | "Y":2606.25, 690 | "Z":45.46 691 | }, 692 | { 693 | "Name":"Mt Vinewood Dr/Zancudo Barranca", 694 | "X":-804.01, 695 | "Y":1823.50, 696 | "Z":165.91 697 | }, 698 | { 699 | "Name":"Marlowe Dr/Milton Rd", 700 | "X":-718.93, 701 | "Y":985.76, 702 | "Z":237.79 703 | }, 704 | { 705 | "Name":"Baytree Canyon Rd/Senora Rd", 706 | "X":694.26, 707 | "Y":2186.95, 708 | "Z":60.42 709 | }, 710 | { 711 | "Name":"Mt Haan Rd/Baytree Canyon Rd", 712 | "X":142.97, 713 | "Y":1649.89, 714 | "Z":228.77 715 | }, 716 | { 717 | "Name":"Senora Rd/La Fuente Blanca", 718 | "X":1294.69, 719 | "Y":1186.00, 720 | "Z":106.81 721 | }, 722 | { 723 | "Name":"Senora Rd/Baytree Canyon Rd", 724 | "X":852.92, 725 | "Y":2236.89, 726 | "Z":48.36 727 | }, 728 | { 729 | "Name":"Buen Vino Rd/Route 68", 730 | "X":-2099.29, 731 | "Y":2309.42, 732 | "Z":37.43 733 | }, 734 | { 735 | "Name":"Buen Vino Rd/Banham Canyon Dr", 736 | "X":-2661.20, 737 | "Y":1502.22, 738 | "Z":116.44 739 | }, 740 | { 741 | "Name":"Route 68/Zancudo Rd", 742 | "X":-1677.66, 743 | "Y":2435.54, 744 | "Z":28.64 745 | }, 746 | { 747 | "Name":"Senora Fwy 2 (Petrol Station)", 748 | "X":2680.09, 749 | "Y":3178.76, 750 | "Z":52.31 751 | }, 752 | { 753 | "Name":"Senora Way/Palomino Fwy", 754 | "X":2397.76, 755 | "Y":1210.39, 756 | "Z":58.92 757 | }, 758 | { 759 | "Name":"Los Santos Fwy 2", 760 | "X":1712.54, 761 | "Y":1499.18, 762 | "Z":84.70 763 | }, 764 | { 765 | "Name":"Senora Way (Over Senora Fwy)", 766 | "X":2446.81, 767 | "Y":2860.45, 768 | "Z":48.82 769 | }, 770 | { 771 | "Name":"Palomino Fwy (Senora Fwy on-slip)", 772 | "X":1880.95, 773 | "Y":2103.13, 774 | "Z":54.48 775 | }, 776 | { 777 | "Name":"Senora Fwy (Palomino Fwy on-slip)", 778 | "X":1811.66, 779 | "Y":2130.67, 780 | "Z":54.47 781 | }, 782 | { 783 | "Name":"Senora Fwy (Los Santos Fwy on-slip)", 784 | "X":1769.02, 785 | "Y":2052.50, 786 | "Z":67.20 787 | }, 788 | { 789 | "Name":"Los Santos Fwy (Senora Fwy on-slip)", 790 | "X":1790.68, 791 | "Y":1883.54, 792 | "Z":79.10 793 | }, 794 | { 795 | "Name":"Los Santos Fwy (Palomino Fwy on-slip)", 796 | "X":1786.31, 797 | "Y":1601.29, 798 | "Z":83.73 799 | }, 800 | { 801 | "Name":"Vinewood Park Dr/Los Santos Fwy", 802 | "X":1139.41, 803 | "Y":378.27, 804 | "Z":91.35 805 | }, 806 | { 807 | "Name":"Palomino Fwy (Jct Senora Way)", 808 | "X":2447.68, 809 | "Y":953.36, 810 | "Z":87.08 811 | }, 812 | { 813 | "Name":"Palomino Fwy Petrol Station", 814 | "X":2585.63, 815 | "Y":360.60, 816 | "Z":108.24 817 | }, 818 | { 819 | "Name":"Sustancia Rd/Palomino Fwy", 820 | "X":2413.86, 821 | "Y":-461.85, 822 | "Z":71.50 823 | }, 824 | { 825 | "Name":"Olympic Fwy (Over Popular St)", 826 | "X":770.69, 827 | "Y":-1195.34, 828 | "Z":44.95 829 | }, 830 | { 831 | "Name":"Elysian Fields Fwy/El Rancho Blvd", 832 | "X":1240.24, 833 | "Y":-2051.41, 834 | "Z":44.14 835 | }, 836 | { 837 | "Name":"Los Santos Fwy (Under Bridge St)", 838 | "X":688.11, 839 | "Y":-166.98, 840 | "Z":48.05 841 | }, 842 | { 843 | "Name":"La Puerta Fwy (Over South Arsenal St)", 844 | "X":-623.16, 845 | "Y":-1720.22, 846 | "Z":37.06 847 | }, 848 | { 849 | "Name":"Elgin Ave/Del Perro Fwy", 850 | "X":304.20, 851 | "Y":-473.09, 852 | "Z":43.14 853 | }, 854 | { 855 | "Name":"La Puerta Fwy/Del Perro Fwy on-slip", 856 | "X":-163.66, 857 | "Y":-540.73, 858 | "Z":28.02 859 | }, 860 | { 861 | "Name":"Del Perro Fwy (Under Movie Star Way)", 862 | "X":-952.76, 863 | "Y":-556.62, 864 | "Z":18.33 865 | } 866 | ] -------------------------------------------------------------------------------- /fxmanifest.lua: -------------------------------------------------------------------------------- 1 | fx_version 'cerulean' 2 | games { 'gta5' } 3 | 4 | name 'CameraTech' 5 | description 'ANPR Camera Technology System' 6 | author 'Albo1125 (https://www.youtube.com/albo1125)' 7 | version 'v1.6.2' 8 | url 'https://github.com/Albo1125/CameraTech' 9 | files { 10 | 'Newtonsoft.Json.dll', 11 | 'anprvehicles.json', 12 | 'fixedanprcameras.json' 13 | } 14 | --server_script '@mysql-async/lib/MySQL.lua' 15 | server_script "vars.lua" 16 | server_script 'sv_CameraTech.lua' 17 | client_script 'CameraTech.net.dll' 18 | 19 | -- You can change ForceFocusedAnpr to 'true' if you only want fixed ANPR alerts to show if a plate is focused, useful if you want control to circulate ANPR hits initially before units see them. 20 | ForceFocusedAnpr 'false' 21 | -------------------------------------------------------------------------------- /sv_CameraTech.lua: -------------------------------------------------------------------------------- 1 | local plateinfos = {} 2 | local mysqlready = false 3 | 4 | -- Uncomment this if using MySQL async to insert ANPR hits into the database. 5 | --MySQL.ready(function() 6 | -- mysqlready = true 7 | --end) 8 | 9 | RegisterServerEvent("CameraTech:FixedANPRAlert") 10 | AddEventHandler('CameraTech:FixedANPRAlert', function(colour, model, anprname, dir, plate, x, y, z) 11 | local marker = plateinfos[plate] 12 | if marker ~= nil then 13 | TriggerClientEvent("CameraTech:ClFixedANPRAlert", -1, colour, model, anprname, dir, plate) 14 | TriggerEvent("CameraTech:svFixedANPRHit", source, plate, colour .. " " .. model, anprname .. " (" .. dir .. ")", marker, x, y, z) 15 | if mysqlready == true then 16 | -- Uncomment this if using MySQL async to insert ANPR hits into the database. 17 | --local timenow = os.time(os.date("!*t")) 18 | --local logquery = MySQL.Async.execute("INSERT into anpr (colour, model, anprname, dir, plate, marker, time) VALUES (@colour, @model, @anprname, @dir, @plate, @marker, @time)", 19 | --{['@colour'] = colour, ['@model'] = model, ['@anprname'] = anprname, ['@dir'] = dir, ['@plate'] = plate, ['@marker'] = marker, ['@time'] = timenow}) 20 | end 21 | end 22 | end) 23 | 24 | RegisterServerEvent("CameraTech:VehicleANPRAlert") 25 | AddEventHandler('CameraTech:VehicleANPRAlert', function(colour, model, cameraname, distance, plate, x, y, z) 26 | local marker = plateinfos[plate] 27 | if marker ~= nil then 28 | TriggerEvent("CameraTech:svVehicleANPRHit", source, plate, colour, model, cameraname .. " (" .. distance .. "m)", marker, x, y, z) 29 | if mysqlready == true then 30 | -- Uncomment this if using MySQL async to insert ANPR hits into the database. 31 | --local timenow = os.time(os.date("!*t")) 32 | --local logquery = MySQL.Async.execute("INSERT into anpr...") 33 | end 34 | end 35 | end) 36 | 37 | 38 | function anprinterfacefunc(source, args, rawCommand) 39 | isAuthorized(source, function(auth) 40 | if auth then 41 | TriggerClientEvent("CameraTech:MasterInterfaceToggle", source) 42 | else 43 | print(GetPlayerName(source).. " you are not ANPR trained.") 44 | end 45 | end) 46 | end 47 | 48 | RegisterCommand('anpr', anprinterfacefunc, false) 49 | 50 | function fixedanprfunc(source, args, rawCommand) 51 | isAuthorized(source, function(auth) 52 | if auth then 53 | TriggerClientEvent("CameraTech:FixedANPRToggle", source) 54 | else 55 | print(GetPlayerName(source).. " you are not ANPR trained.") 56 | end 57 | end) 58 | end 59 | 60 | RegisterCommand('fixedanpr', fixedanprfunc, false) 61 | 62 | function vehicleanprfunc(source, args, rawCommand) 63 | isAuthorized(source, function(auth) 64 | if auth then 65 | TriggerClientEvent("CameraTech:ToggleVehicleANPR", source) 66 | else 67 | print(GetPlayerName(source).. " you are not ANPR trained.") 68 | end 69 | end) 70 | end 71 | 72 | RegisterCommand('vehicleanpr', vehicleanprfunc, false) 73 | RegisterCommand('vehanpr', vehicleanprfunc, false) 74 | 75 | function readplatefunc(source, args, rawCommand) 76 | TriggerClientEvent("CameraTech:ReadPlateInFront", source) 77 | end 78 | 79 | RegisterCommand('rp', readplatefunc, false) 80 | RegisterCommand('readplate', readplatefunc, false) 81 | 82 | function checkplatefunc(source, args, rawCommand) 83 | local plate = string.upper(table.concat(args, " ")) 84 | plate = string.gsub(plate, "%s+", "") 85 | local markers = plateinfos[plate] 86 | if markers ~= nil then 87 | TriggerClientEvent("chatMessage", source, "SYSTEM", {0, 0, 0 }, "Plate: " .. plate .. ". Markers: ".. markers) 88 | else 89 | TriggerClientEvent("chatMessage", source, "SYSTEM", {0, 0, 0 }, "Plate: " .. plate .. ". No markers.") 90 | end 91 | end 92 | 93 | RegisterCommand('checkplate', checkplatefunc, false) 94 | 95 | function focusanprfunc(source, args, rawCommand) 96 | if next(args) == nil then 97 | TriggerClientEvent("CameraTech:FocusANPR", source, nil) 98 | else 99 | local plate = string.upper(table.concat(args, " ")) 100 | plate = string.gsub(plate, "%s+", "") 101 | TriggerClientEvent("CameraTech:FocusANPR", source, plate) 102 | end 103 | end 104 | 105 | RegisterCommand('focusanpr', focusanprfunc, false) 106 | RegisterCommand('focusplate', focusanprfunc, false) 107 | 108 | function setplateinfofunc(source, args, rawCommand) 109 | local plateinfo = stringsplit(table.concat(args, " "), ";") 110 | plateinfo[1] = string.upper(plateinfo[1]) 111 | plateinfo[1] = string.gsub(plateinfo[1], "%s+", "") 112 | if plateinfo[2] ~= nil then 113 | plateinfos[plateinfo[1]] = plateinfo[2] 114 | TriggerClientEvent("chatMessage", source, "SYSTEM", {0, 0, 0 }, "Plate: " .. plateinfo[1] .. ". Info: " .. plateinfo[2]) 115 | TriggerEvent("CameraTech:PlateMarkerUpdate", source, plateinfo[1], plateinfo[2]) 116 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 117 | elseif plateinfo[1] ~= nil then 118 | plateinfos = removeKey(plateinfos, plateinfo[1]) 119 | if plateinfos == nil then 120 | plateinfos = {} 121 | end 122 | TriggerClientEvent("chatMessage", source, "SYSTEM", {0, 0, 0 }, "Plate: " .. plateinfo[1] .. ". No info.") 123 | TriggerEvent("CameraTech:PlateMarkerUpdate", source, plateinfo[1], nil) 124 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 125 | end 126 | end 127 | 128 | RegisterCommand('setplateinfo', setplateinfofunc, false) 129 | 130 | function setvehinfofunc(source, args, rawCommand) 131 | if next(args) == nil then 132 | TriggerClientEvent("CameraTech:ClUpdateVehicleInfo", source, nil) 133 | else 134 | local plateinfo = table.concat(args, " ") 135 | TriggerClientEvent("CameraTech:ClUpdateVehicleInfo", source, plateinfo) 136 | end 137 | end 138 | 139 | RegisterCommand('setvehinfo', setvehinfofunc, false) 140 | 141 | RegisterServerEvent("CameraTech:UpdateVehicleInfo") 142 | AddEventHandler('CameraTech:UpdateVehicleInfo', function(plate, info) 143 | if info ~= nil then 144 | plateinfos[plate] = info 145 | TriggerEvent("CameraTech:PlateMarkerUpdate", source, plate, info) 146 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 147 | else 148 | plateinfos = removeKey(plateinfos, plate) 149 | if plateinfos == nil then 150 | plateinfos = {} 151 | end 152 | TriggerEvent("CameraTech:PlateMarkerUpdate", source, plate, nil) 153 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 154 | end 155 | end) 156 | 157 | RegisterServerEvent("CameraTech:UpdateAllPlateInfo") 158 | AddEventHandler('CameraTech:UpdateAllPlateInfo', function(plateinfo) 159 | local newplateinfos = {} 160 | for _, v in ipairs(plateinfo) do 161 | if (v == nil or v.plate == nil or v.marker == nil) then 162 | print("CameraTech:UpdateAllPlateInfo error: no plate or marker specified") 163 | else 164 | local plate = string.upper(string.gsub(v.plate, "%s+", "")) 165 | newplateinfos[plate] = v.marker 166 | end 167 | end 168 | 169 | plateinfos = newplateinfos 170 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 171 | end) 172 | 173 | print("CameraTech by Albo1125 (FiveM)") 174 | 175 | function platesync() 176 | TriggerClientEvent("CameraTech:SyncPlateInfo", -1, plateinfos) 177 | SetTimeout(30000, platesync) 178 | end 179 | SetTimeout(1000, platesync) 180 | 181 | function stringsplit(inputstr, sep) 182 | if sep == nil then 183 | sep = "%s" 184 | end 185 | local t={} ; i=1 186 | for str in string.gmatch(inputstr, "([^"..sep.."]+)") do 187 | t[i] = str 188 | i = i + 1 189 | end 190 | return t 191 | end 192 | 193 | -- Remove key k (and its value) from table t. Return a new (modified) table. 194 | function removeKey(t, k) 195 | local i = 0 196 | local keys, values = {},{} 197 | for k,v in pairs(t) do 198 | i = i + 1 199 | keys[i] = k 200 | values[i] = v 201 | end 202 | 203 | while i>0 do 204 | if keys[i] == k then 205 | table.remove(keys, i) 206 | table.remove(values, i) 207 | break 208 | end 209 | i = i - 1 210 | end 211 | 212 | local a = {} 213 | for i = 1,#keys do 214 | a[keys[i]] = values[i] 215 | end 216 | 217 | return a 218 | end -------------------------------------------------------------------------------- /vars.lua: -------------------------------------------------------------------------------- 1 | local useWhitelist = false 2 | local authorizedIdentifiers = { 3 | --"steam:1234", 4 | -- Add more identifiers here 5 | 6 | } 7 | 8 | function isAuthorized(player, callback) 9 | if not useWhitelist then return callback(true) end 10 | for i,id in ipairs(authorizedIdentifiers) do 11 | for x,pid in ipairs(GetPlayerIdentifiers(player)) do 12 | if pid == id then 13 | return callback(true) 14 | end 15 | end 16 | end 17 | return callback(false) 18 | end --------------------------------------------------------------------------------