Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- BELOVE IS YOUR SETTINGS, CHANGE THEM TO WHATEVER YOU'D LIKE & MORE SETTINGS WILL COME IN THE FUTURE! --
- local useBilling = true -- OPTIONS: (true/false)
- local useCameraSound = true -- OPTIONS: (true/false)
- local useFlashingScreen = true -- OPTIONS: (true/false)
- local useBlips = false -- OPTIONS: (true/false)
- local alertPolice = true -- OPTIONS: (true/false)
- local alertSpeed = 200 -- OPTIONS: (1-5000 KMH)
- -- ABOVE IS YOUR SETTINGS, CHANGE THEM TO WHATEVER YOU'D LIKE & MORE SETTINGS WILL COME IN THE FUTURE! --
- local Keys = {
- ["ESC"] = 322, ["F1"] = 288, ["F2"] = 289, ["F3"] = 170, ["F5"] = 166, ["F6"] = 167, ["F7"] = 168, ["F8"] = 169, ["F9"] = 56, ["F10"] = 57,
- ["~"] = 243, ["1"] = 157, ["2"] = 158, ["3"] = 160, ["4"] = 164, ["5"] = 165, ["6"] = 159, ["7"] = 161, ["8"] = 162, ["9"] = 163, ["-"] = 84, ["="] = 83, ["BACKSPACE"] = 177,
- ["TAB"] = 37, ["Q"] = 44, ["W"] = 32, ["E"] = 38, ["R"] = 45, ["T"] = 245, ["Y"] = 246, ["U"] = 303, ["P"] = 199, ["["] = 39, ["]"] = 40, ["ENTER"] = 18,
- ["CAPS"] = 137, ["A"] = 34, ["S"] = 8, ["D"] = 9, ["F"] = 23, ["G"] = 47, ["H"] = 74, ["K"] = 311, ["L"] = 182,
- ["LEFTSHIFT"] = 21, ["Z"] = 20, ["X"] = 73, ["C"] = 26, ["V"] = 0, ["B"] = 29, ["N"] = 249, ["M"] = 244, [","] = 82, ["."] = 81,
- ["LEFTCTRL"] = 36, ["LEFTALT"] = 19, ["SPACE"] = 22, ["RIGHTCTRL"] = 70,
- ["HOME"] = 213, ["PAGEUP"] = 10, ["PAGEDOWN"] = 11, ["DELETE"] = 178,
- ["LEFT"] = 174, ["RIGHT"] = 175, ["TOP"] = 27, ["DOWN"] = 173,
- ["NENTER"] = 201, ["N4"] = 108, ["N5"] = 60, ["N6"] = 107, ["N+"] = 96, ["N-"] = 97, ["N7"] = 117, ["N8"] = 61, ["N9"] = 118
- }
- ESX = nil
- local hasBeenCaught = false
- Citizen.CreateThread(function()
- while ESX == nil do
- TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
- Citizen.Wait(0)
- end
- end)
- RegisterNetEvent('esx:playerLoaded')
- AddEventHandler('esx:playerLoaded', function(xPlayer)
- PlayerData = xPlayer
- end)
- function hintToDisplay(text)
- SetTextComponentFormat("STRING")
- AddTextComponentString(text)
- DisplayHelpTextFromStringLabel(0, 0, 1, -1)
- end
- -- BLIP FOR SPEEDCAMERA (START)
- local blips = {
- -- 60KM/H ZONES
- {title="Speedcamera (60KM/H)", colour=1, id=1, x = -524.2645, y = -1776.3569, z = 21.3384}, -- 60KM/H ZONE
- -- 80KM/H ZONES
- {title="Speedcamera (80KM/H)", colour=1, id=1, x = 2506.0671, y = 4145.2431, z = 38.1054}, -- 80KM/H ZONE
- -- 120KM/H ZONES
- {title="Speedcamera (120KM/H)", colour=1, id=1, x = 1584.9281, y = -993.4557, z = 59.3923}, -- 120KM/H ZONE
- {title="Speedcamera (120KM/H)", colour=1, id=1, x = 2442.2006, y = -134.6004, z = 88.7765}, -- 120KM/H ZONE
- {title="Speedcamera (120KM/H)", colour=1, id=1, x = 2871.7951, y = 3540.5795, z = 53.0930} -- 120KM/H ZONE
- }
- Citizen.CreateThread(function()
- for _, info in pairs(blips) do
- if useBlips == true then
- info.blip = AddBlipForCoord(info.x, info.y, info.z)
- SetBlipSprite(info.blip, info.id)
- SetBlipDisplay(info.blip, 4)
- SetBlipScale(info.blip, 0.5)
- SetBlipColour(info.blip, info.colour)
- SetBlipAsShortRange(info.blip, true)
- BeginTextCommandSetBlipName("STRING")
- AddTextComponentString(info.title)
- EndTextCommandSetBlipName(info.blip)
- end
- end
- end)
- -- BLIP FOR SPEEDCAMERA (END)
- local Speedcamera60Zone = {
- {x = -524.2645,y = -1776.3569,z = 21.3384},
- {x = 1080.2645,y = -747.3569,z = 19.3384},
- {x = 273.2645,y = -883.3569,z = 29.3384}
- }
- local Speedcamera80Zone = {
- {x = 2506.0671,y = 4145.2431,z = 38.1054},
- {x = 1205.0671,y = -289.2431,z = 37.1054},
- {x = 253.0671,y = -223.2431,z = 54.1054}
- }
- local Speedcamera120Zone = {
- {x = 1584.9281,y = -993.4557,z = 59.3923},
- {x = 2442.2006,y = -134.6004,z = 88.7765},
- {x = 2871.7951,y = 3540.5795,z = 53.0930},
- {x = 2647.7951,y = 2670.5795,z = 16.0930},
- {x = 1017.7951,y = 6489.5795,z = 21.0930}
- }
- -- 60 ZONE (START)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- for k in pairs(Speedcamera60Zone) do
- local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
- local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera60Zone[k].x, Speedcamera60Zone[k].y, Speedcamera60Zone[k].z)
- if dist <= 20.0 then
- local playerPed = GetPlayerPed(-1)
- local playerCar = GetVehiclePedIsIn(playerPed, false)
- local veh = GetVehiclePedIsIn(playerPed)
- local SpeedKM = GetEntitySpeed(playerPed)*3.6
- local maxSpeed = 50.0 -- THIS IS THE MAX SPEED IN KM/H
- if SpeedKM > maxSpeed then
- if IsPedInAnyVehicle(playerPed, false) then
- if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
- if hasBeenCaught == false then
- if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
- -- VEHICLES ABOVE ARE BLACKLISTED
- else
- -- ALERT POLICE (START)
- if alertPolice == true then
- if SpeedKM > alertSpeed then
- local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
- TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
- end
- end
- -- ALERT POLICE (END)
- -- FLASHING EFFECT (START)
- if useFlashingScreen == true then
- TriggerServerEvent('esx_speedcamera:openGUI')
- end
- if useCameraSound == true then
- TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
- end
- if useFlashingScreen == true then
- Citizen.Wait(200)
- TriggerServerEvent('esx_speedcamera:closeGUI')
- end
- -- FLASHING EFFECT (END)
- TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 50 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
- if useBilling == true then
- TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (50KM/H)', 375) -- Sends a bill from the police
- else
- TriggerServerEvent('esx_speedcamera:PayBill60Zone')
- end
- hasBeenCaught = true
- Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
- end
- end
- end
- end
- hasBeenCaught = false
- end
- end
- end
- end
- end)
- -- 60 ZONE (END)
- -- 80 ZONE (START)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- for k in pairs(Speedcamera80Zone) do
- local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
- local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera80Zone[k].x, Speedcamera80Zone[k].y, Speedcamera80Zone[k].z)
- if dist <= 20.0 then
- local playerPed = GetPlayerPed(-1)
- local playerCar = GetVehiclePedIsIn(playerPed, false)
- local veh = GetVehiclePedIsIn(playerPed)
- local SpeedKM = GetEntitySpeed(playerPed)*3.6
- local maxSpeed = 65.0 -- THIS IS THE MAX SPEED IN KM/H
- if SpeedKM > maxSpeed then
- if IsPedInAnyVehicle(playerPed, false) then
- if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
- if hasBeenCaught == false then
- if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
- -- VEHICLES ABOVE ARE BLACKLISTED
- else
- -- ALERT POLICE (START)
- if alertPolice == true then
- if SpeedKM > alertSpeed then
- local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
- TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
- end
- end
- -- ALERT POLICE (END)
- -- FLASHING EFFECT (START)
- if useFlashingScreen == true then
- TriggerServerEvent('esx_speedcamera:openGUI')
- end
- if useCameraSound == true then
- TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
- end
- if useFlashingScreen == true then
- Citizen.Wait(200)
- TriggerServerEvent('esx_speedcamera:closeGUI')
- end
- -- FLASHING EFFECT (END)
- TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 65 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
- if useBilling == true then
- TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (65KM/H)', 375) -- Sends a bill from the police
- else
- TriggerServerEvent('esx_speedcamera:PayBill80Zone')
- end
- hasBeenCaught = true
- Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
- end
- end
- end
- end
- hasBeenCaught = false
- end
- end
- end
- end
- end)
- -- 80 ZONE (END)
- -- 120 ZONE (START)
- Citizen.CreateThread(function()
- while true do
- Citizen.Wait(0)
- for k in pairs(Speedcamera120Zone) do
- local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
- local dist = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, Speedcamera120Zone[k].x, Speedcamera120Zone[k].y, Speedcamera120Zone[k].z)
- if dist <= 20.0 then
- local playerPed = GetPlayerPed(-1)
- local playerCar = GetVehiclePedIsIn(playerPed, false)
- local veh = GetVehiclePedIsIn(playerPed)
- local SpeedKM = GetEntitySpeed(playerPed)*3.6
- local maxSpeed = 100.0 -- THIS IS THE MAX SPEED IN KM/H
- if SpeedKM > maxSpeed then
- if IsPedInAnyVehicle(playerPed, false) then
- if (GetPedInVehicleSeat(playerCar, -1) == playerPed) then
- if hasBeenCaught == false then
- if GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICE3" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICEB" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLICET" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PRANGER" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "PBUS" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "2015POLSTANG" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "FIRETRUK" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLCHIRON" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE22" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "LGUARD" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "RIOT2" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POL718" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "POLSRT10" then -- BLACKLISTED VEHICLE
- elseif GetDisplayNameFromVehicleModel(GetEntityModel(veh)) == "AMBULANCE" then -- BLACKLISTED VEHICLE
- -- VEHICLES ABOVE ARE BLACKLISTED
- else
- -- ALERT POLICE (START)
- if alertPolice == true then
- if SpeedKM > alertSpeed then
- local x,y,z = table.unpack(GetEntityCoords(GetPlayerPed(-1), false))
- TriggerServerEvent('esx_phone:send', 'police', ' Someone passed the speed camera, above ' .. alertSpeed.. ' KMH', true, {x =x, y =y, z =z})
- end
- end
- -- ALERT POLICE (END)
- -- FLASHING EFFECT (START)
- if useFlashingScreen == true then
- TriggerServerEvent('esx_speedcamera:openGUI')
- end
- if useCameraSound == true then
- TriggerServerEvent("InteractSound_SV:PlayOnSource", "speedcamera", 0.5)
- end
- if useFlashingScreen == true then
- Citizen.Wait(200)
- TriggerServerEvent('esx_speedcamera:closeGUI')
- end
- -- FLASHING EFFECT (END)
- TriggerEvent("pNotify:SendNotification", {text = "You've been caught by the speedcamera in a 100 zone!", type = "error", timeout = 5000, layout = "centerLeft"})
- if useBilling == true then
- TriggerServerEvent('esx_billing:sendBill', GetPlayerServerId(PlayerId()), 'society_police', 'Speedcamera (100KM/H)', 375) -- Sends a bill from the police
- else
- TriggerServerEvent('esx_speedcamera:PayBill120Zone')
- end
- hasBeenCaught = true
- Citizen.Wait(5000) -- This is here to make sure the player won't get fined over and over again by the same camera!
- end
- end
- end
- end
- hasBeenCaught = false
- end
- end
- end
- end
- end)
- -- 120 ZONE (END)
- RegisterNetEvent('esx_speedcamera:openGUI')
- AddEventHandler('esx_speedcamera:openGUI', function()
- SetNuiFocus(false,false)
- SendNUIMessage({type = 'openSpeedcamera'})
- end)
- RegisterNetEvent('esx_speedcamera:closeGUI')
- AddEventHandler('esx_speedcamera:closeGUI', function()
- SendNUIMessage({type = 'closeSpeedcamera'})
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement