Advertisement
Guest User

Untitled

a guest
Mar 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.64 KB | None | 0 0
  1. -- BELOVE IS YOUR SETTINGS, CHANGE THEM TO WHATEVER YOU'D LIKE & MORE SETTINGS WILL COME IN THE FUTURE! --
  2.  
  3. local useBilling = true -- OPTIONS: (true/false)
  4. local useCameraSound = true -- OPTIONS: (true/false)
  5. local useFlashingScreen = true -- OPTIONS: (true/false)
  6. local useBlips = false -- OPTIONS: (true/false)
  7. local alertPolice = true -- OPTIONS: (true/false)
  8. local alertSpeed = 200 -- OPTIONS: (1-5000 KMH)
  9.  
  10. -- ABOVE IS YOUR SETTINGS, CHANGE THEM TO WHATEVER YOU'D LIKE & MORE SETTINGS WILL COME IN THE FUTURE! --
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17.  
  18. local Keys = {
  19. ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
  20. ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
  21. ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
  22. ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
  23. ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
  24. ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
  25. ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
  26. ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
  27. ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
  28. }
  29.  
  30. ESX = nil
  31.  
  32. local hasBeenCaught = false
  33.  
  34. Citizen.CreateThread(function()
  35. while ESX == nil do
  36. TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
  37. Citizen.Wait(0)
  38. end
  39. end)
  40.  
  41. RegisterNetEvent('esx:playerLoaded')
  42. AddEventHandler('esx:playerLoaded', function(xPlayer)
  43. PlayerData = xPlayer
  44. end)
  45.  
  46. function hintToDisplay(text)
  47. SetTextComponentFormat("STRING")
  48. AddTextComponentString(text)
  49. DisplayHelpTextFromStringLabel(0, 0, 1, -1)
  50. end
  51.  
  52. -- BLIP FOR SPEEDCAMERA (START)
  53.  
  54. local blips = {
  55. -- 60KM/H ZONES
  56. {title="Speedcamera (60KM/H)", colour=1, id=1, x = -524.2645, y = -1776.3569, z = 21.3384}, -- 60KM/H ZONE
  57.  
  58. -- 80KM/H ZONES
  59. {title="Speedcamera (80KM/H)", colour=1, id=1, x = 2506.0671, y = 4145.2431, z = 38.1054}, -- 80KM/H ZONE
  60.  
  61. -- 120KM/H ZONES
  62. {title="Speedcamera (120KM/H)", colour=1, id=1, x = 1584.9281, y = -993.4557, z = 59.3923}, -- 120KM/H ZONE
  63. {title="Speedcamera (120KM/H)", colour=1, id=1, x = 2442.2006, y = -134.6004, z = 88.7765}, -- 120KM/H ZONE
  64. {title="Speedcamera (120KM/H)", colour=1, id=1, x = 2871.7951, y = 3540.5795, z = 53.0930} -- 120KM/H ZONE
  65. }
  66.  
  67. Citizen.CreateThread(function()
  68. for _, info in pairs(blips) do
  69. if useBlips == true then
  70. info.blip = AddBlipForCoord(info.x, info.y, info.z)
  71. SetBlipSprite(info.blip, info.id)
  72. SetBlipDisplay(info.blip, 4)
  73. SetBlipScale(info.blip, 0.5)
  74. SetBlipColour(info.blip, info.colour)
  75. SetBlipAsShortRange(info.blip, true)
  76. BeginTextCommandSetBlipName("STRING")
  77. AddTextComponentString(info.title)
  78. EndTextCommandSetBlipName(info.blip)
  79. end
  80. end
  81. end)
  82.  
  83. -- BLIP FOR SPEEDCAMERA (END)
  84.  
  85. local Speedcamera60Zone = {
  86. {x = -524.2645,y = -1776.3569,z = 21.3384},
  87. {x = 1080.2645,y = -747.3569,z = 19.3384},
  88. {x = 273.2645,y = -883.3569,z = 29.3384}
  89. }
  90.  
  91. local Speedcamera80Zone = {
  92. {x = 2506.0671,y = 4145.2431,z = 38.1054},
  93. {x = 1205.0671,y = -289.2431,z = 37.1054},
  94. {x = 253.0671,y = -223.2431,z = 54.1054}
  95. }
  96.  
  97. local Speedcamera120Zone = {
  98. {x = 1584.9281,y = -993.4557,z = 59.3923},
  99. {x = 2442.2006,y = -134.6004,z = 88.7765},
  100. {x = 2871.7951,y = 3540.5795,z = 53.0930},
  101. {x = 2647.7951,y = 2670.5795,z = 16.0930},
  102. {x = 1017.7951,y = 6489.5795,z = 21.0930}
  103. }
  104.  
  105. -- 60 ZONE (START)
  106.  
  107. Citizen.CreateThread(function()
  108. while true do
  109. Citizen.Wait(0)
  110.  
  111. for k in pairs(Speedcamera60Zone) do
  112.  
  113. local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
  114. local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera60Zone[k].x, Speedcamera60Zone[k].y, Speedcamera60Zone[k].z)
  115.  
  116. if dist <= 20.0 then
  117. local playerPed = GetPlayerPed(-1)
  118. local playerCar = GetVehiclePedIsIn(playerPed, false)
  119. local veh = GetVehiclePedIsIn(playerPed)
  120. local SpeedKM = GetEntitySpeed(playerPed)*3.6
  121. local maxSpeed = 50.0 -- THIS IS THE MAX SPEED IN KM/H
  122.  
  123. if SpeedKM > maxSpeed then
  124. if IsPedInAnyVehicle(playerPed, false) then
  125. if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
  126. if hasBeenCaught == false then
  127. if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
  128. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
  129. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
  130. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  131. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  132. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
  133. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  134. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
  135. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
  136. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
  137. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  138. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
  139. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
  140. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
  141. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
  142. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
  143. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
  144. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
  145. -- VEHICLES ABOVE ARE BLACKLISTED
  146. else
  147. -- ALERT POLICE (START)
  148. if alertPolice == true then
  149. if SpeedKM > alertSpeed then
  150. local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
  151. TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
  152. end
  153. end
  154. -- ALERT POLICE (END)
  155.  
  156. -- FLASHING EFFECT (START)
  157. if useFlashingScreen == true then
  158. TriggerServerEvent('esx_speedcamera:openGUI')
  159. end
  160.  
  161. if useCameraSound == true then
  162. TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
  163. end
  164.  
  165. if useFlashingScreen == true then
  166. Citizen.Wait(200)
  167. TriggerServerEvent('esx_speedcamera:closeGUI')
  168. end
  169. -- FLASHING EFFECT (END)
  170.  
  171. TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 50 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
  172.  
  173. if useBilling == true then
  174. TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (50KM/H)', 375) -- Sends a bill from the police
  175. else
  176. TriggerServerEvent('esx_speedcamera:PayBill60Zone')
  177. end
  178.  
  179. hasBeenCaught = true
  180. Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
  181. end
  182. end
  183. end
  184. end
  185.  
  186. hasBeenCaught = false
  187. end
  188. end
  189. end
  190. end
  191. end)
  192.  
  193. -- 60 ZONE (END)
  194.  
  195. -- 80 ZONE (START)
  196.  
  197. Citizen.CreateThread(function()
  198. while true do
  199. Citizen.Wait(0)
  200.  
  201. for k in pairs(Speedcamera80Zone) do
  202.  
  203. local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
  204. local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera80Zone[k].x, Speedcamera80Zone[k].y, Speedcamera80Zone[k].z)
  205.  
  206. if dist <= 20.0 then
  207. local playerPed = GetPlayerPed(-1)
  208. local playerCar = GetVehiclePedIsIn(playerPed, false)
  209. local veh = GetVehiclePedIsIn(playerPed)
  210. local SpeedKM = GetEntitySpeed(playerPed)*3.6
  211. local maxSpeed = 65.0 -- THIS IS THE MAX SPEED IN KM/H
  212.  
  213. if SpeedKM > maxSpeed then
  214. if IsPedInAnyVehicle(playerPed, false) then
  215. if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
  216. if hasBeenCaught == false then
  217. if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
  218. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
  219. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
  220. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  221. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  222. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
  223. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  224. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
  225. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
  226. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
  227. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  228. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
  229. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
  230. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
  231. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
  232. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
  233. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
  234. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
  235. -- VEHICLES ABOVE ARE BLACKLISTED
  236. else
  237. -- ALERT POLICE (START)
  238. if alertPolice == true then
  239. if SpeedKM > alertSpeed then
  240. local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
  241. TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
  242. end
  243. end
  244. -- ALERT POLICE (END)
  245.  
  246. -- FLASHING EFFECT (START)
  247. if useFlashingScreen == true then
  248. TriggerServerEvent('esx_speedcamera:openGUI')
  249. end
  250.  
  251. if useCameraSound == true then
  252. TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
  253. end
  254.  
  255. if useFlashingScreen == true then
  256. Citizen.Wait(200)
  257. TriggerServerEvent('esx_speedcamera:closeGUI')
  258. end
  259. -- FLASHING EFFECT (END)
  260.  
  261. TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 65 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
  262.  
  263. if useBilling == true then
  264. TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (65KM/H)', 375) -- Sends a bill from the police
  265. else
  266. TriggerServerEvent('esx_speedcamera:PayBill80Zone')
  267. end
  268.  
  269. hasBeenCaught = true
  270. Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
  271. end
  272. end
  273. end
  274. end
  275.  
  276. hasBeenCaught = false
  277. end
  278. end
  279. end
  280. end
  281. end)
  282.  
  283. -- 80 ZONE (END)
  284.  
  285. -- 120 ZONE (START)
  286.  
  287. Citizen.CreateThread(function()
  288. while true do
  289. Citizen.Wait(0)
  290.  
  291. for k in pairs(Speedcamera120Zone) do
  292.  
  293. local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
  294. local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera120Zone[k].x, Speedcamera120Zone[k].y, Speedcamera120Zone[k].z)
  295.  
  296. if dist <= 20.0 then
  297. local playerPed = GetPlayerPed(-1)
  298. local playerCar = GetVehiclePedIsIn(playerPed, false)
  299. local veh = GetVehiclePedIsIn(playerPed)
  300. local SpeedKM = GetEntitySpeed(playerPed)*3.6
  301. local maxSpeed = 100.0 -- THIS IS THE MAX SPEED IN KM/H
  302.  
  303. if SpeedKM > maxSpeed then
  304. if IsPedInAnyVehicle(playerPed, false) then
  305. if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
  306. if hasBeenCaught == false then
  307. if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
  308. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
  309. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
  310. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  311. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
  312. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
  313. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  314. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
  315. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
  316. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
  317. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
  318. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
  319. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
  320. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
  321. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
  322. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
  323. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
  324. elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
  325. -- VEHICLES ABOVE ARE BLACKLISTED
  326. else
  327. -- ALERT POLICE (START)
  328. if alertPolice == true then
  329. if SpeedKM > alertSpeed then
  330. local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
  331. TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
  332. end
  333. end
  334. -- ALERT POLICE (END)
  335.  
  336. -- FLASHING EFFECT (START)
  337. if useFlashingScreen == true then
  338. TriggerServerEvent('esx_speedcamera:openGUI')
  339. end
  340.  
  341. if useCameraSound == true then
  342. TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
  343. end
  344.  
  345. if useFlashingScreen == true then
  346. Citizen.Wait(200)
  347. TriggerServerEvent('esx_speedcamera:closeGUI')
  348. end
  349. -- FLASHING EFFECT (END)
  350.  
  351. TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 100 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
  352.  
  353. if useBilling == true then
  354. TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (100KM/H)', 375) -- Sends a bill from the police
  355. else
  356. TriggerServerEvent('esx_speedcamera:PayBill120Zone')
  357. end
  358.  
  359. hasBeenCaught = true
  360. Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
  361. end
  362. end
  363. end
  364. end
  365.  
  366. hasBeenCaught = false
  367. end
  368. end
  369. end
  370. end
  371. end)
  372.  
  373. -- 120 ZONE (END)
  374.  
  375. RegisterNetEvent('esx_speedcamera:openGUI')
  376. AddEventHandler('esx_speedcamera:openGUI', function()
  377. SetNuiFocus(false,false)
  378. SendNUIMessage({type = 'openSpeedcamera'})
  379. end)
  380.  
  381. RegisterNetEvent('esx_speedcamera:closeGUI')
  382. AddEventHandler('esx_speedcamera:closeGUI', function()
  383. SendNUIMessage({type = 'closeSpeedcamera'})
  384. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement