diff --git a/client/anpr.lua b/client/anpr.lua index 49e6641d..877bec58 100644 --- a/client/anpr.lua +++ b/client/anpr.lua @@ -1,47 +1,42 @@ local lastRadar = nil local HasAlreadyEnteredMarker = false --- Determines if player is close enough to trigger cam -function HandlespeedCam(speedCam, hasBeenBusted) - local myPed = PlayerPedId() - local playerPos = GetEntityCoords(myPed) - local isInMarker = false - if #(playerPos - vector3(speedCam.x, speedCam.y, speedCam.z)) < 20.0 then - isInMarker = true - end + +local function IsInMarker(playerPos, speedCam) + return #(playerPos - vector3(speedCam.x, speedCam.y, speedCam.z)) < 20.0 +end + +local function HandleSpeedCam(speedCam, radarID) + local playerPed = PlayerPedId() + local playerPos = GetEntityCoords(playerPed) + local isInMarker = IsInMarker(playerPos, speedCam) if isInMarker and not HasAlreadyEnteredMarker and lastRadar == nil then HasAlreadyEnteredMarker = true - lastRadar = hasBeenBusted + lastRadar = radarID - local vehicle = GetPlayersLastVehicle() -- gets the current vehicle the player is in. - if IsPedInAnyVehicle(myPed, false) then - if GetPedInVehicleSeat(vehicle, -1) == myPed then - if GetVehicleClass(vehicle) ~= 18 then - local plate = QBCore.Functions.GetPlate(vehicle) - QBCore.Functions.TriggerCallback('police:IsPlateFlagged', function(result) - if result then - local coords = GetEntityCoords(PlayerPedId()) - local blipsettings = { - x = coords.x, - y = coords.y, - z = coords.z, - sprite = 488, - color = 1, - scale = 0.9, - text = "Speed camera #"..hasBeenBusted.." - Marked vehicle" - } - local s1, s2 = GetStreetNameAtCoord(coords.x, coords.y, coords.z) - local street1 = GetStreetNameFromHashKey(s1) - local street2 = GetStreetNameFromHashKey(s2) - TriggerServerEvent("police:server:FlaggedPlateTriggered", hasBeenBusted, plate, street1, street2, blipsettings) - end - end, plate) + local vehicle = GetPlayersLastVehicle() + if IsPedInAnyVehicle(playerPed, false) and GetPedInVehicleSeat(vehicle, -1) == playerPed and GetVehicleClass(vehicle) ~= 18 then + local plate = QBCore.Functions.GetPlate(vehicle) + QBCore.Functions.TriggerCallback('police:IsPlateFlagged', function(isFlagged) + if isFlagged then + local coords = GetEntityCoords(playerPed) + local blipsettings = { + x = coords.x, + y = coords.y, + z = coords.z, + sprite = 488, + color = 1, + scale = 0.9, + text = 'Speed camera #' .. radarID .. ' - Marked vehicle' + } + local street1, street2 = table.unpack(GetStreetNameAtCoord(coords.x, coords.y, coords.z)) + TriggerServerEvent('police:server:FlaggedPlateTriggered', radarID, plate, street1, street2, blipsettings) end - end + end, plate) end end - if not isInMarker and HasAlreadyEnteredMarker and lastRadar == hasBeenBusted then + if not isInMarker and HasAlreadyEnteredMarker and lastRadar == radarID then HasAlreadyEnteredMarker = false lastRadar = nil end @@ -49,10 +44,9 @@ end CreateThread(function() while true do - Wait(1) if IsPedInAnyVehicle(PlayerPedId(), false) then for key, value in pairs(Config.Radars) do - HandlespeedCam(value, key) + HandleSpeedCam(value, key) end Wait(200) else diff --git a/client/camera.lua b/client/camera.lua index e1f3ef3a..3e704be8 100644 --- a/client/camera.lua +++ b/client/camera.lua @@ -10,7 +10,7 @@ local function GetCurrentTime() if minutes < 10 then minutes = tostring(0 .. GetClockMinutes()) end - return tostring(hours .. ":" .. minutes) + return tostring(hours .. ':' .. minutes) end local function ChangeSecurityCamera(x, y, z, r) @@ -19,7 +19,7 @@ local function ChangeSecurityCamera(x, y, z, r) createdCamera = 0 end - local cam = CreateCam("DEFAULT_SCRIPTED_CAMERA", 1) + local cam = CreateCam('DEFAULT_SCRIPTED_CAMERA', 1) SetCamCoord(cam, x, y, z) SetCamRot(cam, r.x, r.y, r.z, 2) RenderScriptCams(1, 0, 0, 1, 1) @@ -31,7 +31,7 @@ local function CloseSecurityCamera() DestroyCam(createdCamera, 0) RenderScriptCams(0, 0, 1, 1, 1) createdCamera = 0 - ClearTimecycleModifier("scanline_cam_cheap") + ClearTimecycleModifier('scanline_cam_cheap') SetFocusEntity(GetPlayerPed(PlayerId())) if Config.SecurityCameras.hideradar then DisplayRadar(true) @@ -44,7 +44,7 @@ local function InstructionButton(ControlButton) end local function InstructionButtonMessage(text) - BeginTextCommandScaleformString("STRING") + BeginTextCommandScaleformString('STRING') AddTextComponentScaleform(text) EndTextCommandScaleformString() end @@ -54,23 +54,23 @@ local function CreateInstuctionScaleform(scaleform) while not HasScaleformMovieLoaded(scaleform) do Wait(0) end - PushScaleformMovieFunction(scaleform, "CLEAR_ALL") + PushScaleformMovieFunction(scaleform, 'CLEAR_ALL') PopScaleformMovieFunctionVoid() - PushScaleformMovieFunction(scaleform, "SET_CLEAR_SPACE") + PushScaleformMovieFunction(scaleform, 'SET_CLEAR_SPACE') PushScaleformMovieFunctionParameterInt(200) PopScaleformMovieFunctionVoid() - PushScaleformMovieFunction(scaleform, "SET_DATA_SLOT") + PushScaleformMovieFunction(scaleform, 'SET_DATA_SLOT') PushScaleformMovieFunctionParameterInt(1) InstructionButton(GetControlInstructionalButton(1, 194, true)) InstructionButtonMessage(Lang:t('info.close_camera')) PopScaleformMovieFunctionVoid() - PushScaleformMovieFunction(scaleform, "DRAW_INSTRUCTIONAL_BUTTONS") + PushScaleformMovieFunction(scaleform, 'DRAW_INSTRUCTIONAL_BUTTONS') PopScaleformMovieFunctionVoid() - PushScaleformMovieFunction(scaleform, "SET_BACKGROUND_COLOUR") + PushScaleformMovieFunction(scaleform, 'SET_BACKGROUND_COLOUR') PushScaleformMovieFunctionParameterInt(0) PushScaleformMovieFunctionParameterInt(0) PushScaleformMovieFunctionParameterInt(0) @@ -88,7 +88,7 @@ RegisterNetEvent('police:client:ActiveCamera', function(cameraId) Wait(0) end SendNUIMessage({ - type = "enablecam", + type = 'enablecam', label = Config.SecurityCameras.cameras[cameraId].label, id = cameraId, connected = Config.SecurityCameras.cameras[cameraId].isOnline, @@ -109,11 +109,11 @@ RegisterNetEvent('police:client:ActiveCamera', function(cameraId) end CloseSecurityCamera() SendNUIMessage({ - type = "disablecam", + type = 'disablecam', }) DoScreenFadeIn(250) else - QBCore.Functions.Notify(Lang:t("error.no_camera"), "error") + QBCore.Functions.Notify(Lang:t('error.no_camera'), 'error') end end) @@ -147,9 +147,9 @@ CreateThread(function() local sleep = 2000 if createdCamera ~= 0 then sleep = 5 - local instructions = CreateInstuctionScaleform("instructional_buttons") + local instructions = CreateInstuctionScaleform('instructional_buttons') DrawScaleformMovieFullscreen(instructions, 255, 255, 255, 255, 0) - SetTimecycleModifier("scanline_cam_cheap") + SetTimecycleModifier('scanline_cam_cheap') SetTimecycleModifierStrength(1.0) if Config.SecurityCameras.hideradar then @@ -164,7 +164,7 @@ CreateThread(function() end CloseSecurityCamera() SendNUIMessage({ - type = "disablecam", + type = 'disablecam', }) DoScreenFadeIn(250) end diff --git a/client/evidence.lua b/client/evidence.lua index a73c5498..14554475 100644 --- a/client/evidence.lua +++ b/client/evidence.lua @@ -20,8 +20,8 @@ local StatusList = { ['handbleed'] = Lang:t('evidence.handbleed'), ['confused'] = Lang:t('evidence.confused'), ['alcohol'] = Lang:t('evidence.alcohol'), - ["heavyalcohol"] = Lang:t('evidence.heavy_alcohol'), - ["agitated"] = Lang:t('evidence.agitated') + ['heavyalcohol'] = Lang:t('evidence.heavy_alcohol'), + ['agitated'] = Lang:t('evidence.agitated') } local WhitelistedWeapons = { @@ -42,15 +42,15 @@ local function DrawText3D(x, y, z, text) BeginTextCommandDisplayText('STRING') SetTextCentre(true) AddTextComponentSubstringPlayerName(text) - SetDrawOrigin(x,y,z, 0) + SetDrawOrigin(x, y, z, 0) EndTextCommandDisplayText(0.0, 0.0) local factor = (string.len(text)) / 370 - DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) + DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) ClearDrawOrigin() end local function WhitelistedWeapon(weapon) - for i=1, #WhitelistedWeapons do + for i = 1, #WhitelistedWeapons do if WhitelistedWeapons[i] == weapon then return true end @@ -126,7 +126,7 @@ end) RegisterNetEvent('evidence:client:ClearBlooddropsInArea', function() local pos = GetEntityCoords(PlayerPedId()) local blooddropList = {} - QBCore.Functions.Progressbar('clear_blooddrops', Lang:t("progressbar.blood_clear"), 5000, false, true, { + QBCore.Functions.Progressbar('clear_blooddrops', Lang:t('progressbar.blood_clear'), 5000, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, @@ -135,16 +135,16 @@ RegisterNetEvent('evidence:client:ClearBlooddropsInArea', function() if Blooddrops and next(Blooddrops) then for bloodId, _ in pairs(Blooddrops) do if #(pos - - vector3(Blooddrops[bloodId].coords.x, Blooddrops[bloodId].coords.y, Blooddrops[bloodId].coords.z)) < + vector3(Blooddrops[bloodId].coords.x, Blooddrops[bloodId].coords.y, Blooddrops[bloodId].coords.z)) < 10.0 then - blooddropList[#blooddropList+1] = bloodId + blooddropList[#blooddropList + 1] = bloodId end end TriggerServerEvent('evidence:server:ClearBlooddrops', blooddropList) - QBCore.Functions.Notify(Lang:t("success.blood_clear"), "success") + QBCore.Functions.Notify(Lang:t('success.blood_clear'), 'success') end end, function() -- Cancel - QBCore.Functions.Notify(Lang:t("error.blood_not_cleared"), "error") + QBCore.Functions.Notify(Lang:t('error.blood_not_cleared'), 'error') end) end) @@ -168,7 +168,7 @@ end) RegisterNetEvent('evidence:client:ClearCasingsInArea', function() local pos = GetEntityCoords(PlayerPedId()) local casingList = {} - QBCore.Functions.Progressbar('clear_casings', Lang:t("progressbar.bullet_casing"), 5000, false, true, { + QBCore.Functions.Progressbar('clear_casings', Lang:t('progressbar.bullet_casing'), 5000, false, true, { disableMovement = false, disableCarMovement = false, disableMouse = false, @@ -178,15 +178,14 @@ RegisterNetEvent('evidence:client:ClearCasingsInArea', function() for casingId, _ in pairs(Casings) do if #(pos - vector3(Casings[casingId].coords.x, Casings[casingId].coords.y, Casings[casingId].coords.z)) < 10.0 then - casingList[#casingList+1] = casingId + casingList[#casingList + 1] = casingId end end TriggerServerEvent('evidence:server:ClearCasings', casingList) - QBCore.Functions.Notify(Lang:t("success.bullet_casing_removed"), "success") - + QBCore.Functions.Notify(Lang:t('success.bullet_casing_removed'), 'success') end end, function() -- Cancel - QBCore.Functions.Notify(Lang:t("error.bullet_casing_not_removed"), "error") + QBCore.Functions.Notify(Lang:t('error.bullet_casing_not_removed'), 'error') end) end) @@ -237,8 +236,8 @@ CreateThread(function() Wait(1) if CurrentCasing and CurrentCasing ~= 0 then local pos = GetEntityCoords(PlayerPedId()) - if #(pos -vector3(Casings[CurrentCasing].coords.x, Casings[CurrentCasing].coords.y, Casings[CurrentCasing].coords.z)) < 1.5 then - DrawText3D(Casings[CurrentCasing].coords.x, Casings[CurrentCasing].coords.y, Casings[CurrentCasing].coords.z, Lang:t('info.bullet_casing', {value = Casings[CurrentCasing].type})) + if #(pos - vector3(Casings[CurrentCasing].coords.x, Casings[CurrentCasing].coords.y, Casings[CurrentCasing].coords.z)) < 1.5 then + DrawText3D(Casings[CurrentCasing].coords.x, Casings[CurrentCasing].coords.y, Casings[CurrentCasing].coords.z, Lang:t('info.bullet_casing', { value = Casings[CurrentCasing].type })) if IsControlJustReleased(0, 47) then local s1, s2 = GetStreetNameAtCoord(Casings[CurrentCasing].coords.x, Casings[CurrentCasing].coords.y, Casings[CurrentCasing].coords.z) local street1 = GetStreetNameFromHashKey(s1) @@ -250,7 +249,7 @@ CreateThread(function() local info = { label = Lang:t('info.casing'), type = 'casing', - street = streetLabel:gsub("%'", ""), + street = streetLabel:gsub("%'", ''), ammolabel = Config.AmmoLabels[QBCore.Shared.Weapons[Casings[CurrentCasing].type]['ammotype']], ammotype = Casings[CurrentCasing].type, serie = Casings[CurrentCasing].serie @@ -263,8 +262,8 @@ CreateThread(function() if CurrentBlooddrop and CurrentBlooddrop ~= 0 then local pos = GetEntityCoords(PlayerPedId()) if #(pos - vector3(Blooddrops[CurrentBlooddrop].coords.x, Blooddrops[CurrentBlooddrop].coords.y, - Blooddrops[CurrentBlooddrop].coords.z)) < 1.5 then - DrawText3D(Blooddrops[CurrentBlooddrop].coords.x, Blooddrops[CurrentBlooddrop].coords.y, Blooddrops[CurrentBlooddrop].coords.z, Lang:t('info.blood_text', {value = DnaHash(Blooddrops[CurrentBlooddrop].citizenid)})) + Blooddrops[CurrentBlooddrop].coords.z)) < 1.5 then + DrawText3D(Blooddrops[CurrentBlooddrop].coords.x, Blooddrops[CurrentBlooddrop].coords.y, Blooddrops[CurrentBlooddrop].coords.z, Lang:t('info.blood_text', { value = DnaHash(Blooddrops[CurrentBlooddrop].citizenid) })) if IsControlJustReleased(0, 47) then local s1, s2 = GetStreetNameAtCoord(Blooddrops[CurrentBlooddrop].coords.x, Blooddrops[CurrentBlooddrop].coords.y, Blooddrops[CurrentBlooddrop].coords.z) local street1 = GetStreetNameFromHashKey(s1) @@ -276,7 +275,7 @@ CreateThread(function() local info = { label = Lang:t('info.blood'), type = 'blood', - street = streetLabel:gsub("%'", ""), + street = streetLabel:gsub("%'", ''), dnalabel = DnaHash(Blooddrops[CurrentBlooddrop].citizenid), bloodtype = Blooddrops[CurrentBlooddrop].bloodtype } @@ -288,10 +287,10 @@ CreateThread(function() if CurrentFingerprint and CurrentFingerprint ~= 0 then local pos = GetEntityCoords(PlayerPedId()) if #(pos - vector3(Fingerprints[CurrentFingerprint].coords.x, Fingerprints[CurrentFingerprint].coords.y, - Fingerprints[CurrentFingerprint].coords.z)) < 1.5 then + Fingerprints[CurrentFingerprint].coords.z)) < 1.5 then DrawText3D(Fingerprints[CurrentFingerprint].coords.x, Fingerprints[CurrentFingerprint].coords.y, Fingerprints[CurrentFingerprint].coords.z, Lang:t('info.fingerprint_text')) if IsControlJustReleased(0, 47) then - local s1, s2 = GetStreetNameAtCoord(Fingerprints[CurrentFingerprint].coords.x,Fingerprints[CurrentFingerprint].coords.y, Fingerprints[CurrentFingerprint].coords.z) + local s1, s2 = GetStreetNameAtCoord(Fingerprints[CurrentFingerprint].coords.x, Fingerprints[CurrentFingerprint].coords.y, Fingerprints[CurrentFingerprint].coords.z) local street1 = GetStreetNameFromHashKey(s1) local street2 = GetStreetNameFromHashKey(s2) local streetLabel = street1 @@ -301,7 +300,7 @@ CreateThread(function() local info = { label = Lang:t('info.fingerprint'), type = 'fingerprint', - street = streetLabel:gsub("%'", ""), + street = streetLabel:gsub("%'", ''), fingerprint = Fingerprints[CurrentFingerprint].fingerprint } TriggerServerEvent('evidence:server:AddFingerprintToInventory', CurrentFingerprint, info) @@ -315,7 +314,7 @@ CreateThread(function() while true do Wait(10) if LocalPlayer.state.isLoggedIn then - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then if IsPlayerFreeAiming(PlayerId()) and GetSelectedPedWeapon(PlayerPedId()) == `WEAPON_FLASHLIGHT` then if next(Casings) then local pos = GetEntityCoords(PlayerPedId(), true) diff --git a/client/heli.lua b/client/heli.lua index 1821cf15..2de6f940 100644 --- a/client/heli.lua +++ b/client/heli.lua @@ -1,18 +1,18 @@ local fov_max = 80.0 -local fov_min = 10.0 -- max zoom level (smaller fov is more zoom) -local zoomspeed = 2.0 -- camera zoom speed -local speed_lr = 3.0 -- speed by which the camera pans left-right -local speed_ud = 3.0 -- speed by which the camera pans up-down -local toggle_helicam = 51 -- control id of the button by which to toggle the helicam mode. Default: INPUT_CONTEXT (E) -local toggle_vision = 25 -- control id to toggle vision mode. Default: INPUT_AIM (Right mouse btn) -local toggle_rappel = 154 -- control id to rappel out of the heli. Default: INPUT_DUCK (X) +local fov_min = 10.0 -- max zoom level (smaller fov is more zoom) +local zoomspeed = 2.0 -- camera zoom speed +local speed_lr = 3.0 -- speed by which the camera pans left-right +local speed_ud = 3.0 -- speed by which the camera pans up-down +local toggle_helicam = 51 -- control id of the button by which to toggle the helicam mode. Default: INPUT_CONTEXT (E) +local toggle_vision = 25 -- control id to toggle vision mode. Default: INPUT_AIM (Right mouse btn) +local toggle_rappel = 154 -- control id to rappel out of the heli. Default: INPUT_DUCK (X) local toggle_spotlight = 74 -- control id to toggle the front spotlight Default: INPUT_VEH_HEADLIGHT (H) -local toggle_lock_on = 22 -- control id to lock onto a vehicle with the camera. Default is INPUT_SPRINT (spacebar) +local toggle_lock_on = 22 -- control id to lock onto a vehicle with the camera. Default is INPUT_SPRINT (spacebar) local spotlight_state = false -- Script starts here local helicam = false -local fov = (fov_max+fov_min)*0.5 +local fov = (fov_max + fov_min) * 0.5 local vision_state = 0 -- 0 is normal, 1 is nightmode, 2 is thermal vision local isScanning = false @@ -67,40 +67,40 @@ local function CheckInputRotation(cam, zoomvalue) local rightAxisY = GetDisabledControlNormal(0, 221) local rotation = GetCamRot(cam, 2) if rightAxisX ~= 0.0 or rightAxisY ~= 0.0 then - local new_z = rotation.z + rightAxisX*-1.0*(speed_ud)*(zoomvalue+0.1) - local new_x = math.max(math.min(20.0, rotation.x + rightAxisY*-1.0*(speed_lr)*(zoomvalue+0.1)), -89.5) -- Clamping at top (cant see top of heli) and at bottom (doesn't glitch out in -90deg) + local new_z = rotation.z + rightAxisX * -1.0 * (speed_ud) * (zoomvalue + 0.1) + local new_x = math.max(math.min(20.0, rotation.x + rightAxisY * -1.0 * (speed_lr) * (zoomvalue + 0.1)), -89.5) -- Clamping at top (cant see top of heli) and at bottom (doesn't glitch out in -90deg) SetCamRot(cam, new_x, 0.0, new_z, 2) end end local function HandleZoom(cam) - if IsControlJustPressed(0,241) then -- Scrollup + if IsControlJustPressed(0, 241) then -- Scrollup fov = math.max(fov - zoomspeed, fov_min) end - if IsControlJustPressed(0,242) then + if IsControlJustPressed(0, 242) then fov = math.min(fov + zoomspeed, fov_max) -- ScrollDown end local current_fov = GetCamFov(cam) - if math.abs(fov-current_fov) < 0.1 then -- the difference is too small, just set the value directly to avoid unneeded updates to FOV of order 10^-5 + if math.abs(fov - current_fov) < 0.1 then -- the difference is too small, just set the value directly to avoid unneeded updates to FOV of order 10^-5 fov = current_fov end - SetCamFov(cam, current_fov + (fov - current_fov)*0.05) -- Smoothing of camera zoom + SetCamFov(cam, current_fov + (fov - current_fov) * 0.05) -- Smoothing of camera zoom end local function RotAnglesToVec(rot) -- input vector3 local z = math.rad(rot.z) local x = math.rad(rot.x) local num = math.abs(math.cos(x)) - return vector3(-math.sin(z)*num, math.cos(z)*num, math.sin(x)) + return vector3(-math.sin(z) * num, math.cos(z) * num, math.sin(x)) end local function GetVehicleInView(cam) local coords = GetCamCoord(cam) local forward_vector = RotAnglesToVec(GetCamRot(cam, 2)) --DrawLine(coords, coords+(forward_vector*100.0), 255,0,0,255) -- debug line to show LOS of cam - local rayhandle = CastRayPointToPoint(coords, coords+(forward_vector*400.0), 10, GetVehiclePedIsIn(PlayerPedId()), 0) + local rayhandle = CastRayPointToPoint(coords, coords + (forward_vector * 400.0), 10, GetVehiclePedIsIn(PlayerPedId()), 0) local _, _, _, _, entityHit = GetRaycastResult(rayhandle) - if entityHit>0 and IsEntityAVehicle(entityHit) then + if entityHit > 0 and IsEntityAVehicle(entityHit) then return entityHit else return nil @@ -116,10 +116,10 @@ local function RenderVehicleInfo(vehicle) local street1, street2 = GetStreetNameAtCoord(pos.x, pos.y, pos.z) local streetLabel = GetStreetNameFromHashKey(street1) if street2 ~= 0 then - streetLabel = streetLabel .. " | " .. GetStreetNameFromHashKey(street2) + streetLabel = streetLabel .. ' | ' .. GetStreetNameFromHashKey(street2) end SendNUIMessage({ - type = "heliupdateinfo", + type = 'heliupdateinfo', model = vehname, plate = licenseplate, speed = speed, @@ -138,23 +138,23 @@ CreateThread(function() while true do Wait(0) if LocalPlayer.state.isLoggedIn then - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then if IsPlayerInPolmav() then local lPed = PlayerPedId() local heli = GetVehiclePedIsIn(lPed) if IsHeliHighEnough(heli) then if IsControlJustPressed(0, toggle_helicam) then -- Toggle Helicam - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) helicam = true SendNUIMessage({ - type = "heliopen", + type = 'heliopen', }) end if IsControlJustPressed(0, toggle_rappel) then -- Initiate rappel if GetPedInVehicleSeat(heli, 1) == lPed or GetPedInVehicleSeat(heli, 2) == lPed then - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) TaskRappelFromHeli(PlayerPedId(), 1) end end @@ -162,41 +162,41 @@ CreateThread(function() if IsControlJustPressed(0, toggle_spotlight) and (GetPedInVehicleSeat(heli, -1) == lPed or GetPedInVehicleSeat(heli, 0) == lPed) then spotlight_state = not spotlight_state - TriggerServerEvent("heli:spotlight", spotlight_state) - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + TriggerServerEvent('heli:spotlight', spotlight_state) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) end if helicam then - SetTimecycleModifier("heliGunCam") + SetTimecycleModifier('heliGunCam') SetTimecycleModifierStrength(0.3) - local scaleform = RequestScaleformMovie("HELI_CAM") + local scaleform = RequestScaleformMovie('HELI_CAM') while not HasScaleformMovieLoaded(scaleform) do Wait(0) end - local cam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true) - AttachCamToEntity(cam, heli, 0.0,0.0,-1.5, true) - SetCamRot(cam, 0.0,0.0,GetEntityHeading(heli)) + local cam = CreateCam('DEFAULT_SCRIPTED_FLY_CAMERA', true) + AttachCamToEntity(cam, heli, 0.0, 0.0, -1.5, true) + SetCamRot(cam, 0.0, 0.0, GetEntityHeading(heli)) SetCamFov(cam, fov) RenderScriptCams(true, false, 0, 1, 0) - PushScaleformMovieFunction(scaleform, "SET_CAM_LOGO") + PushScaleformMovieFunction(scaleform, 'SET_CAM_LOGO') PushScaleformMovieFunctionParameterInt(0) -- 0 for nothing, 1 for LSPD logo PopScaleformMovieFunctionVoid() locked_on_vehicle = nil while helicam and not IsEntityDead(lPed) and (GetVehiclePedIsIn(lPed) == heli) and IsHeliHighEnough(heli) do if IsControlJustPressed(0, toggle_helicam) then -- Toggle Helicam - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) helicam = false isScanned = false scanValue = 0 SendNUIMessage({ - type = "disablescan", + type = 'disablescan', }) SendNUIMessage({ - type = "heliclose", + type = 'heliclose', }) end if IsControlJustPressed(0, toggle_vision) then - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) ChangeVision() end local zoomvalue = 0 @@ -204,32 +204,32 @@ CreateThread(function() if DoesEntityExist(locked_on_vehicle) then PointCamAtEntity(cam, locked_on_vehicle, 0.0, 0.0, 0.0, true) if IsControlJustPressed(0, toggle_lock_on) then - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) locked_on_vehicle = nil local rot = GetCamRot(cam, 2) -- All this because I can't seem to get the camera unlocked from the entity fov = GetCamFov(cam) local old_cam = cam DestroyCam(old_cam, false) - cam = CreateCam("DEFAULT_SCRIPTED_FLY_CAMERA", true) - AttachCamToEntity(cam, heli, 0.0,0.0,-1.5, true) + cam = CreateCam('DEFAULT_SCRIPTED_FLY_CAMERA', true) + AttachCamToEntity(cam, heli, 0.0, 0.0, -1.5, true) SetCamRot(cam, rot, 2) SetCamFov(cam, fov) RenderScriptCams(true, false, 0, 1, 0) isScanned = false scanValue = 0 SendNUIMessage({ - type = "disablescan", + type = 'disablescan', }) end else isScanned = false SendNUIMessage({ - type = "disablescan", + type = 'disablescan', }) locked_on_vehicle = nil -- Cam will auto unlock when entity doesn't exist anyway end else - zoomvalue = (1.0/(fov_max-fov_min))*(fov-fov_min) + zoomvalue = (1.0 / (fov_max - fov_min)) * (fov - fov_min) CheckInputRotation(cam, zoomvalue) vehicle_detected = GetVehicleInView(cam) if DoesEntityExist(vehicle_detected) then @@ -240,7 +240,7 @@ CreateThread(function() end HandleZoom(cam) HideHUDThisFrame() - PushScaleformMovieFunction(scaleform, "SET_ALT_FOV_HEADING") + PushScaleformMovieFunction(scaleform, 'SET_ALT_FOV_HEADING') PushScaleformMovieFunctionParameterFloat(GetEntityCoords(heli).z) PushScaleformMovieFunctionParameterFloat(zoomvalue) PushScaleformMovieFunctionParameterFloat(GetCamRot(cam, 2).z) @@ -250,7 +250,7 @@ CreateThread(function() end helicam = false ClearTimecycleModifier() - fov = (fov_max+fov_min)*0.5 -- reset to starting zoom level + fov = (fov_max + fov_min) * 0.5 -- reset to starting zoom level RenderScriptCams(false, false, 0, 1, 0) -- Return to gameplay camera SetScaleformMovieAsNoLongerNeeded(scaleform) -- Cleanly release the scaleform DestroyCam(cam, false) @@ -277,11 +277,11 @@ CreateThread(function() if scanValue < 100 then scanValue = scanValue + 1 SendNUIMessage({ - type = "heliscan", + type = 'heliscan', scanvalue = scanValue, }) if scanValue == 100 then - PlaySoundFrontend(-1, "SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET", false) + PlaySoundFrontend(-1, 'SELECT', 'HUD_FRONTEND_DEFAULT_SOUNDSET', false) locked_on_vehicle = vehicle_detected isScanning = false isScanned = true diff --git a/client/interactions.lua b/client/interactions.lua index 24d75b41..17af19ea 100644 --- a/client/interactions.lua +++ b/client/interactions.lua @@ -21,7 +21,7 @@ local function IsTargetDead(playerId) hasReturned = true end, playerId) while not hasReturned do - Wait(10) + Wait(10) end return retval end @@ -29,31 +29,31 @@ end local function HandCuffAnimation() local ped = PlayerPedId() if isHandcuffed == true then - TriggerServerEvent("InteractSound_SV:PlayOnSource", "Cuff", 0.2) + TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Cuff', 0.2) else - TriggerServerEvent("InteractSound_SV:PlayOnSource", "Uncuff", 0.2) + TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Uncuff', 0.2) end - loadAnimDict("mp_arrest_paired") - Wait(100) - TaskPlayAnim(ped, "mp_arrest_paired", "cop_p2_back_right", 3.0, 3.0, -1, 48, 0, 0, 0, 0) - TriggerServerEvent("InteractSound_SV:PlayOnSource", "Cuff", 0.2) - Wait(3500) - TaskPlayAnim(ped, "mp_arrest_paired", "exit", 3.0, 3.0, -1, 48, 0, 0, 0, 0) + loadAnimDict('mp_arrest_paired') + Wait(100) + TaskPlayAnim(ped, 'mp_arrest_paired', 'cop_p2_back_right', 3.0, 3.0, -1, 48, 0, 0, 0, 0) + TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Cuff', 0.2) + Wait(3500) + TaskPlayAnim(ped, 'mp_arrest_paired', 'exit', 3.0, 3.0, -1, 48, 0, 0, 0, 0) end local function GetCuffedAnimation(playerId) local ped = PlayerPedId() local cuffer = GetPlayerPed(GetPlayerFromServerId(playerId)) local heading = GetEntityHeading(cuffer) - TriggerServerEvent("InteractSound_SV:PlayOnSource", "Cuff", 0.2) - loadAnimDict("mp_arrest_paired") + TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Cuff', 0.2) + loadAnimDict('mp_arrest_paired') SetEntityCoords(ped, GetOffsetFromEntityInWorldCoords(cuffer, 0.0, 0.45, 0.0)) - Wait(100) - SetEntityHeading(ped, heading) - TaskPlayAnim(ped, "mp_arrest_paired", "crook_p2_back_right", 3.0, 3.0, -1, 32, 0, 0, 0, 0 ,true, true, true) - Wait(2500) + Wait(100) + SetEntityHeading(ped, heading) + TaskPlayAnim(ped, 'mp_arrest_paired', 'crook_p2_back_right', 3.0, 3.0, -1, 32, 0, 0, 0, 0, true, true, true) + Wait(2500) end -- Events @@ -90,10 +90,10 @@ RegisterNetEvent('police:client:SearchPlayer', function() local player, distance = QBCore.Functions.GetClosestPlayer() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) - TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", playerId) - TriggerServerEvent("police:server:SearchPlayer", playerId) + TriggerServerEvent('inventory:server:OpenInventory', 'otherplayer', playerId) + TriggerServerEvent('police:server:SearchPlayer', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -101,9 +101,9 @@ RegisterNetEvent('police:client:SeizeCash', function() local player, distance = QBCore.Functions.GetClosestPlayer() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) - TriggerServerEvent("police:server:SeizeCash", playerId) + TriggerServerEvent('police:server:SeizeCash', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -111,9 +111,9 @@ RegisterNetEvent('police:client:SeizeDriverLicense', function() local player, distance = QBCore.Functions.GetClosestPlayer() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) - TriggerServerEvent("police:server:SeizeDriverLicense", playerId) + TriggerServerEvent('police:server:SeizeDriverLicense', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -124,33 +124,33 @@ RegisterNetEvent('police:client:RobPlayer', function() if player ~= -1 and distance < 2.5 then local playerPed = GetPlayerPed(player) local playerId = GetPlayerServerId(player) - if IsEntityPlayingAnim(playerPed, "missminuteman_1ig_2", "handsup_base", 3) or IsEntityPlayingAnim(playerPed, "mp_arresting", "idle", 3) or IsTargetDead(playerId) then - QBCore.Functions.Progressbar("robbing_player", Lang:t("progressbar.robbing"), math.random(5000, 7000), false, true, { + if IsEntityPlayingAnim(playerPed, 'missminuteman_1ig_2', 'handsup_base', 3) or IsEntityPlayingAnim(playerPed, 'mp_arresting', 'idle', 3) or IsTargetDead(playerId) then + QBCore.Functions.Progressbar('robbing_player', Lang:t('progressbar.robbing'), math.random(5000, 7000), false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "random@shop_robbery", - anim = "robbery_action_b", + animDict = 'random@shop_robbery', + anim = 'robbery_action_b', flags = 16, }, {}, {}, function() -- Done local plyCoords = GetEntityCoords(playerPed) local pos = GetEntityCoords(ped) if #(pos - plyCoords) < 2.5 then - StopAnimTask(ped, "random@shop_robbery", "robbery_action_b", 1.0) - TriggerServerEvent("inventory:server:OpenInventory", "otherplayer", playerId) - TriggerEvent("inventory:server:RobPlayer", playerId) + StopAnimTask(ped, 'random@shop_robbery', 'robbery_action_b', 1.0) + TriggerServerEvent('inventory:server:OpenInventory', 'otherplayer', playerId) + TriggerEvent('inventory:server:RobPlayer', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end, function() -- Cancel - StopAnimTask(ped, "random@shop_robbery", "robbery_action_b", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(ped, 'random@shop_robbery', 'robbery_action_b', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -164,19 +164,19 @@ RegisterNetEvent('police:client:JailPlayer', function() inputs = { { text = Lang:t('info.time_months'), - name = "jailtime", - type = "number", + name = 'jailtime', + type = 'number', isRequired = true } } }) if tonumber(dialog['jailtime']) > 0 then - TriggerServerEvent("police:server:JailPlayer", playerId, tonumber(dialog['jailtime'])) + TriggerServerEvent('police:server:JailPlayer', playerId, tonumber(dialog['jailtime'])) else - QBCore.Functions.Notify(Lang:t("error.time_higher"), "error") + QBCore.Functions.Notify(Lang:t('error.time_higher'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -190,19 +190,19 @@ RegisterNetEvent('police:client:BillPlayer', function() inputs = { { text = Lang:t('info.amount'), - name = "bill", - type = "number", + name = 'bill', + type = 'number', isRequired = true } } }) if tonumber(dialog['bill']) > 0 then - TriggerServerEvent("police:server:BillPlayer", playerId, tonumber(dialog['bill'])) + TriggerServerEvent('police:server:BillPlayer', playerId, tonumber(dialog['bill'])) else - QBCore.Functions.Notify(Lang:t("error.amount_higher"), "error") + QBCore.Functions.Notify(Lang:t('error.amount_higher'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -211,10 +211,10 @@ RegisterNetEvent('police:client:PutPlayerInVehicle', function() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) if not isHandcuffed and not isEscorted then - TriggerServerEvent("police:server:PutPlayerInVehicle", playerId) + TriggerServerEvent('police:server:PutPlayerInVehicle', playerId) end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -223,10 +223,10 @@ RegisterNetEvent('police:client:SetPlayerOutVehicle', function() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) if not isHandcuffed and not isEscorted then - TriggerServerEvent("police:server:SetPlayerOutVehicle", playerId) + TriggerServerEvent('police:server:SetPlayerOutVehicle', playerId) end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -235,10 +235,10 @@ RegisterNetEvent('police:client:EscortPlayer', function() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) if not isHandcuffed and not isEscorted then - TriggerServerEvent("police:server:EscortPlayer", playerId) + TriggerServerEvent('police:server:EscortPlayer', playerId) end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -248,11 +248,11 @@ RegisterNetEvent('police:client:KidnapPlayer', function() local playerId = GetPlayerServerId(player) if not IsPedInAnyVehicle(GetPlayerPed(player)) then if not isHandcuffed and not isEscorted then - TriggerServerEvent("police:server:KidnapPlayer", playerId) + TriggerServerEvent('police:server:KidnapPlayer', playerId) end end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) @@ -262,13 +262,13 @@ RegisterNetEvent('police:client:CuffPlayerSoft', function() if player ~= -1 and distance < 1.5 then local playerId = GetPlayerServerId(player) if not IsPedInAnyVehicle(GetPlayerPed(player)) and not IsPedInAnyVehicle(PlayerPedId()) then - TriggerServerEvent("police:server:CuffPlayer", playerId, true) + TriggerServerEvent('police:server:CuffPlayer', playerId, true) HandCuffAnimation() else - QBCore.Functions.Notify(Lang:t("error.vehicle_cuff"), "error") + QBCore.Functions.Notify(Lang:t('error.vehicle_cuff'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end else Wait(2000) @@ -283,16 +283,16 @@ RegisterNetEvent('police:client:CuffPlayer', function() if result then local playerId = GetPlayerServerId(player) if not IsPedInAnyVehicle(GetPlayerPed(player)) and not IsPedInAnyVehicle(PlayerPedId()) then - TriggerServerEvent("police:server:CuffPlayer", playerId, false) + TriggerServerEvent('police:server:CuffPlayer', playerId, false) HandCuffAnimation() else - QBCore.Functions.Notify(Lang:t("error.vehicle_cuff"), "error") + QBCore.Functions.Notify(Lang:t('error.vehicle_cuff'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.no_cuff"), "error") + QBCore.Functions.Notify(Lang:t('error.no_cuff'), 'error') end else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end else Wait(2000) @@ -302,7 +302,7 @@ end) RegisterNetEvent('police:client:GetEscorted', function(playerId) local ped = PlayerPedId() QBCore.Functions.GetPlayerData(function(PlayerData) - if PlayerData.metadata["isdead"] or isHandcuffed or PlayerData.metadata["inlaststand"] then + if PlayerData.metadata['isdead'] or isHandcuffed or PlayerData.metadata['inlaststand'] then if not isEscorted then isEscorted = true local dragger = GetPlayerPed(GetPlayerFromServerId(playerId)) @@ -326,17 +326,17 @@ end) RegisterNetEvent('police:client:GetKidnappedTarget', function(playerId) local ped = PlayerPedId() QBCore.Functions.GetPlayerData(function(PlayerData) - if PlayerData.metadata["isdead"] or PlayerData.metadata["inlaststand"] or isHandcuffed then + if PlayerData.metadata['isdead'] or PlayerData.metadata['inlaststand'] or isHandcuffed then if not isEscorted then isEscorted = true local dragger = GetPlayerPed(GetPlayerFromServerId(playerId)) - RequestAnimDict("nm") + RequestAnimDict('nm') - while not HasAnimDictLoaded("nm") do + while not HasAnimDictLoaded('nm') do Wait(10) end AttachEntityToEntity(ped, dragger, 0, 0.27, 0.15, 0.63, 0.5, 0.5, 0.0, false, false, false, false, 2, false) - TaskPlayAnim(ped, "nm", "firemans_carry", 8.0, -8.0, 100000, 33, 0, false, false, false) + TaskPlayAnim(ped, 'nm', 'firemans_carry', 8.0, -8.0, 100000, 33, 0, false, false, false) else isEscorted = false DetachEntity(ped, true, false) @@ -351,12 +351,12 @@ RegisterNetEvent('police:client:GetKidnappedDragger', function() QBCore.Functions.GetPlayerData(function(_) if not isEscorting then local dragger = PlayerPedId() - RequestAnimDict("missfinale_c2mcs_1") + RequestAnimDict('missfinale_c2mcs_1') - while not HasAnimDictLoaded("missfinale_c2mcs_1") do + while not HasAnimDictLoaded('missfinale_c2mcs_1') do Wait(10) end - TaskPlayAnim(dragger, "missfinale_c2mcs_1", "fin_c2_mcs_1_camman", 8.0, -8.0, 100000, 49, 0, false, false, false) + TaskPlayAnim(dragger, 'missfinale_c2mcs_1', 'fin_c2_mcs_1_camman', 8.0, -8.0, 100000, 49, 0, false, false, false) isEscorting = true else local dragger = PlayerPedId() @@ -373,7 +373,7 @@ RegisterNetEvent('police:client:GetCuffed', function(playerId, isSoftcuff) local ped = PlayerPedId() if not isHandcuffed then isHandcuffed = true - TriggerServerEvent("police:server:SetHandcuffStatus", true) + TriggerServerEvent('police:server:SetHandcuffStatus', true) ClearPedTasksImmediately(ped) if GetSelectedPedWeapon(ped) ~= `WEAPON_UNARMED` then SetCurrentPedWeapon(ped, `WEAPON_UNARMED`, true) @@ -381,21 +381,21 @@ RegisterNetEvent('police:client:GetCuffed', function(playerId, isSoftcuff) if not isSoftcuff then cuffType = 16 GetCuffedAnimation(playerId) - QBCore.Functions.Notify(Lang:t("info.cuff"), 'primary') + QBCore.Functions.Notify(Lang:t('info.cuff'), 'primary') else cuffType = 49 GetCuffedAnimation(playerId) - QBCore.Functions.Notify(Lang:t("info.cuffed_walk"), 'primary') + QBCore.Functions.Notify(Lang:t('info.cuffed_walk'), 'primary') end else isHandcuffed = false isEscorted = false TriggerEvent('hospital:client:isEscorted', isEscorted) DetachEntity(ped, true, false) - TriggerServerEvent("police:server:SetHandcuffStatus", false) + TriggerServerEvent('police:server:SetHandcuffStatus', false) ClearPedTasksImmediately(ped) - TriggerServerEvent("InteractSound_SV:PlayOnSource", "Uncuff", 0.2) - QBCore.Functions.Notify(Lang:t("success.uncuffed"),"success") + TriggerServerEvent('InteractSound_SV:PlayOnSource', 'Uncuff', 0.2) + QBCore.Functions.Notify(Lang:t('success.uncuffed'), 'success') end end) @@ -406,7 +406,7 @@ CreateThread(function() if isEscorted then DisableAllControlActions(0) EnableControlAction(0, 1, true) - EnableControlAction(0, 2, true) + EnableControlAction(0, 2, true) EnableControlAction(0, 245, true) EnableControlAction(0, 38, true) EnableControlAction(0, 322, true) @@ -416,45 +416,45 @@ CreateThread(function() if isHandcuffed then DisableControlAction(0, 24, true) -- Attack - DisableControlAction(0, 257, true) -- Attack 2 - DisableControlAction(0, 25, true) -- Aim - DisableControlAction(0, 263, true) -- Melee Attack 1 - - DisableControlAction(0, 45, true) -- Reload - DisableControlAction(0, 22, true) -- Jump - DisableControlAction(0, 44, true) -- Cover - DisableControlAction(0, 37, true) -- Select Weapon - DisableControlAction(0, 23, true) -- Also 'enter'? - - DisableControlAction(0, 288, true) -- Disable phone - DisableControlAction(0, 289, true) -- Inventory - DisableControlAction(0, 170, true) -- Animations - DisableControlAction(0, 167, true) -- Job - - DisableControlAction(0, 26, true) -- Disable looking behind - DisableControlAction(0, 73, true) -- Disable clearing animation - DisableControlAction(2, 199, true) -- Disable pause screen - - DisableControlAction(0, 59, true) -- Disable steering in vehicle - DisableControlAction(0, 71, true) -- Disable driving forward in vehicle - DisableControlAction(0, 72, true) -- Disable reversing in vehicle - - DisableControlAction(2, 36, true) -- Disable going stealth - - DisableControlAction(0, 264, true) -- Disable melee - DisableControlAction(0, 257, true) -- Disable melee - DisableControlAction(0, 140, true) -- Disable melee - DisableControlAction(0, 141, true) -- Disable melee - DisableControlAction(0, 142, true) -- Disable melee - DisableControlAction(0, 143, true) -- Disable melee - DisableControlAction(0, 75, true) -- Disable exit vehicle - DisableControlAction(27, 75, true) -- Disable exit vehicle + DisableControlAction(0, 257, true) -- Attack 2 + DisableControlAction(0, 25, true) -- Aim + DisableControlAction(0, 263, true) -- Melee Attack 1 + + DisableControlAction(0, 45, true) -- Reload + DisableControlAction(0, 22, true) -- Jump + DisableControlAction(0, 44, true) -- Cover + DisableControlAction(0, 37, true) -- Select Weapon + DisableControlAction(0, 23, true) -- Also 'enter'? + + DisableControlAction(0, 288, true) -- Disable phone + DisableControlAction(0, 289, true) -- Inventory + DisableControlAction(0, 170, true) -- Animations + DisableControlAction(0, 167, true) -- Job + + DisableControlAction(0, 26, true) -- Disable looking behind + DisableControlAction(0, 73, true) -- Disable clearing animation + DisableControlAction(2, 199, true) -- Disable pause screen + + DisableControlAction(0, 59, true) -- Disable steering in vehicle + DisableControlAction(0, 71, true) -- Disable driving forward in vehicle + DisableControlAction(0, 72, true) -- Disable reversing in vehicle + + DisableControlAction(2, 36, true) -- Disable going stealth + + DisableControlAction(0, 264, true) -- Disable melee + DisableControlAction(0, 257, true) -- Disable melee + DisableControlAction(0, 140, true) -- Disable melee + DisableControlAction(0, 141, true) -- Disable melee + DisableControlAction(0, 142, true) -- Disable melee + DisableControlAction(0, 143, true) -- Disable melee + DisableControlAction(0, 75, true) -- Disable exit vehicle + DisableControlAction(27, 75, true) -- Disable exit vehicle EnableControlAction(0, 249, true) -- Added for talking while cuffed EnableControlAction(0, 46, true) -- Added for talking while cuffed - if (not IsEntityPlayingAnim(PlayerPedId(), "mp_arresting", "idle", 3) and not IsEntityPlayingAnim(PlayerPedId(), "mp_arrest_paired", "crook_p2_back_right", 3)) and not QBCore.Functions.GetPlayerData().metadata["isdead"] then - loadAnimDict("mp_arresting") - TaskPlayAnim(PlayerPedId(), "mp_arresting", "idle", 8.0, -8, -1, cuffType, 0, 0, 0, 0) + if (not IsEntityPlayingAnim(PlayerPedId(), 'mp_arresting', 'idle', 3) and not IsEntityPlayingAnim(PlayerPedId(), 'mp_arrest_paired', 'crook_p2_back_right', 3)) and not QBCore.Functions.GetPlayerData().metadata['isdead'] then + loadAnimDict('mp_arresting') + TaskPlayAnim(PlayerPedId(), 'mp_arresting', 'idle', 8.0, -8, -1, cuffType, 0, 0, 0, 0) end end if not isHandcuffed and not isEscorted then diff --git a/client/job.lua b/client/job.lua index 16ef593d..94c37087 100644 --- a/client/job.lua +++ b/client/job.lua @@ -8,6 +8,7 @@ local inArmoury = false local inHelicopter = false local inImpound = false local inGarage = false +local inEvidence = false local function loadAnimDict(dict) -- interactions, job, while (not HasAnimDictLoaded(dict)) do @@ -39,92 +40,94 @@ end local function openFingerprintUI() SendNUIMessage({ - type = "fingerprintOpen" + type = 'fingerprintOpen' }) inFingerprint = true SetNuiFocus(true, true) end local function SetCarItemsInfo() - local items = {} - for _, item in pairs(Config.CarItems) do - local itemInfo = QBCore.Shared.Items[item.name:lower()] - items[item.slot] = { - name = itemInfo["name"], - amount = tonumber(item.amount), - info = item.info, - label = itemInfo["label"], - description = itemInfo["description"] and itemInfo["description"] or "", - weight = itemInfo["weight"], - type = itemInfo["type"], - unique = itemInfo["unique"], - useable = itemInfo["useable"], - image = itemInfo["image"], - slot = item.slot, - } - end - Config.CarItems = items + local items = {} + for _, item in pairs(Config.CarItems) do + local itemInfo = QBCore.Shared.Items[item.name:lower()] + if itemInfo then + items[#items + 1] = { + name = itemInfo.name, + amount = tonumber(item.amount), + info = item.info or {}, + label = itemInfo.label, + description = itemInfo.description or '', + weight = itemInfo.weight, + type = itemInfo.type, + unique = itemInfo.unique, + useable = itemInfo.useable, + image = itemInfo.image, + slot = #items + 1, + } + end + end + Config.CarItems = items end local function doCarDamage(currentVehicle, veh) - local smash = false - local damageOutside = false - local damageOutside2 = false - local engine = veh.engine + 0.0 - local body = veh.body + 0.0 - - if engine < 200.0 then engine = 200.0 end - if engine > 1000.0 then engine = 950.0 end - if body < 150.0 then body = 150.0 end - if body < 950.0 then smash = true end - if body < 920.0 then damageOutside = true end - if body < 920.0 then damageOutside2 = true end + local smash = false + local damageOutside = false + local damageOutside2 = false + local engine = veh.engine + 0.0 + local body = veh.body + 0.0 + + if engine < 200.0 then engine = 200.0 end + if engine > 1000.0 then engine = 950.0 end + if body < 150.0 then body = 150.0 end + if body < 950.0 then smash = true end + if body < 920.0 then damageOutside = true end + if body < 920.0 then damageOutside2 = true end Wait(100) SetVehicleEngineHealth(currentVehicle, engine) - if smash then - SmashVehicleWindow(currentVehicle, 0) - SmashVehicleWindow(currentVehicle, 1) - SmashVehicleWindow(currentVehicle, 2) - SmashVehicleWindow(currentVehicle, 3) - SmashVehicleWindow(currentVehicle, 4) - end - - if damageOutside then - SetVehicleDoorBroken(currentVehicle, 1, true) - SetVehicleDoorBroken(currentVehicle, 6, true) - SetVehicleDoorBroken(currentVehicle, 4, true) - end - - if damageOutside2 then - SetVehicleTyreBurst(currentVehicle, 1, false, 990.0) - SetVehicleTyreBurst(currentVehicle, 2, false, 990.0) - SetVehicleTyreBurst(currentVehicle, 3, false, 990.0) - SetVehicleTyreBurst(currentVehicle, 4, false, 990.0) - end - - if body < 1000 then - SetVehicleBodyHealth(currentVehicle, 985.1) - end + if smash then + SmashVehicleWindow(currentVehicle, 0) + SmashVehicleWindow(currentVehicle, 1) + SmashVehicleWindow(currentVehicle, 2) + SmashVehicleWindow(currentVehicle, 3) + SmashVehicleWindow(currentVehicle, 4) + end + + if damageOutside then + SetVehicleDoorBroken(currentVehicle, 1, true) + SetVehicleDoorBroken(currentVehicle, 6, true) + SetVehicleDoorBroken(currentVehicle, 4, true) + end + + if damageOutside2 then + SetVehicleTyreBurst(currentVehicle, 1, false, 990.0) + SetVehicleTyreBurst(currentVehicle, 2, false, 990.0) + SetVehicleTyreBurst(currentVehicle, 3, false, 990.0) + SetVehicleTyreBurst(currentVehicle, 4, false, 990.0) + end + + if body < 1000 then + SetVehicleBodyHealth(currentVehicle, 985.1) + end end function TakeOutImpound(vehicle) - local coords = Config.Locations["impound"][currentGarage] + local coords = Config.Locations['impound'][currentGarage] if coords then QBCore.Functions.TriggerCallback('QBCore:Server:SpawnVehicle', function(netId) local veh = NetToVeh(netId) QBCore.Functions.TriggerCallback('qb-garage:server:GetVehicleProperties', function(properties) QBCore.Functions.SetVehicleProperties(veh, properties) SetVehicleNumberPlateText(veh, vehicle.plate) - SetVehicleDirtLevel(veh, 0.0) + SetVehicleDirtLevel(veh, 0.0) SetEntityHeading(veh, coords.w) - exports['LegacyFuel']:SetFuel(veh, vehicle.fuel) + exports[Config.FuelResource]:SetFuel(veh, vehicle.fuel) doCarDamage(veh, vehicle) TriggerServerEvent('police:server:TakeOutImpound', vehicle.plate, currentGarage) closeMenuFull() TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) - TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh)) + TriggerEvent('vehiclekeys:client:SetOwner', QBCore.Functions.GetPlate(veh)) SetVehicleEngineOn(veh, true, true) end, vehicle.plate) end, vehicle.vehicle, coords, true) @@ -132,48 +135,31 @@ function TakeOutImpound(vehicle) end function TakeOutVehicle(vehicleInfo) - local coords = Config.Locations["vehicle"][currentGarage] + local coords = Config.Locations['vehicle'][currentGarage] if coords then QBCore.Functions.TriggerCallback('QBCore:Server:SpawnVehicle', function(netId) local veh = NetToVeh(netId) SetCarItemsInfo() - SetVehicleNumberPlateText(veh, Lang:t('info.police_plate')..tostring(math.random(1000, 9999))) + SetVehicleNumberPlateText(veh, Lang:t('info.police_plate') .. tostring(math.random(1000, 9999))) SetEntityHeading(veh, coords.w) - exports['LegacyFuel']:SetFuel(veh, 100.0) + exports[Config.FuelResource]:SetFuel(veh, 100.0) closeMenuFull() if Config.VehicleSettings[vehicleInfo] ~= nil then if Config.VehicleSettings[vehicleInfo].extras ~= nil then - QBCore.Shared.SetDefaultVehicleExtras(veh, Config.VehicleSettings[vehicleInfo].extras) - end - if Config.VehicleSettings[vehicleInfo].livery ~= nil then - SetVehicleLivery(veh, Config.VehicleSettings[vehicleInfo].livery) - end + QBCore.Shared.SetDefaultVehicleExtras(veh, Config.VehicleSettings[vehicleInfo].extras) + end + if Config.VehicleSettings[vehicleInfo].livery ~= nil then + SetVehicleLivery(veh, Config.VehicleSettings[vehicleInfo].livery) + end end TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) - TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh)) - TriggerServerEvent("inventory:server:addTrunkItems", QBCore.Functions.GetPlate(veh), Config.CarItems) + TriggerEvent('vehiclekeys:client:SetOwner', QBCore.Functions.GetPlate(veh)) + TriggerServerEvent('inventory:server:addTrunkItems', QBCore.Functions.GetPlate(veh), Config.CarItems) SetVehicleEngineOn(veh, true, true) end, vehicleInfo, coords, true) end end -local function IsArmoryWhitelist() -- being removed - local retval = false - - if QBCore.Functions.GetPlayerData().job.name == 'police' then - retval = true - end - return retval -end - -local function SetWeaponSeries() - for k, _ in pairs(Config.Items.items) do - if k < 6 then - Config.Items.items[k].info.serie = tostring(QBCore.Shared.RandomInt(2) .. QBCore.Shared.RandomStr(3) .. QBCore.Shared.RandomInt(1) .. QBCore.Shared.RandomStr(2) .. QBCore.Shared.RandomInt(3) .. QBCore.Shared.RandomStr(4)) - end - end -end - function MenuGarage(currentSelection) local vehicleMenu = { { @@ -182,42 +168,31 @@ function MenuGarage(currentSelection) } } - local authorizedVehicles = Config.AuthorizedVehicles[QBCore.Functions.GetPlayerData().job.grade.level] - for veh, label in pairs(authorizedVehicles) do - vehicleMenu[#vehicleMenu+1] = { - header = label, - txt = "", - params = { - event = "police:client:TakeOutVehicle", - args = { - vehicle = veh, - currentSelection = currentSelection - } - } - } - end - - if IsArmoryWhitelist() then - for veh, label in pairs(Config.WhitelistedVehicles) do - vehicleMenu[#vehicleMenu+1] = { - header = label, - txt = "", - params = { - event = "police:client:TakeOutVehicle", - args = { - vehicle = veh, - currentSelection = currentSelection + local playerGrade = QBCore.Functions.GetPlayerData().job.grade.level + for grade = 0, playerGrade do + local authorizedVehicles = Config.AuthorizedVehicles[grade] + if authorizedVehicles then + for veh, label in pairs(authorizedVehicles) do + vehicleMenu[#vehicleMenu + 1] = { + header = label, + txt = '', + params = { + event = 'police:client:TakeOutVehicle', + args = { + vehicle = veh, + currentSelection = currentSelection + } } } - } + end end end - vehicleMenu[#vehicleMenu+1] = { + vehicleMenu[#vehicleMenu + 1] = { header = Lang:t('menu.close'), - txt = "", + txt = '', params = { - event = "qb-menu:client:closeMenu" + event = 'qb-menu:client:closeMenu' } } @@ -231,22 +206,22 @@ function MenuImpound(currentSelection) isMenuHeader = true } } - QBCore.Functions.TriggerCallback("police:GetImpoundedVehicles", function(result) + QBCore.Functions.TriggerCallback('police:GetImpoundedVehicles', function(result) local shouldContinue = false if result == nil then - QBCore.Functions.Notify(Lang:t("error.no_impound"), "error", 5000) + QBCore.Functions.Notify(Lang:t('error.no_impound'), 'error', 5000) else shouldContinue = true - for _ , v in pairs(result) do + for _, v in pairs(result) do local enginePercent = QBCore.Shared.Round(v.engine / 10, 0) local currentFuel = v.fuel local vname = QBCore.Shared.Vehicles[v.vehicle].name - impoundMenu[#impoundMenu+1] = { - header = vname.." ["..v.plate.."]", - txt = Lang:t('info.vehicle_info', {value = enginePercent, value2 = currentFuel}), + impoundMenu[#impoundMenu + 1] = { + header = vname .. ' [' .. v.plate .. ']', + txt = Lang:t('info.vehicle_info', { value = enginePercent, value2 = currentFuel }), params = { - event = "police:client:TakeOutImpound", + event = 'police:client:TakeOutImpound', args = { vehicle = v, currentSelection = currentSelection @@ -256,19 +231,17 @@ function MenuImpound(currentSelection) end end - if shouldContinue then - impoundMenu[#impoundMenu+1] = { + impoundMenu[#impoundMenu + 1] = { header = Lang:t('menu.close'), - txt = "", + txt = '', params = { - event = "qb-menu:client:closeMenu" + event = 'qb-menu:client:closeMenu' } } exports['qb-menu']:openMenu(impoundMenu) end end) - end function closeMenuFull() @@ -290,30 +263,30 @@ end) RegisterNetEvent('police:client:showFingerprintId', function(fid) SendNUIMessage({ - type = "updateFingerprintId", + type = 'updateFingerprintId', fingerprintId = fid }) - PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1) + PlaySound(-1, 'Event_Start_Text', 'GTAO_FM_Events_Soundset', 0, 0, 1) end) RegisterNUICallback('doFingerScan', function(_, cb) TriggerServerEvent('police:server:showFingerprintId', FingerPrintSessionId) - cb("ok") + cb('ok') end) RegisterNetEvent('police:client:SendEmergencyMessage', function(coords, message) - TriggerServerEvent("police:server:SendEmergencyMessage", coords, message) - TriggerEvent("police:client:CallAnim") + TriggerServerEvent('police:server:SendEmergencyMessage', coords, message) + TriggerEvent('police:client:CallAnim') end) RegisterNetEvent('police:client:EmergencySound', function() - PlaySound(-1, "Event_Start_Text", "GTAO_FM_Events_Soundset", 0, 0, 1) + PlaySound(-1, 'Event_Start_Text', 'GTAO_FM_Events_Soundset', 0, 0, 1) end) RegisterNetEvent('police:client:CallAnim', function() local isCalling = true local callCount = 5 - loadAnimDict("cellphone@") + loadAnimDict('cellphone@') TaskPlayAnim(PlayerPedId(), 'cellphone@', 'cellphone_call_listen_base', 3.0, -1, -1, 49, 0, false, false, false) Wait(1000) CreateThread(function() @@ -332,13 +305,13 @@ RegisterNetEvent('police:client:ImpoundVehicle', function(fullImpound, price) local vehicle = QBCore.Functions.GetClosestVehicle() local bodyDamage = math.ceil(GetVehicleBodyHealth(vehicle)) local engineDamage = math.ceil(GetVehicleEngineHealth(vehicle)) - local totalFuel = exports['LegacyFuel']:GetFuel(vehicle) + local totalFuel = exports[Config.FuelResource]:GetFuel(vehicle) if vehicle ~= 0 and vehicle then local ped = PlayerPedId() local pos = GetEntityCoords(ped) local vehpos = GetEntityCoords(vehicle) if #(pos - vehpos) < 5.0 and not IsPedInAnyVehicle(ped) then - QBCore.Functions.Progressbar('impound', Lang:t('progressbar.impound'), 5000, false, true, { + QBCore.Functions.Progressbar('impound', Lang:t('progressbar.impound'), 5000, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, @@ -352,15 +325,15 @@ RegisterNetEvent('police:client:ImpoundVehicle', function(fullImpound, price) bone = 18905, coords = { x = 0.1, y = 0.02, z = 0.05 }, rotation = { x = 10.0, y = 0.0, z = 0.0 }, - },{ + }, { model = 'prop_pencil_01', bone = 58866, coords = { x = 0.11, y = -0.02, z = 0.001 }, rotation = { x = -120.0, y = 0.0, z = 0.0 }, }, function() -- Play When Done local plate = QBCore.Functions.GetPlate(vehicle) - TriggerServerEvent("police:server:Impound", plate, fullImpound, price, bodyDamage, engineDamage, totalFuel) - while NetworkGetEntityOwner(vehicle) ~= 128 do -- Ensure we have entity ownership to prevent inconsistent vehicle deletion + TriggerServerEvent('police:server:Impound', plate, fullImpound, price, bodyDamage, engineDamage, totalFuel) + while NetworkGetEntityOwner(vehicle) ~= 128 do -- Ensure we have entity ownership to prevent inconsistent vehicle deletion NetworkRequestControlOfEntity(vehicle) Wait(100) end @@ -377,31 +350,31 @@ end) RegisterNetEvent('police:client:CheckStatus', function() QBCore.Functions.GetPlayerData(function(PlayerData) - if PlayerData.job.name == "police" then + if PlayerData.job.type == 'leo' then local player, distance = GetClosestPlayer() if player ~= -1 and distance < 5.0 then local playerId = GetPlayerServerId(player) QBCore.Functions.TriggerCallback('police:GetPlayerStatus', function(result) if result then for _, v in pairs(result) do - QBCore.Functions.Notify(''..v..'') + QBCore.Functions.Notify('' .. v .. '') end end end, playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end end) end) -RegisterNetEvent("police:client:VehicleMenuHeader", function (data) +RegisterNetEvent('police:client:VehicleMenuHeader', function(data) MenuGarage(data.currentSelection) currentGarage = data.currentSelection end) -RegisterNetEvent("police:client:ImpoundMenuHeader", function (data) +RegisterNetEvent('police:client:ImpoundMenuHeader', function(data) MenuImpound(data.currentSelection) currentGarage = data.currentSelection end) @@ -420,17 +393,23 @@ RegisterNetEvent('police:client:TakeOutVehicle', function(data) end end) -RegisterNetEvent('police:client:EvidenceStashDrawer', function(data) - local currentEvidence = data.currentEvidence +RegisterNetEvent('police:client:EvidenceStashDrawer', function() local pos = GetEntityCoords(PlayerPedId()) - local takeLoc = Config.Locations["evidence"][currentEvidence] + local currentEvidence = 0 + for k, v in pairs(Config.Locations['evidence']) do + if #(pos - v) < 2 then + currentEvidence = k + end + end + local pos = GetEntityCoords(PlayerPedId()) + local takeLoc = Config.Locations['evidence'][currentEvidence] if not takeLoc then return end if #(pos - takeLoc) <= 1.0 then local drawer = exports['qb-input']:ShowInput({ - header = Lang:t('info.evidence_stash', {value = currentEvidence}), - submitText = "open", + header = Lang:t('info.evidence_stash', { value = currentEvidence }), + submitText = 'open', inputs = { { type = 'number', @@ -442,11 +421,11 @@ RegisterNetEvent('police:client:EvidenceStashDrawer', function(data) }) if drawer then if not drawer.slot then return end - TriggerServerEvent("inventory:server:OpenInventory", "stash", Lang:t('info.current_evidence', {value = currentEvidence, value2 = drawer.slot}), { + TriggerServerEvent('inventory:server:OpenInventory', 'stash', Lang:t('info.current_evidence', { value = currentEvidence, value2 = drawer.slot }), { maxweight = 4000000, slots = 500, }) - TriggerEvent("inventory:client:SetCurrentStash", Lang:t('info.current_evidence', {value = currentEvidence, value2 = drawer.slot})) + TriggerEvent('inventory:client:SetCurrentStash', Lang:t('info.current_evidence', { value = currentEvidence, value2 = drawer.slot })) end else exports['qb-menu']:closeMenu() @@ -454,73 +433,81 @@ RegisterNetEvent('police:client:EvidenceStashDrawer', function(data) end) RegisterNetEvent('qb-policejob:ToggleDuty', function() - TriggerServerEvent("QBCore:ToggleDuty") - TriggerServerEvent("police:server:UpdateCurrentCops") - TriggerServerEvent("police:server:UpdateBlips") + TriggerServerEvent('QBCore:ToggleDuty') + TriggerServerEvent('police:server:UpdateCurrentCops') + TriggerServerEvent('police:server:UpdateBlips') end) RegisterNetEvent('qb-police:client:scanFingerPrint', function() local player, distance = GetClosestPlayer() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) - TriggerServerEvent("police:server:showFingerprint", playerId) + TriggerServerEvent('police:server:showFingerprint', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) RegisterNetEvent('qb-police:client:openArmoury', function() - local authorizedItems = { - label = Config.Items.label, - slots = Config.Items.slots, - items = {} - } - local index = 1 - for _, armoryItem in pairs(Config.Items.items) do - for i=1, #armoryItem.authorizedJobGrades do - if armoryItem.authorizedJobGrades[i] == PlayerJob.grade.level then - authorizedItems.items[index] = armoryItem - authorizedItems.items[index].slot = index - index = index + 1 + local authorizedItemsList = {} + local playerGrade = PlayerJob.grade.level + for grade = 0, playerGrade do + if Config.Items[grade] then + for _, item in ipairs(Config.Items[grade]) do + local itemInfo = QBCore.Shared.Items[item.name] + if itemInfo then + authorizedItemsList[#authorizedItemsList + 1] = { + name = item.name, + price = item.price, + amount = item.amount, + info = item.info or {}, + type = itemType, + slot = #authorizedItemsList + 1 + } + end end end end - SetWeaponSeries() - TriggerServerEvent("inventory:server:OpenInventory", "shop", "police", authorizedItems) + local authorizedItems = { + label = 'Police Armory', + slots = #authorizedItemsList, + items = authorizedItemsList + } + TriggerServerEvent('inventory:server:OpenInventory', 'shop', 'police', authorizedItems) end) RegisterNetEvent('qb-police:client:spawnHelicopter', function(k) if IsPedInAnyVehicle(PlayerPedId(), false) then QBCore.Functions.DeleteVehicle(GetVehiclePedIsIn(PlayerPedId())) else - local coords = Config.Locations["helicopter"][k] + local coords = Config.Locations['helicopter'][k] if not coords then coords = GetEntityCoords(PlayerPedId()) end QBCore.Functions.TriggerCallback('QBCore:Server:SpawnVehicle', function(netId) local veh = NetToVeh(netId) - SetVehicleLivery(veh , 0) + SetVehicleLivery(veh, 0) SetVehicleMod(veh, 0, 48) - SetVehicleNumberPlateText(veh, "ZULU"..tostring(math.random(1000, 9999))) + SetVehicleNumberPlateText(veh, 'ZULU' .. tostring(math.random(1000, 9999))) SetEntityHeading(veh, coords.w) - exports['LegacyFuel']:SetFuel(veh, 100.0) + exports[Config.FuelResource]:SetFuel(veh, 100.0) closeMenuFull() TaskWarpPedIntoVehicle(PlayerPedId(), veh, -1) - TriggerEvent("vehiclekeys:client:SetOwner", QBCore.Functions.GetPlate(veh)) + TriggerEvent('vehiclekeys:client:SetOwner', QBCore.Functions.GetPlate(veh)) SetVehicleEngineOn(veh, true, true) end, Config.PoliceHelicopter, coords, true) end end) -RegisterNetEvent("qb-police:client:openStash", function() - TriggerServerEvent("inventory:server:OpenInventory", "stash", "policestash_"..QBCore.Functions.GetPlayerData().citizenid) - TriggerEvent("inventory:client:SetCurrentStash", "policestash_"..QBCore.Functions.GetPlayerData().citizenid) +RegisterNetEvent('qb-police:client:openStash', function() + TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'policestash_' .. QBCore.Functions.GetPlayerData().citizenid) + TriggerEvent('inventory:client:SetCurrentStash', 'policestash_' .. QBCore.Functions.GetPlayerData().citizenid) end) RegisterNetEvent('qb-police:client:openTrash', function() - TriggerServerEvent("inventory:server:OpenInventory", "stash", "policetrash", { + TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'policetrash', { maxweight = 4000000, slots = 300, }) - TriggerEvent("inventory:client:SetCurrentStash", "policetrash") + TriggerEvent('inventory:client:SetCurrentStash', 'policetrash') end) --##### Threads #####-- @@ -530,11 +517,11 @@ local function dutylistener() dutylisten = true CreateThread(function() while dutylisten do - if PlayerJob.name == "police" then + if PlayerJob.type == 'leo' then if IsControlJustReleased(0, 38) then - TriggerServerEvent("QBCore:ToggleDuty") - TriggerServerEvent("police:server:UpdateCurrentCops") - TriggerServerEvent("police:server:UpdateBlips") + TriggerServerEvent('QBCore:ToggleDuty') + TriggerServerEvent('police:server:UpdateCurrentCops') + TriggerServerEvent('police:server:UpdateBlips') dutylisten = false break end @@ -551,11 +538,11 @@ local function stash() CreateThread(function() while true do Wait(0) - if inStash and PlayerJob.name == "police" then + if inStash and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsControlJustReleased(0, 38) then - TriggerServerEvent("inventory:server:OpenInventory", "stash", "policestash_"..QBCore.Functions.GetPlayerData().citizenid) - TriggerEvent("inventory:client:SetCurrentStash", "policestash_"..QBCore.Functions.GetPlayerData().citizenid) + TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'policestash_' .. QBCore.Functions.GetPlayerData().citizenid) + TriggerEvent('inventory:client:SetCurrentStash', 'policestash_' .. QBCore.Functions.GetPlayerData().citizenid) break end else @@ -570,14 +557,14 @@ local function trash() CreateThread(function() while true do Wait(0) - if inTrash and PlayerJob.name == "police" then + if inTrash and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsControlJustReleased(0, 38) then - TriggerServerEvent("inventory:server:OpenInventory", "stash", "policetrash", { + TriggerServerEvent('inventory:server:OpenInventory', 'stash', 'policetrash', { maxweight = 4000000, slots = 300, }) - TriggerEvent("inventory:client:SetCurrentStash", "policetrash") + TriggerEvent('inventory:client:SetCurrentStash', 'policetrash') break end else @@ -592,10 +579,10 @@ local function fingerprint() CreateThread(function() while true do Wait(0) - if inFingerprint and PlayerJob.name == "police" then + if inFingerprint and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsControlJustReleased(0, 38) then - TriggerEvent("qb-police:client:scanFingerPrint") + TriggerEvent('qb-police:client:scanFingerPrint') break end else @@ -610,10 +597,28 @@ local function armoury() CreateThread(function() while true do Wait(0) - if inArmoury and PlayerJob.name == "police" then + if inArmoury and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsControlJustReleased(0, 38) then - TriggerEvent("qb-police:client:openArmoury") + TriggerEvent('qb-police:client:openArmoury') + break + end + else + break + end + end + end) +end + +-- Evidence Thread +local function evidence() + CreateThread(function() + while true do + Wait(0) + if inEvidence and PlayerJob.type == 'leo' then + if PlayerJob.onduty then sleep = 5 end + if IsControlJustReleased(0, 38) then + TriggerEvent('qb-policejob:client:EvidenceStashDrawer') break end else @@ -628,10 +633,10 @@ local function heli() CreateThread(function() while true do Wait(0) - if inHelicopter and PlayerJob.name == "police" then + if inHelicopter and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsControlJustReleased(0, 38) then - TriggerEvent("qb-police:client:spawnHelicopter") + TriggerEvent('qb-police:client:spawnHelicopter') break end else @@ -646,7 +651,7 @@ local function impound() CreateThread(function() while true do Wait(0) - if inImpound and PlayerJob.name == "police" then + if inImpound and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsPedInAnyVehicle(PlayerPedId(), false) then if IsControlJustReleased(0, 38) then @@ -666,7 +671,7 @@ local function garage() CreateThread(function() while true do Wait(0) - if inGarage and PlayerJob.name == "police" then + if inGarage and PlayerJob.type == 'leo' then if PlayerJob.onduty then sleep = 5 end if IsPedInAnyVehicle(PlayerPedId(), false) then if IsControlJustReleased(0, 38) then @@ -684,21 +689,19 @@ end if Config.UseTarget then CreateThread(function() -- Toggle Duty - for k, v in pairs(Config.Locations["duty"]) do - exports['qb-target']:AddBoxZone("PoliceDuty_"..k, vector3(v.x, v.y, v.z), 1, 1, { - name = "PoliceDuty_"..k, - heading = 11, + for k, v in pairs(Config.Locations['duty']) do + exports['qb-target']:AddCircleZone('PoliceDuty_' .. k, vector3(v.x, v.y, v.z), 0.5, { + name = 'PoliceDuty_' .. k, + useZ = true, debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, }, { options = { { - type = "client", - event = "qb-policejob:ToggleDuty", - icon = "fas fa-sign-in-alt", - label = "Sign In", - job = "police", + type = 'client', + event = 'qb-policejob:ToggleDuty', + icon = 'fas fa-sign-in-alt', + label = 'Sign In', + jobType = 'leo', }, }, distance = 1.5 @@ -706,21 +709,19 @@ if Config.UseTarget then end -- Personal Stash - for k, v in pairs(Config.Locations["stash"]) do - exports['qb-target']:AddBoxZone("PoliceStash_"..k, vector3(v.x, v.y, v.z), 1.5, 1.5, { - name = "PoliceStash_"..k, - heading = 11, + for k, v in pairs(Config.Locations['stash']) do + exports['qb-target']:AddCircleZone('PoliceStash_' .. k, vector3(v.x, v.y, v.z), 1.0, { + name = 'PoliceStash_' .. k, + useZ = true, debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, }, { options = { { - type = "client", - event = "qb-police:client:openStash", - icon = "fas fa-dungeon", - label = "Open Personal Stash", - job = "police", + type = 'client', + event = 'qb-police:client:openStash', + icon = 'fas fa-dungeon', + label = 'Open Personal Stash', + jobType = 'leo', }, }, distance = 1.5 @@ -728,21 +729,19 @@ if Config.UseTarget then end -- Police Trash - for k, v in pairs(Config.Locations["trash"]) do - exports['qb-target']:AddBoxZone("PoliceTrash_"..k, vector3(v.x, v.y, v.z), 1, 1.75, { - name = "PoliceTrash_"..k, - heading = 11, + for k, v in pairs(Config.Locations['trash']) do + exports['qb-target']:AddCircleZone('PoliceTrash_' .. k, vector3(v.x, v.y, v.z), 0.5, { + name = 'PoliceTrash_' .. k, + useZ = true, debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, }, { options = { { - type = "client", - event = "qb-police:client:openTrash", - icon = "fas fa-trash", - label = "Open Trash", - job = "police", + type = 'client', + event = 'qb-police:client:openTrash', + icon = 'fas fa-trash', + label = 'Open Trash', + jobType = 'leo', }, }, distance = 1.5 @@ -750,21 +749,19 @@ if Config.UseTarget then end -- Fingerprint - for k, v in pairs(Config.Locations["fingerprint"]) do - exports['qb-target']:AddBoxZone("PoliceFingerprint_"..k, vector3(v.x, v.y, v.z), 2, 1, { - name = "PoliceFingerprint_"..k, - heading = 11, + for k, v in pairs(Config.Locations['fingerprint']) do + exports['qb-target']:AddCircleZone('PoliceFingerprint_' .. k, vector3(v.x, v.y, v.z), 0.5, { + name = 'PoliceFingerprint_' .. k, + useZ = true, debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, }, { options = { { - type = "client", - event = "qb-police:client:scanFingerPrint", - icon = "fas fa-fingerprint", - label = "Open Fingerprint", - job = "police", + type = 'client', + event = 'qb-police:client:scanFingerPrint', + icon = 'fas fa-fingerprint', + label = 'Open Fingerprint', + jobType = 'leo', }, }, distance = 1.5 @@ -772,52 +769,67 @@ if Config.UseTarget then end -- Armoury - for k, v in pairs(Config.Locations["armory"]) do - exports['qb-target']:AddBoxZone("PoliceArmory_"..k, vector3(v.x, v.y, v.z), 5, 1, { - name = "PoliceArmory_"..k, - heading = 11, + for k, v in pairs(Config.Locations['armory']) do + exports['qb-target']:AddCircleZone('PoliceArmory_' .. k, vector3(v.x, v.y, v.z), 1.0, { + name = 'PoliceArmory_' .. k, + useZ = true, debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, }, { options = { { - type = "client", - event = "qb-police:client:openArmoury", - icon = "fas fa-swords", - label = "Open Armory", - job = "police", + type = 'client', + event = 'qb-police:client:openArmoury', + icon = 'fas fa-gun', + label = 'Open Armory', + jobType = 'leo', }, }, distance = 1.5 }) end + -- Evidence + for k, v in pairs(Config.Locations['evidence']) do + exports['qb-target']:AddCircleZone('PoliceEvidence_' .. k, vector3(v.x, v.y, v.z), 0.5, { + name = 'PoliceEvidence_' .. k, + useZ = true, + debugPoly = false, + }, { + options = { + { + type = 'client', + event = 'qb-policejob:client:EvidenceStashDrawer', + icon = 'fas fa-dungeon', + label = 'Open Evidence Stash', + job = 'leo', + }, + }, + distance = 1.5 + }) + end end) - else - -- Toggle Duty local dutyZones = {} - for _, v in pairs(Config.Locations["duty"]) do - dutyZones[#dutyZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['duty']) do + dutyZones[#dutyZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 1.75, 1, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local dutyCombo = ComboZone:Create(dutyZones, {name = "dutyCombo", debugPoly = false}) + local dutyCombo = ComboZone:Create(dutyZones, { name = 'dutyCombo', debugPoly = false }) dutyCombo:onPlayerInOut(function(isPointInside) if isPointInside then dutylisten = true if not PlayerJob.onduty then - exports['qb-core']:DrawText(Lang:t('info.on_duty'),'left') + exports['qb-core']:DrawText(Lang:t('info.on_duty'), 'left') dutylistener() else - exports['qb-core']:DrawText(Lang:t('info.off_duty'),'left') + exports['qb-core']:DrawText(Lang:t('info.off_duty'), 'left') dutylistener() end else @@ -828,21 +840,21 @@ else -- Personal Stash local stashZones = {} - for _, v in pairs(Config.Locations["stash"]) do - stashZones[#stashZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['stash']) do + stashZones[#stashZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 1.5, 1.5, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local stashCombo = ComboZone:Create(stashZones, {name = "stashCombo", debugPoly = false}) + local stashCombo = ComboZone:Create(stashZones, { name = 'stashCombo', debugPoly = false }) stashCombo:onPlayerInOut(function(isPointInside, _, _) if isPointInside then inStash = true - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then exports['qb-core']:DrawText(Lang:t('info.stash_enter'), 'left') stash() end @@ -854,22 +866,22 @@ else -- Police Trash local trashZones = {} - for _, v in pairs(Config.Locations["trash"]) do - trashZones[#trashZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['trash']) do + trashZones[#trashZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 1, 1.75, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local trashCombo = ComboZone:Create(trashZones, {name = "trashCombo", debugPoly = false}) + local trashCombo = ComboZone:Create(trashZones, { name = 'trashCombo', debugPoly = false }) trashCombo:onPlayerInOut(function(isPointInside) if isPointInside then inTrash = true - if PlayerJob.name == 'police' and PlayerJob.onduty then - exports['qb-core']:DrawText(Lang:t('info.trash_enter'),'left') + if PlayerJob.type == 'leo' and PlayerJob.onduty then + exports['qb-core']:DrawText(Lang:t('info.trash_enter'), 'left') trash() end else @@ -880,22 +892,22 @@ else -- Fingerprints local fingerprintZones = {} - for _, v in pairs(Config.Locations["fingerprint"]) do - fingerprintZones[#fingerprintZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['fingerprint']) do + fingerprintZones[#fingerprintZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 2, 1, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local fingerprintCombo = ComboZone:Create(fingerprintZones, {name = "fingerprintCombo", debugPoly = false}) + local fingerprintCombo = ComboZone:Create(fingerprintZones, { name = 'fingerprintCombo', debugPoly = false }) fingerprintCombo:onPlayerInOut(function(isPointInside) if isPointInside then inFingerprint = true - if PlayerJob.name == 'police' and PlayerJob.onduty then - exports['qb-core']:DrawText(Lang:t('info.scan_fingerprint'),'left') + if PlayerJob.type == 'leo' and PlayerJob.onduty then + exports['qb-core']:DrawText(Lang:t('info.scan_fingerprint'), 'left') fingerprint() end else @@ -906,22 +918,22 @@ else -- Armoury local armouryZones = {} - for _, v in pairs(Config.Locations["armory"]) do - armouryZones[#armouryZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['armory']) do + armouryZones[#armouryZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 5, 1, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local armouryCombo = ComboZone:Create(armouryZones, {name = "armouryCombo", debugPoly = false}) + local armouryCombo = ComboZone:Create(armouryZones, { name = 'armouryCombo', debugPoly = false }) armouryCombo:onPlayerInOut(function(isPointInside) if isPointInside then inArmoury = true - if PlayerJob.name == 'police' and PlayerJob.onduty then - exports['qb-core']:DrawText(Lang:t('info.enter_armory'),'left') + if PlayerJob.type == 'leo' and PlayerJob.onduty then + exports['qb-core']:DrawText(Lang:t('info.enter_armory'), 'left') armoury() end else @@ -930,67 +942,51 @@ else end end) -end - -CreateThread(function() - -- Evidence Storage + -- Evidence local evidenceZones = {} - for _, v in pairs(Config.Locations["evidence"]) do - evidenceZones[#evidenceZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['evidence']) do + evidenceZones[#evidenceZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 2, 1, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local evidenceCombo = ComboZone:Create(evidenceZones, {name = "evidenceCombo", debugPoly = false}) + local evidenceCombo = ComboZone:Create(evidenceZones, { name = 'evidenceCombo', debugPoly = false }) evidenceCombo:onPlayerInOut(function(isPointInside) if isPointInside then - if PlayerJob.name == "police" and PlayerJob.onduty then - local currentEvidence = 0 - local pos = GetEntityCoords(PlayerPedId()) - - for k, v in pairs(Config.Locations["evidence"]) do - if #(pos - v) < 2 then - currentEvidence = k - end - end - exports['qb-menu']:showHeader({ - { - header = Lang:t('info.evidence_stash', {value = currentEvidence}), - params = { - event = 'police:client:EvidenceStashDrawer', - args = { - currentEvidence = currentEvidence - } - } - } - }) + inEvidence = true + if PlayerJob.type == 'leo' and PlayerJob.onduty then + exports['qb-core']:DrawText(Lang:t('info.evidence_stash'), 'left') + evidence() end else - exports['qb-menu']:closeMenu() + inEvidence = false + exports['qb-core']:HideText() end end) +end +CreateThread(function() -- Helicopter local helicopterZones = {} - for _, v in pairs(Config.Locations["helicopter"]) do - helicopterZones[#helicopterZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['helicopter']) do + helicopterZones[#helicopterZones + 1] = BoxZone:Create( vector3(vector3(v.x, v.y, v.z)), 10, 10, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local helicopterCombo = ComboZone:Create(helicopterZones, {name = "helicopterCombo", debugPoly = false}) + local helicopterCombo = ComboZone:Create(helicopterZones, { name = 'helicopterCombo', debugPoly = false }) helicopterCombo:onPlayerInOut(function(isPointInside) if isPointInside then inHelicopter = true - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then if IsPedInAnyVehicle(PlayerPedId(), false) then exports['qb-core']:HideText() exports['qb-core']:DrawText(Lang:t('info.store_heli'), 'left') @@ -1008,29 +1004,29 @@ CreateThread(function() -- Police Impound local impoundZones = {} - for _, v in pairs(Config.Locations["impound"]) do - impoundZones[#impoundZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['impound']) do + impoundZones[#impoundZones + 1] = BoxZone:Create( vector3(v.x, v.y, v.z), 1, 1, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - heading = 180, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + heading = 180, + }) end - local impoundCombo = ComboZone:Create(impoundZones, {name = "impoundCombo", debugPoly = false}) + local impoundCombo = ComboZone:Create(impoundZones, { name = 'impoundCombo', debugPoly = false }) impoundCombo:onPlayerInOut(function(isPointInside, point) if isPointInside then inImpound = true - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then if IsPedInAnyVehicle(PlayerPedId(), false) then exports['qb-core']:DrawText(Lang:t('info.impound_veh'), 'left') impound() else local currentSelection = 0 - for k, v in pairs(Config.Locations["impound"]) do + for k, v in pairs(Config.Locations['impound']) do if #(point - vector3(v.x, v.y, v.z)) < 4 then currentSelection = k end @@ -1057,28 +1053,28 @@ CreateThread(function() -- Police Garage local garageZones = {} - for _, v in pairs(Config.Locations["vehicle"]) do - garageZones[#garageZones+1] = BoxZone:Create( + for _, v in pairs(Config.Locations['vehicle']) do + garageZones[#garageZones + 1] = BoxZone:Create( vector3(v.x, v.y, v.z), 3, 3, { - name="box_zone", - debugPoly = false, - minZ = v.z - 1, - maxZ = v.z + 1, - }) + name = 'box_zone', + debugPoly = false, + minZ = v.z - 1, + maxZ = v.z + 1, + }) end - local garageCombo = ComboZone:Create(garageZones, {name = "garageCombo", debugPoly = false}) + local garageCombo = ComboZone:Create(garageZones, { name = 'garageCombo', debugPoly = false }) garageCombo:onPlayerInOut(function(isPointInside, point) if isPointInside then inGarage = true - if PlayerJob.name == 'police' and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then if IsPedInAnyVehicle(PlayerPedId(), false) then exports['qb-core']:DrawText(Lang:t('info.store_veh'), 'left') - garage() + garage() else local currentSelection = 0 - for k, v in pairs(Config.Locations["vehicle"]) do + for k, v in pairs(Config.Locations['vehicle']) do if #(point - vector3(v.x, v.y, v.z)) < 4 then currentSelection = k end diff --git a/client/main.lua b/client/main.lua index c749985e..541f1b41 100644 --- a/client/main.lua +++ b/client/main.lua @@ -20,7 +20,7 @@ local function CreateDutyBlips(playerId, playerLabel, playerJob, playerLocation) ShowHeadingIndicatorOnBlip(blip, true) SetBlipRotation(blip, math.ceil(playerLocation.w)) SetBlipScale(blip, 1.0) - if playerJob == "police" then + if playerJob == 'police' then SetBlipColour(blip, 38) else SetBlipColour(blip, 5) @@ -29,7 +29,7 @@ local function CreateDutyBlips(playerId, playerLabel, playerJob, playerLocation) BeginTextCommandSetBlipName('STRING') AddTextComponentSubstringPlayerName(playerLabel) EndTextCommandSetBlipName(blip) - DutyBlips[#DutyBlips+1] = blip + DutyBlips[#DutyBlips + 1] = blip end if GetBlipFromEntity(PlayerPedId()) == blip then @@ -39,18 +39,26 @@ local function CreateDutyBlips(playerId, playerLabel, playerJob, playerLocation) end -- Events + +AddEventHandler('onResourceStart', function(resourceName) + if GetCurrentResourceName() == resourceName then + local player = QBCore.Functions.GetPlayerData() + PlayerJob = player.job + end +end) + AddEventHandler('QBCore:Client:OnPlayerLoaded', function() local player = QBCore.Functions.GetPlayerData() PlayerJob = player.job isHandcuffed = false - TriggerServerEvent("police:server:SetHandcuffStatus", false) - TriggerServerEvent("police:server:UpdateBlips") - TriggerServerEvent("police:server:UpdateCurrentCops") + TriggerServerEvent('police:server:SetHandcuffStatus', false) + TriggerServerEvent('police:server:UpdateBlips') + TriggerServerEvent('police:server:UpdateCurrentCops') if player.metadata.tracker then local trackerClothingData = { outfitData = { - ["accessory"] = { + ['accessory'] = { item = 13, texture = 0 } @@ -60,7 +68,7 @@ AddEventHandler('QBCore:Client:OnPlayerLoaded', function() else local trackerClothingData = { outfitData = { - ["accessory"] = { + ['accessory'] = { item = -1, texture = 0 } @@ -69,7 +77,7 @@ AddEventHandler('QBCore:Client:OnPlayerLoaded', function() TriggerEvent('qb-clothing:client:loadOutfit', trackerClothingData) end - if PlayerJob and PlayerJob.name ~= "police" then + if PlayerJob and PlayerJob.name ~= 'police' then if DutyBlips then for _, v in pairs(DutyBlips) do RemoveBlip(v) @@ -81,8 +89,8 @@ end) RegisterNetEvent('QBCore:Client:OnPlayerUnload', function() TriggerServerEvent('police:server:UpdateBlips') - TriggerServerEvent("police:server:SetHandcuffStatus", false) - TriggerServerEvent("police:server:UpdateCurrentCops") + TriggerServerEvent('police:server:SetHandcuffStatus', false) + TriggerServerEvent('police:server:UpdateCurrentCops') isHandcuffed = false isEscorted = false PlayerJob = {} @@ -96,12 +104,12 @@ RegisterNetEvent('QBCore:Client:OnPlayerUnload', function() end end) -RegisterNetEvent("QBCore:Client:SetDuty", function(newDuty) +RegisterNetEvent('QBCore:Client:SetDuty', function(newDuty) PlayerJob.onduty = newDuty end) RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) - if JobInfo.name ~= "police" then + if JobInfo.name ~= 'police' then if DutyBlips then for _, v in pairs(DutyBlips) do RemoveBlip(v) @@ -110,7 +118,7 @@ RegisterNetEvent('QBCore:Client:OnJobUpdate', function(JobInfo) DutyBlips = {} end PlayerJob = JobInfo - TriggerServerEvent("police:server:UpdateBlips") + TriggerServerEvent('police:server:UpdateBlips') end) RegisterNetEvent('police:client:sendBillingMail', function(amount) @@ -123,14 +131,14 @@ RegisterNetEvent('police:client:sendBillingMail', function(amount) TriggerServerEvent('qb-phone:server:sendNewMail', { sender = Lang:t('email.sender'), subject = Lang:t('email.subject'), - message = Lang:t('email.message', {value = gender, value2 = charinfo.lastname, value3 = amount}), + message = Lang:t('email.message', { value = gender, value2 = charinfo.lastname, value3 = amount }), button = {} }) end) end) RegisterNetEvent('police:client:UpdateBlips', function(players) - if PlayerJob and (PlayerJob.name == 'police' or PlayerJob.name == 'ambulance') and + if PlayerJob and (PlayerJob.type == 'leo' or PlayerJob.type == 'ems') and PlayerJob.onduty then if DutyBlips then for _, v in pairs(DutyBlips) do @@ -142,7 +150,6 @@ RegisterNetEvent('police:client:UpdateBlips', function(players) for _, data in pairs(players) do local id = GetPlayerFromServerId(data.source) CreateDutyBlips(id, data.label, data.job, data.location) - end end end @@ -152,12 +159,12 @@ RegisterNetEvent('police:client:policeAlert', function(coords, text) local street1, street2 = GetStreetNameAtCoord(coords.x, coords.y, coords.z) local street1name = GetStreetNameFromHashKey(street1) local street2name = GetStreetNameFromHashKey(street2) - QBCore.Functions.Notify({text = text, caption = street1name.. ' ' ..street2name}, 'police') - PlaySound(-1, "Lose_1st", "GTAO_FM_Events_Soundset", 0, 0, 1) + QBCore.Functions.Notify({ text = text, caption = street1name .. ' ' .. street2name }, 'police') + PlaySound(-1, 'Lose_1st', 'GTAO_FM_Events_Soundset', 0, 0, 1) local transG = 250 local blip = AddBlipForCoord(coords.x, coords.y, coords.z) local blip2 = AddBlipForCoord(coords.x, coords.y, coords.z) - local blipText = Lang:t('info.blip_text', {value = text}) + local blipText = Lang:t('info.blip_text', { value = text }) SetBlipSprite(blip, 60) SetBlipSprite(blip2, 161) SetBlipColour(blip, 1) @@ -187,29 +194,29 @@ RegisterNetEvent('police:client:policeAlert', function(coords, text) end) RegisterNetEvent('police:client:SendToJail', function(time) - TriggerServerEvent("police:server:SetHandcuffStatus", false) + TriggerServerEvent('police:server:SetHandcuffStatus', false) isHandcuffed = false isEscorted = false ClearPedTasks(PlayerPedId()) DetachEntity(PlayerPedId(), true, false) - TriggerEvent("prison:client:Enter", time) + TriggerEvent('prison:client:Enter', time) end) RegisterNetEvent('police:client:SendPoliceEmergencyAlert', function() local Player = QBCore.Functions.GetPlayerData() - TriggerServerEvent('police:server:policeAlert', Lang:t('info.officer_down', {lastname = Player.charinfo.lastname, callsign = Player.metadata.callsign})) - TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.officer_down', {lastname = Player.charinfo.lastname, callsign = Player.metadata.callsign})) + TriggerServerEvent('police:server:policeAlert', Lang:t('info.officer_down', { lastname = Player.charinfo.lastname, callsign = Player.metadata.callsign })) + TriggerServerEvent('hospital:server:ambulanceAlert', Lang:t('info.officer_down', { lastname = Player.charinfo.lastname, callsign = Player.metadata.callsign })) end) -- Threads CreateThread(function() - for _, station in pairs(Config.Locations["stations"]) do + for _, station in pairs(Config.Locations['stations']) do local blip = AddBlipForCoord(station.coords.x, station.coords.y, station.coords.z) SetBlipSprite(blip, 60) SetBlipAsShortRange(blip, true) SetBlipScale(blip, 0.8) SetBlipColour(blip, 29) - BeginTextCommandSetBlipName("STRING") + BeginTextCommandSetBlipName('STRING') AddTextComponentSubstringPlayerName(station.label) EndTextCommandSetBlipName(blip) end diff --git a/client/objects.lua b/client/objects.lua index 7faa5763..05660609 100644 --- a/client/objects.lua +++ b/client/objects.lua @@ -44,134 +44,134 @@ function GetClosestSpike() end local function DrawText3D(x, y, z, text) - SetTextScale(0.35, 0.35) + SetTextScale(0.35, 0.35) SetTextFont(4) SetTextProportional(1) SetTextColour(255, 255, 255, 215) - BeginTextCommandDisplayText("STRING") + BeginTextCommandDisplayText('STRING') SetTextCentre(true) AddTextComponentSubstringPlayerName(text) - SetDrawOrigin(x,y,z, 0) + SetDrawOrigin(x, y, z, 0) EndTextCommandDisplayText(0.0, 0.0) local factor = (string.len(text)) / 370 - DrawRect(0.0, 0.0+0.0125, 0.017+ factor, 0.03, 0, 0, 0, 75) + DrawRect(0.0, 0.0 + 0.0125, 0.017 + factor, 0.03, 0, 0, 0, 75) ClearDrawOrigin() end -- Events RegisterNetEvent('police:client:spawnCone', function() - QBCore.Functions.Progressbar("spawn_object", Lang:t("progressbar.place_object"), 2500, false, true, { + QBCore.Functions.Progressbar('spawn_object', Lang:t('progressbar.place_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "anim@narcotics@trash", - anim = "drop_front", + animDict = 'anim@narcotics@trash', + anim = 'drop_front', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - TriggerServerEvent("police:server:spawnObject", "cone") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + TriggerServerEvent('police:server:spawnObject', 'cone') end, function() -- Cancel - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end) RegisterNetEvent('police:client:spawnBarrier', function() - QBCore.Functions.Progressbar("spawn_object", Lang:t("progressbar.place_object"), 2500, false, true, { + QBCore.Functions.Progressbar('spawn_object', Lang:t('progressbar.place_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "anim@narcotics@trash", - anim = "drop_front", + animDict = 'anim@narcotics@trash', + anim = 'drop_front', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - TriggerServerEvent("police:server:spawnObject", "barrier") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + TriggerServerEvent('police:server:spawnObject', 'barrier') end, function() -- Cancel - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end) RegisterNetEvent('police:client:spawnRoadSign', function() - QBCore.Functions.Progressbar("spawn_object", Lang:t("progressbar.place_object"), 2500, false, true, { + QBCore.Functions.Progressbar('spawn_object', Lang:t('progressbar.place_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "anim@narcotics@trash", - anim = "drop_front", + animDict = 'anim@narcotics@trash', + anim = 'drop_front', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - TriggerServerEvent("police:server:spawnObject", "roadsign") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + TriggerServerEvent('police:server:spawnObject', 'roadsign') end, function() -- Cancel - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end) RegisterNetEvent('police:client:spawnTent', function() - QBCore.Functions.Progressbar("spawn_object", Lang:t("progressbar.place_object"), 2500, false, true, { + QBCore.Functions.Progressbar('spawn_object', Lang:t('progressbar.place_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "anim@narcotics@trash", - anim = "drop_front", + animDict = 'anim@narcotics@trash', + anim = 'drop_front', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - TriggerServerEvent("police:server:spawnObject", "tent") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + TriggerServerEvent('police:server:spawnObject', 'tent') end, function() -- Cancel - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end) RegisterNetEvent('police:client:spawnLight', function() - QBCore.Functions.Progressbar("spawn_object", Lang:t("progressbar.place_object"), 2500, false, true, { + QBCore.Functions.Progressbar('spawn_object', Lang:t('progressbar.place_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "anim@narcotics@trash", - anim = "drop_front", + animDict = 'anim@narcotics@trash', + anim = 'drop_front', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - TriggerServerEvent("police:server:spawnObject", "light") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + TriggerServerEvent('police:server:spawnObject', 'light') end, function() -- Cancel - StopAnimTask(PlayerPedId(), "anim@narcotics@trash", "drop_front", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'anim@narcotics@trash', 'drop_front', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end) RegisterNetEvent('police:client:deleteObject', function() local objectId, dist = GetClosestPoliceObject() if dist < 5.0 then - QBCore.Functions.Progressbar("remove_object", Lang:t('progressbar.remove_object'), 2500, false, true, { + QBCore.Functions.Progressbar('remove_object', Lang:t('progressbar.remove_object'), 2500, false, true, { disableMovement = true, disableCarMovement = true, disableMouse = false, disableCombat = true, }, { - animDict = "weapons@first_person@aim_rng@generic@projectile@thermal_charge@", - anim = "plant_floor", + animDict = 'weapons@first_person@aim_rng@generic@projectile@thermal_charge@', + anim = 'plant_floor', flags = 16, }, {}, {}, function() -- Done - StopAnimTask(PlayerPedId(), "weapons@first_person@aim_rng@generic@projectile@thermal_charge@", "plant_floor", 1.0) - TriggerServerEvent("police:server:deleteObject", objectId) + StopAnimTask(PlayerPedId(), 'weapons@first_person@aim_rng@generic@projectile@thermal_charge@', 'plant_floor', 1.0) + TriggerServerEvent('police:server:deleteObject', objectId) end, function() -- Cancel - StopAnimTask(PlayerPedId(), "weapons@first_person@aim_rng@generic@projectile@thermal_charge@", "plant_floor", 1.0) - QBCore.Functions.Notify(Lang:t("error.canceled"), "error") + StopAnimTask(PlayerPedId(), 'weapons@first_person@aim_rng@generic@projectile@thermal_charge@', 'plant_floor', 1.0) + QBCore.Functions.Notify(Lang:t('error.canceled'), 'error') end) end end) @@ -200,7 +200,7 @@ end) RegisterNetEvent('police:client:SpawnSpikeStrip', function() if #SpawnedSpikes + 1 < Config.MaxSpikes then - if PlayerJob.name == "police" and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then local spawnCoords = GetOffsetFromEntityInWorldCoords(PlayerPedId(), 0.0, 2.0, 0.0) local spike = CreateObject(spikemodel, spawnCoords.x, spawnCoords.y, spawnCoords.z, 1, 1, 1) local netid = NetworkGetNetworkIdFromEntity(spike) @@ -208,7 +208,7 @@ RegisterNetEvent('police:client:SpawnSpikeStrip', function() SetNetworkIdCanMigrate(netid, false) SetEntityHeading(spike, GetEntityHeading(PlayerPedId())) PlaceObjectOnGroundProperly(spike) - SpawnedSpikes[#SpawnedSpikes+1] = { + SpawnedSpikes[#SpawnedSpikes + 1] = { coords = vector3(spawnCoords.x, spawnCoords.y, spawnCoords.z), netid = netid, object = spike, @@ -216,7 +216,7 @@ RegisterNetEvent('police:client:SpawnSpikeStrip', function() TriggerServerEvent('police:server:SyncSpikes', SpawnedSpikes) end else - QBCore.Functions.Notify(Lang:t("error.no_spikestripe"), 'error') + QBCore.Functions.Notify(Lang:t('error.no_spikestripe'), 'error') end end) @@ -239,12 +239,12 @@ CreateThread(function() if LocalPlayer.state.isLoggedIn then if ClosestSpike then local tires = { - {bone = "wheel_lf", index = 0}, - {bone = "wheel_rf", index = 1}, - {bone = "wheel_lm", index = 2}, - {bone = "wheel_rm", index = 3}, - {bone = "wheel_lr", index = 4}, - {bone = "wheel_rr", index = 5} + { bone = 'wheel_lf', index = 0 }, + { bone = 'wheel_rf', index = 1 }, + { bone = 'wheel_lm', index = 2 }, + { bone = 'wheel_rm', index = 3 }, + { bone = 'wheel_lr', index = 4 }, + { bone = 'wheel_rr', index = 5 } } for a = 1, #tires do @@ -277,7 +277,7 @@ CreateThread(function() local dist = #(pos - SpawnedSpikes[ClosestSpike].coords) if dist < 4 then if not IsPedInAnyVehicle(PlayerPedId()) then - if PlayerJob.name == "police" and PlayerJob.onduty then + if PlayerJob.type == 'leo' and PlayerJob.onduty then sleep = 0 DrawText3D(pos.x, pos.y, pos.z, Lang:t('info.delete_spike')) if IsControlJustPressed(0, 38) then diff --git a/client/tracker.lua b/client/tracker.lua index 71ab566b..b0ca4862 100644 --- a/client/tracker.lua +++ b/client/tracker.lua @@ -2,22 +2,22 @@ RegisterNetEvent('police:client:CheckDistance', function() local player, distance = QBCore.Functions.GetClosestPlayer() if player ~= -1 and distance < 2.5 then local playerId = GetPlayerServerId(player) - TriggerServerEvent("police:server:SetTracker", playerId) + TriggerServerEvent('police:server:SetTracker', playerId) else - QBCore.Functions.Notify(Lang:t("error.none_nearby"), "error") + QBCore.Functions.Notify(Lang:t('error.none_nearby'), 'error') end end) RegisterNetEvent('police:client:SetTracker', function(bool) local trackerClothingData = { outfitData = { - ["accessory"] = { item = -1, texture = 0}, -- Nek / Das + ['accessory'] = { item = -1, texture = 0 }, } } if bool then trackerClothingData.outfitData = { - ["accessory"] = { item = 13, texture = 0} + ['accessory'] = { item = 13, texture = 0 } } TriggerEvent('qb-clothing:client:loadOutfit', trackerClothingData) @@ -34,7 +34,7 @@ RegisterNetEvent('police:client:SendTrackerLocation', function(requestId) end) RegisterNetEvent('police:client:TrackerMessage', function(msg, coords) - PlaySound(-1, "Lose_1st", "GTAO_FM_Events_Soundset", 0, 0, 1) + PlaySound(-1, 'Lose_1st', 'GTAO_FM_Events_Soundset', 0, 0, 1) QBCore.Functions.Notify(msg, 'police') local transG = 250 local blip = AddBlipForCoord(coords.x, coords.y, coords.z) @@ -56,4 +56,4 @@ RegisterNetEvent('police:client:TrackerMessage', function(msg, coords) return end end -end) \ No newline at end of file +end) diff --git a/config.lua b/config.lua index f6967539..35c5f4e3 100644 --- a/config.lua +++ b/config.lua @@ -1,433 +1,251 @@ Config = {} - -Config.Objects = { - ["cone"] = {model = `prop_roadcone02a`, freeze = false}, - ["barrier"] = {model = `prop_barrier_work06a`, freeze = true}, - ["roadsign"] = {model = `prop_snow_sign_road_06g`, freeze = true}, - ["tent"] = {model = `prop_gazebo_03`, freeze = true}, - ["light"] = {model = `prop_worklight_03b`, freeze = true}, -} - +Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' Config.MaxSpikes = 5 - Config.HandCuffItem = 'handcuffs' - Config.LicenseRank = 2 +Config.ArmoryWhitelist = {} +Config.WhitelistedVehicles = {} +Config.PoliceHelicopter = 'POLMAV' +Config.FuelResource = 'LegacyFuel' -- supports any that has a GetFuel() and SetFuel() export + +Config.AmmoLabels = { + ['AMMO_PISTOL'] = '9x19mm parabellum bullet', + ['AMMO_SMG'] = '9x19mm parabellum bullet', + ['AMMO_RIFLE'] = '7.62x39mm bullet', + ['AMMO_MG'] = '7.92x57mm mauser bullet', + ['AMMO_SHOTGUN'] = '12-gauge bullet', + ['AMMO_SNIPER'] = 'Large caliber bullet', +} + +Config.Objects = { + ['cone'] = { model = `prop_roadcone02a`, freeze = false }, + ['barrier'] = { model = `prop_barrier_work06a`, freeze = true }, + ['roadsign'] = { model = `prop_snow_sign_road_06g`, freeze = true }, + ['tent'] = { model = `prop_gazebo_03`, freeze = true }, + ['light'] = { model = `prop_worklight_03b`, freeze = true }, +} -Config.UseTarget = GetConvar('UseTarget', 'false') == 'true' Config.Locations = { - ["duty"] = { + ['duty'] = { [1] = vector3(440.085, -974.924, 30.689), [2] = vector3(-449.811, 6012.909, 31.815), }, - ["vehicle"] = { + ['vehicle'] = { [1] = vector4(448.159, -1017.41, 28.562, 90.654), [2] = vector4(471.13, -1024.05, 28.17, 274.5), [3] = vector4(-455.39, 6002.02, 31.34, 87.93), }, - ["stash"] = { + ['stash'] = { [1] = vector3(453.075, -980.124, 30.889), }, - ["impound"] = { + ['impound'] = { [1] = vector3(436.68, -1007.42, 27.32), [2] = vector3(-436.14, 5982.63, 31.34), }, - ["helicopter"] = { + ['helicopter'] = { [1] = vector4(449.168, -981.325, 43.691, 87.234), [2] = vector4(-475.43, 5988.353, 31.716, 31.34), }, - ["armory"] = { + ['armory'] = { [1] = vector3(462.23, -981.12, 30.68), }, - ["trash"] = { + ['trash'] = { [1] = vector3(439.0907, -976.746, 30.776), }, - ["fingerprint"] = { + ['fingerprint'] = { [1] = vector3(460.9667, -989.180, 24.92), }, - ["evidence"] = { + ['evidence'] = { [1] = vector3(442.1722, -996.067, 30.689), [2] = vector3(451.7031, -973.232, 30.689), [3] = vector3(455.1456, -985.462, 30.689), }, - ["stations"] = { - [1] = {label = "Police Station", coords = vector4(428.23, -984.28, 29.76, 3.5)}, - [2] = {label = "Prison", coords = vector4(1845.903, 2585.873, 45.672, 272.249)}, - [3] = {label = "Police Station Paleto", coords = vector4(-451.55, 6014.25, 31.716, 223.81)}, + ['stations'] = { + [1] = { label = 'Police Station', coords = vector4(428.23, -984.28, 29.76, 3.5) }, + [2] = { label = 'Prison', coords = vector4(1845.903, 2585.873, 45.672, 272.249) }, + [3] = { label = 'Police Station Paleto', coords = vector4(-451.55, 6014.25, 31.716, 223.81) }, }, } -Config.ArmoryWhitelist = {} - -Config.PoliceHelicopter = "POLMAV" - Config.SecurityCameras = { hideradar = false, cameras = { - [1] = {label = "Pacific Bank CAM#1", coords = vector3(257.45, 210.07, 109.08), r = {x = -25.0, y = 0.0, z = 28.05}, canRotate = false, isOnline = true}, - [2] = {label = "Pacific Bank CAM#2", coords = vector3(232.86, 221.46, 107.83), r = {x = -25.0, y = 0.0, z = -140.91}, canRotate = false, isOnline = true}, - [3] = {label = "Pacific Bank CAM#3", coords = vector3(252.27, 225.52, 103.99), r = {x = -35.0, y = 0.0, z = -74.87}, canRotate = false, isOnline = true}, - [4] = {label = "Limited Ltd Grove St. CAM#1", coords = vector3(-53.1433, -1746.714, 31.546), r = {x = -35.0, y = 0.0, z = -168.9182}, canRotate = false, isOnline = true}, - [5] = {label = "Rob's Liqour Prosperity St. CAM#1", coords = vector3(-1482.9, -380.463, 42.363), r = {x = -35.0, y = 0.0, z = 79.53281}, canRotate = false, isOnline = true}, - [6] = {label = "Rob's Liqour San Andreas Ave. CAM#1", coords = vector3(-1224.874, -911.094, 14.401), r = {x = -35.0, y = 0.0, z = -6.778894}, canRotate = false, isOnline = true}, - [7] = {label = "Limited Ltd Ginger St. CAM#1", coords = vector3(-718.153, -909.211, 21.49), r = {x = -35.0, y = 0.0, z = -137.1431}, canRotate = false, isOnline = true}, - [8] = {label = "24/7 Supermarkt Innocence Blvd. CAM#1", coords = vector3(23.885, -1342.441, 31.672), r = {x = -35.0, y = 0.0, z = -142.9191}, canRotate = false, isOnline = true}, - [9] = {label = "Rob's Liqour El Rancho Blvd. CAM#1", coords = vector3(1133.024, -978.712, 48.515), r = {x = -35.0, y = 0.0, z = -137.302}, canRotate = false, isOnline = true}, - [10] = {label = "Limited Ltd West Mirror Drive CAM#1", coords = vector3(1151.93, -320.389, 71.33), r = {x = -35.0, y = 0.0, z = -119.4468}, canRotate = false, isOnline = true}, - [11] = {label = "24/7 Supermarkt Clinton Ave CAM#1", coords = vector3(383.402, 328.915, 105.541), r = {x = -35.0, y = 0.0, z = 118.585}, canRotate = false, isOnline = true}, - [12] = {label = "Limited Ltd Banham Canyon Dr CAM#1", coords = vector3(-1832.057, 789.389, 140.436), r = {x = -35.0, y = 0.0, z = -91.481}, canRotate = false, isOnline = true}, - [13] = {label = "Rob's Liqour Great Ocean Hwy CAM#1", coords = vector3(-2966.15, 387.067, 17.393), r = {x = -35.0, y = 0.0, z = 32.92229}, canRotate = false, isOnline = true}, - [14] = {label = "24/7 Supermarkt Ineseno Road CAM#1", coords = vector3(-3046.749, 592.491, 9.808), r = {x = -35.0, y = 0.0, z = -116.673}, canRotate = false, isOnline = true}, - [15] = {label = "24/7 Supermarkt Barbareno Rd. CAM#1", coords = vector3(-3246.489, 1010.408, 14.705), r = {x = -35.0, y = 0.0, z = -135.2151}, canRotate = false, isOnline = true}, - [16] = {label = "24/7 Supermarkt Route 68 CAM#1", coords = vector3(539.773, 2664.904, 44.056), r = {x = -35.0, y = 0.0, z = -42.947}, canRotate = false, isOnline = true}, - [17] = {label = "Rob's Liqour Route 68 CAM#1", coords = vector3(1169.855, 2711.493, 40.432), r = {x = -35.0, y = 0.0, z = 127.17}, canRotate = false, isOnline = true}, - [18] = {label = "24/7 Supermarkt Senora Fwy CAM#1", coords = vector3(2673.579, 3281.265, 57.541), r = {x = -35.0, y = 0.0, z = -80.242}, canRotate = false, isOnline = true}, - [19] = {label = "24/7 Supermarkt Alhambra Dr. CAM#1", coords = vector3(1966.24, 3749.545, 34.143), r = {x = -35.0, y = 0.0, z = 163.065}, canRotate = false, isOnline = true}, - [20] = {label = "24/7 Supermarkt Senora Fwy CAM#2", coords = vector3(1729.522, 6419.87, 37.262), r = {x = -35.0, y = 0.0, z = -160.089}, canRotate = false, isOnline = true}, - [21] = {label = "Fleeca Bank Hawick Ave CAM#1", coords = vector3(309.341, -281.439, 55.88), r = {x = -35.0, y = 0.0, z = -146.1595}, canRotate = false, isOnline = true}, - [22] = {label = "Fleeca Bank Legion Square CAM#1", coords = vector3(144.871, -1043.044, 31.017), r = {x = -35.0, y = 0.0, z = -143.9796}, canRotate = false, isOnline = true}, - [23] = {label = "Fleeca Bank Hawick Ave CAM#2", coords = vector3(-355.7643, -52.506, 50.746), r = {x = -35.0, y = 0.0, z = -143.8711}, canRotate = false, isOnline = true}, - [24] = {label = "Fleeca Bank Del Perro Blvd CAM#1", coords = vector3(-1214.226, -335.86, 39.515), r = {x = -35.0, y = 0.0, z = -97.862}, canRotate = false, isOnline = true}, - [25] = {label = "Fleeca Bank Great Ocean Hwy CAM#1", coords = vector3(-2958.885, 478.983, 17.406), r = {x = -35.0, y = 0.0, z = -34.69595}, canRotate = false, isOnline = true}, - [26] = {label = "Paleto Bank CAM#1", coords = vector3(-102.939, 6467.668, 33.424), r = {x = -35.0, y = 0.0, z = 24.66}, canRotate = false, isOnline = true}, - [27] = {label = "Del Vecchio Liquor Paleto Bay", coords = vector3(-163.75, 6323.45, 33.424), r = {x = -35.0, y = 0.0, z = 260.00}, canRotate = false, isOnline = true}, - [28] = {label = "Don's Country Store Paleto Bay CAM#1", coords = vector3(166.42, 6634.4, 33.69), r = {x = -35.0, y = 0.0, z = 32.00}, canRotate = false, isOnline = true}, - [29] = {label = "Don's Country Store Paleto Bay CAM#2", coords = vector3(163.74, 6644.34, 33.69), r = {x = -35.0, y = 0.0, z = 168.00}, canRotate = false, isOnline = true}, - [30] = {label = "Don's Country Store Paleto Bay CAM#3", coords = vector3(169.54, 6640.89, 33.69), r = {x = -35.0, y = 0.0, z = 5.78}, canRotate = false, isOnline = true}, - [31] = {label = "Vangelico Jewelery CAM#1", coords = vector3(-627.54, -239.74, 40.33), r = {x = -35.0, y = 0.0, z = 5.78}, canRotate = true, isOnline = true}, - [32] = {label = "Vangelico Jewelery CAM#2", coords = vector3(-627.51, -229.51, 40.24), r = {x = -35.0, y = 0.0, z = -95.78}, canRotate = true, isOnline = true}, - [33] = {label = "Vangelico Jewelery CAM#3", coords = vector3(-620.3, -224.31, 40.23), r = {x = -35.0, y = 0.0, z = 165.78}, canRotate = true, isOnline = true}, - [34] = {label = "Vangelico Jewelery CAM#4", coords = vector3(-622.57, -236.3, 40.31), r = {x = -35.0, y = 0.0, z = 5.78}, canRotate = true, isOnline = true}, + [1] = { label = 'Pacific Bank CAM#1', coords = vector3(257.45, 210.07, 109.08), r = { x = -25.0, y = 0.0, z = 28.05 }, canRotate = false, isOnline = true }, + [2] = { label = 'Pacific Bank CAM#2', coords = vector3(232.86, 221.46, 107.83), r = { x = -25.0, y = 0.0, z = -140.91 }, canRotate = false, isOnline = true }, + [3] = { label = 'Pacific Bank CAM#3', coords = vector3(252.27, 225.52, 103.99), r = { x = -35.0, y = 0.0, z = -74.87 }, canRotate = false, isOnline = true }, + [4] = { label = 'Limited Ltd Grove St. CAM#1', coords = vector3(-53.1433, -1746.714, 31.546), r = { x = -35.0, y = 0.0, z = -168.9182 }, canRotate = false, isOnline = true }, + [5] = { label = "Rob's Liqour Prosperity St. CAM#1", coords = vector3(-1482.9, -380.463, 42.363), r = { x = -35.0, y = 0.0, z = 79.53281 }, canRotate = false, isOnline = true }, + [6] = { label = "Rob's Liqour San Andreas Ave. CAM#1", coords = vector3(-1224.874, -911.094, 14.401), r = { x = -35.0, y = 0.0, z = -6.778894 }, canRotate = false, isOnline = true }, + [7] = { label = 'Limited Ltd Ginger St. CAM#1', coords = vector3(-718.153, -909.211, 21.49), r = { x = -35.0, y = 0.0, z = -137.1431 }, canRotate = false, isOnline = true }, + [8] = { label = '24/7 Supermarkt Innocence Blvd. CAM#1', coords = vector3(23.885, -1342.441, 31.672), r = { x = -35.0, y = 0.0, z = -142.9191 }, canRotate = false, isOnline = true }, + [9] = { label = "Rob's Liqour El Rancho Blvd. CAM#1", coords = vector3(1133.024, -978.712, 48.515), r = { x = -35.0, y = 0.0, z = -137.302 }, canRotate = false, isOnline = true }, + [10] = { label = 'Limited Ltd West Mirror Drive CAM#1', coords = vector3(1151.93, -320.389, 71.33), r = { x = -35.0, y = 0.0, z = -119.4468 }, canRotate = false, isOnline = true }, + [11] = { label = '24/7 Supermarkt Clinton Ave CAM#1', coords = vector3(383.402, 328.915, 105.541), r = { x = -35.0, y = 0.0, z = 118.585 }, canRotate = false, isOnline = true }, + [12] = { label = 'Limited Ltd Banham Canyon Dr CAM#1', coords = vector3(-1832.057, 789.389, 140.436), r = { x = -35.0, y = 0.0, z = -91.481 }, canRotate = false, isOnline = true }, + [13] = { label = "Rob's Liqour Great Ocean Hwy CAM#1", coords = vector3(-2966.15, 387.067, 17.393), r = { x = -35.0, y = 0.0, z = 32.92229 }, canRotate = false, isOnline = true }, + [14] = { label = '24/7 Supermarkt Ineseno Road CAM#1', coords = vector3(-3046.749, 592.491, 9.808), r = { x = -35.0, y = 0.0, z = -116.673 }, canRotate = false, isOnline = true }, + [15] = { label = '24/7 Supermarkt Barbareno Rd. CAM#1', coords = vector3(-3246.489, 1010.408, 14.705), r = { x = -35.0, y = 0.0, z = -135.2151 }, canRotate = false, isOnline = true }, + [16] = { label = '24/7 Supermarkt Route 68 CAM#1', coords = vector3(539.773, 2664.904, 44.056), r = { x = -35.0, y = 0.0, z = -42.947 }, canRotate = false, isOnline = true }, + [17] = { label = "Rob's Liqour Route 68 CAM#1", coords = vector3(1169.855, 2711.493, 40.432), r = { x = -35.0, y = 0.0, z = 127.17 }, canRotate = false, isOnline = true }, + [18] = { label = '24/7 Supermarkt Senora Fwy CAM#1', coords = vector3(2673.579, 3281.265, 57.541), r = { x = -35.0, y = 0.0, z = -80.242 }, canRotate = false, isOnline = true }, + [19] = { label = '24/7 Supermarkt Alhambra Dr. CAM#1', coords = vector3(1966.24, 3749.545, 34.143), r = { x = -35.0, y = 0.0, z = 163.065 }, canRotate = false, isOnline = true }, + [20] = { label = '24/7 Supermarkt Senora Fwy CAM#2', coords = vector3(1729.522, 6419.87, 37.262), r = { x = -35.0, y = 0.0, z = -160.089 }, canRotate = false, isOnline = true }, + [21] = { label = 'Fleeca Bank Hawick Ave CAM#1', coords = vector3(309.341, -281.439, 55.88), r = { x = -35.0, y = 0.0, z = -146.1595 }, canRotate = false, isOnline = true }, + [22] = { label = 'Fleeca Bank Legion Square CAM#1', coords = vector3(144.871, -1043.044, 31.017), r = { x = -35.0, y = 0.0, z = -143.9796 }, canRotate = false, isOnline = true }, + [23] = { label = 'Fleeca Bank Hawick Ave CAM#2', coords = vector3(-355.7643, -52.506, 50.746), r = { x = -35.0, y = 0.0, z = -143.8711 }, canRotate = false, isOnline = true }, + [24] = { label = 'Fleeca Bank Del Perro Blvd CAM#1', coords = vector3(-1214.226, -335.86, 39.515), r = { x = -35.0, y = 0.0, z = -97.862 }, canRotate = false, isOnline = true }, + [25] = { label = 'Fleeca Bank Great Ocean Hwy CAM#1', coords = vector3(-2958.885, 478.983, 17.406), r = { x = -35.0, y = 0.0, z = -34.69595 }, canRotate = false, isOnline = true }, + [26] = { label = 'Paleto Bank CAM#1', coords = vector3(-102.939, 6467.668, 33.424), r = { x = -35.0, y = 0.0, z = 24.66 }, canRotate = false, isOnline = true }, + [27] = { label = 'Del Vecchio Liquor Paleto Bay', coords = vector3(-163.75, 6323.45, 33.424), r = { x = -35.0, y = 0.0, z = 260.00 }, canRotate = false, isOnline = true }, + [28] = { label = "Don's Country Store Paleto Bay CAM#1", coords = vector3(166.42, 6634.4, 33.69), r = { x = -35.0, y = 0.0, z = 32.00 }, canRotate = false, isOnline = true }, + [29] = { label = "Don's Country Store Paleto Bay CAM#2", coords = vector3(163.74, 6644.34, 33.69), r = { x = -35.0, y = 0.0, z = 168.00 }, canRotate = false, isOnline = true }, + [30] = { label = "Don's Country Store Paleto Bay CAM#3", coords = vector3(169.54, 6640.89, 33.69), r = { x = -35.0, y = 0.0, z = 5.78 }, canRotate = false, isOnline = true }, + [31] = { label = 'Vangelico Jewelery CAM#1', coords = vector3(-627.54, -239.74, 40.33), r = { x = -35.0, y = 0.0, z = 5.78 }, canRotate = true, isOnline = true }, + [32] = { label = 'Vangelico Jewelery CAM#2', coords = vector3(-627.51, -229.51, 40.24), r = { x = -35.0, y = 0.0, z = -95.78 }, canRotate = true, isOnline = true }, + [33] = { label = 'Vangelico Jewelery CAM#3', coords = vector3(-620.3, -224.31, 40.23), r = { x = -35.0, y = 0.0, z = 165.78 }, canRotate = true, isOnline = true }, + [34] = { label = 'Vangelico Jewelery CAM#4', coords = vector3(-622.57, -236.3, 40.31), r = { x = -35.0, y = 0.0, z = 5.78 }, canRotate = true, isOnline = true }, }, } -Config.AuthorizedVehicles = { - -- Grade 0 - [0] = { - ["police"] = "Police Car 1", - ["police2"] = "Police Car 2", - ["police3"] = "Police Car 3", - ["police4"] = "Police Car 4", - ["policeb"] = "Police Car 5", - ["policet"] = "Police Car 6", - ["sheriff"] = "Sheriff Car 1", - ["sheriff2"] = "Sheriff Car 2", - }, - -- Grade 1 - [1] = { - ["police"] = "Police Car 1", - ["police2"] = "Police Car 2", - ["police3"] = "Police Car 3", - ["police4"] = "Police Car 4", - ["policeb"] = "Police Car 5", - ["policet"] = "Police Car 6", - ["sheriff"] = "Sheriff Car 1", - ["sheriff2"] = "Sheriff Car 2", - - }, - -- Grade 2 - [2] = { - ["police"] = "Police Car 1", - ["police2"] = "Police Car 2", - ["police3"] = "Police Car 3", - ["police4"] = "Police Car 4", - ["policeb"] = "Police Car 5", - ["policet"] = "Police Car 6", - ["sheriff"] = "Sheriff Car 1", - ["sheriff2"] = "Sheriff Car 2", - }, - -- Grade 3 - [3] = { - ["police"] = "Police Car 1", - ["police2"] = "Police Car 2", - ["police3"] = "Police Car 3", - ["police4"] = "Police Car 4", - ["policeb"] = "Police Car 5", - ["policet"] = "Police Car 6", - ["sheriff"] = "Sheriff Car 1", - ["sheriff2"] = "Sheriff Car 2", - }, - -- Grade 4 - [4] = { - ["police"] = "Police Car 1", - ["police2"] = "Police Car 2", - ["police3"] = "Police Car 3", - ["police4"] = "Police Car 4", - ["policeb"] = "Police Car 5", - ["policet"] = "Police Car 6", - ["sheriff"] = "Sheriff Car 1", - ["sheriff2"] = "Sheriff Car 2", - } -} - -Config.WhitelistedVehicles = {} - -Config.AmmoLabels = { - ["AMMO_PISTOL"] = "9x19mm parabellum bullet", - ["AMMO_SMG"] = "9x19mm parabellum bullet", - ["AMMO_RIFLE"] = "7.62x39mm bullet", - ["AMMO_MG"] = "7.92x57mm mauser bullet", - ["AMMO_SHOTGUN"] = "12-gauge bullet", - ["AMMO_SNIPER"] = "Large caliber bullet", -} - Config.Radars = { - vector4(-623.44421386719, -823.08361816406, 25.25704574585, 145.0), - vector4(-652.44421386719, -854.08361816406, 24.55704574585, 325.0), - vector4(1623.0114746094, 1068.9924316406, 80.903594970703, 84.0), - vector4(-2604.8994140625, 2996.3391113281, 27.528566360474, 175.0), - vector4(2136.65234375, -591.81469726563, 94.272926330566, 318.0), - vector4(2117.5764160156, -558.51013183594, 95.683128356934, 158.0), - vector4(406.89505004883, -969.06286621094, 29.436267852783, 33.0), - vector4(657.315, -218.819, 44.06, 320.0), - vector4(2118.287, 6040.027, 50.928, 172.0), - vector4(-106.304, -1127.5530, 30.778, 230.0), - vector4(-823.3688, -1146.980, 8.0, 300.0), + vector4(-623.44421386719, -823.08361816406, 25.25704574585, 145.0), + vector4(-652.44421386719, -854.08361816406, 24.55704574585, 325.0), + vector4(1623.0114746094, 1068.9924316406, 80.903594970703, 84.0), + vector4(-2604.8994140625, 2996.3391113281, 27.528566360474, 175.0), + vector4(2136.65234375, -591.81469726563, 94.272926330566, 318.0), + vector4(2117.5764160156, -558.51013183594, 95.683128356934, 158.0), + vector4(406.89505004883, -969.06286621094, 29.436267852783, 33.0), + vector4(657.315, -218.819, 44.06, 320.0), + vector4(2118.287, 6040.027, 50.928, 172.0), + vector4(-106.304, -1127.5530, 30.778, 230.0), + vector4(-823.3688, -1146.980, 8.0, 300.0), } Config.CarItems = { - [1] = { - name = "heavyarmor", - amount = 2, - info = {}, - type = "item", - slot = 1, - }, - [2] = { - name = "empty_evidence_bag", - amount = 10, - info = {}, - type = "item", - slot = 2, - }, - [3] = { - name = "police_stormram", - amount = 1, - info = {}, - type = "item", - slot = 3, + { name = 'heavyarmor', amount = 2 }, + { name = 'empty_evidence_bag', amount = 10 }, + { name = 'police_stormram', amount = 1 }, +} + +Config.AuthorizedVehicles = { + -- Grade 0 and higher + [0] = { + ['police'] = 'Police Car 1', + ['police2'] = 'Police Car 2', + ['police3'] = 'Police Car 3', + ['police4'] = 'Police Car 4', + ['policeb'] = 'Police Car 5', + ['policet'] = 'Police Car 6', + ['sheriff'] = 'Sheriff Car 1', + ['sheriff2'] = 'Sheriff Car 2', }, } Config.Items = { - label = "Police Armory", - slots = 30, - items = { - [1] = { - name = "weapon_pistol", + -- Grade 0 and higher + [0] = { + { + name = 'weapon_pistol', price = 0, - amount = 1, + amount = 50, info = { - serie = "", attachments = { - {component = "COMPONENT_AT_PI_FLSH", label = "Flashlight"}, + { component = 'COMPONENT_AT_PI_FLSH', label = 'Flashlight' }, } - }, - type = "weapon", - slot = 1, - authorizedJobGrades = {0, 1, 2, 3, 4} + } }, - [2] = { - name = "weapon_stungun", + { + name = 'weapon_stungun', price = 0, - amount = 1, - info = { - serie = "", - }, - type = "weapon", - slot = 2, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [3] = { - name = "weapon_pumpshotgun", - price = 0, - amount = 1, + amount = 50, info = { - serie = "", attachments = { - {component = "COMPONENT_AT_AR_FLSH", label = "Flashlight"}, + { component = 'COMPONENT_AT_AR_FLSH', label = 'Flashlight' }, } - }, - type = "weapon", - slot = 3, - authorizedJobGrades = {0, 1, 2, 3, 4} + } }, - [4] = { - name = "weapon_smg", + { + name = 'weapon_pumpshotgun', price = 0, - amount = 1, + amount = 50, info = { - serie = "", attachments = { - {component = "COMPONENT_AT_SCOPE_MACRO_02", label = "1x Scope"}, - {component = "COMPONENT_AT_AR_FLSH", label = "Flashlight"}, + { component = 'COMPONENT_AT_AR_FLSH', label = 'Flashlight' }, } - }, - type = "weapon", - slot = 4, - authorizedJobGrades = {0, 1, 2, 3, 4} + } }, - [5] = { - name = "weapon_carbinerifle", + { + name = 'weapon_smg', price = 0, - amount = 1, + amount = 50, info = { - serie = "", attachments = { - {component = "COMPONENT_AT_AR_FLSH", label = "Flashlight"}, - {component = "COMPONENT_AT_SCOPE_MEDIUM", label = "3x Scope"}, + { component = 'COMPONENT_AT_SCOPE_MACRO_02', label = '1x Scope' }, + { component = 'COMPONENT_AT_AR_FLSH', label = 'Flashlight' }, } - }, - type = "weapon", - slot = 5, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [6] = { - name = "weapon_nightstick", - price = 0, - amount = 1, - info = {}, - type = "weapon", - slot = 6, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [7] = { - name = "pistol_ammo", - price = 0, - amount = 5, - info = {}, - type = "item", - slot = 7, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [8] = { - name = "smg_ammo", - price = 0, - amount = 5, - info = {}, - type = "item", - slot = 8, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [9] = { - name = "shotgun_ammo", - price = 0, - amount = 5, - info = {}, - type = "item", - slot = 9, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [10] = { - name = "rifle_ammo", - price = 0, - amount = 5, - info = {}, - type = "item", - slot = 10, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [11] = { - name = "handcuffs", - price = 0, - amount = 1, - info = {}, - type = "item", - slot = 11, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [12] = { - name = "weapon_flashlight", - price = 0, - amount = 1, - info = {}, - type = "weapon", - slot = 12, - authorizedJobGrades = {0, 1, 2, 3, 4} + } }, - [13] = { - name = "empty_evidence_bag", + { + name = 'weapon_carbinerifle', price = 0, amount = 50, - info = {}, - type = "item", - slot = 13, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [14] = { - name = "police_stormram", - price = 0, - amount = 50, - info = {}, - type = "item", - slot = 14, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [15] = { - name = "armor", - price = 0, - amount = 50, - info = {}, - type = "item", - slot = 15, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [16] = { - name = "radio", - price = 0, - amount = 50, - info = {}, - type = "item", - slot = 16, - authorizedJobGrades = {0, 1, 2, 3, 4} - }, - [17] = { - name = "heavyarmor", - price = 0, - amount = 50, - info = {}, - type = "item", - slot = 17, - authorizedJobGrades = {0, 1, 2, 3, 4} - } + info = { + attachments = { + { component = 'COMPONENT_AT_AR_FLSH', label = 'Flashlight' }, + { component = 'COMPONENT_AT_SCOPE_MEDIUM', label = '3x Scope' }, + } + } + }, + { name = 'weapon_nightstick', price = 0, amount = 50 }, + { name = 'weapon_flashlight', price = 0, amount = 50 }, + { name = 'pistol_ammo', price = 0, amount = 50 }, + { name = 'smg_ammo', price = 0, amount = 50 }, + { name = 'shotgun_ammo', price = 0, amount = 50 }, + { name = 'rifle_ammo', price = 0, amount = 50 }, + { name = 'handcuffs', price = 0, amount = 50 }, + { name = 'empty_evidence_bag', price = 0, amount = 50 }, + { name = 'police_stormram', price = 0, amount = 50 }, + { name = 'armor', price = 0, amount = 50 }, + { name = 'radio', price = 0, amount = 50 }, + { name = 'heavyarmor', price = 0, amount = 50 }, } } Config.VehicleSettings = { - ["car1"] = { --- Model name - ["extras"] = { - ["1"] = true, -- on/off - ["2"] = true, - ["3"] = true, - ["4"] = true, - ["5"] = true, - ["6"] = true, - ["7"] = true, - ["8"] = true, - ["9"] = true, - ["10"] = true, - ["11"] = true, - ["12"] = true, - ["13"] = true, - }, - ["livery"] = 1, + ['car1'] = { --- Model name + ['extras'] = { + ['1'] = true, -- on/off + ['2'] = true, + ['3'] = true, + ['4'] = true, + ['5'] = true, + ['6'] = true, + ['7'] = true, + ['8'] = true, + ['9'] = true, + ['10'] = true, + ['11'] = true, + ['12'] = true, + ['13'] = true, + }, + ['livery'] = 1, }, - ["car2"] = { - ["extras"] = { - ["1"] = true, - ["2"] = true, - ["3"] = true, - ["4"] = true, - ["5"] = true, - ["6"] = true, - ["7"] = true, - ["8"] = true, - ["9"] = true, - ["10"] = true, - ["11"] = true, - ["12"] = true, - ["13"] = true, - }, - ["livery"] = 1, + ['car2'] = { + ['extras'] = { + ['1'] = true, + ['2'] = true, + ['3'] = true, + ['4'] = true, + ['5'] = true, + ['6'] = true, + ['7'] = true, + ['8'] = true, + ['9'] = true, + ['10'] = true, + ['11'] = true, + ['12'] = true, + ['13'] = true, + }, + ['livery'] = 1, } } diff --git a/fxmanifest.lua b/fxmanifest.lua index e613da45..9aef2ea7 100644 --- a/fxmanifest.lua +++ b/fxmanifest.lua @@ -1,14 +1,14 @@ fx_version 'cerulean' game 'gta5' - +lua54 'yes' description 'QB-PoliceJob' -version '1.2.5' +version '1.3.5' shared_scripts { - 'config.lua', - '@qb-core/shared/locale.lua', - 'locales/en.lua', - 'locales/*.lua' + 'config.lua', + '@qb-core/shared/locale.lua', + 'locales/en.lua', + 'locales/*.lua' } client_scripts { @@ -42,5 +42,3 @@ files { 'html/main.css', 'html/vcr-ocd.ttf' } - -lua54 'yes' diff --git a/html/index.html b/html/index.html index 3b76225c..56cfd392 100644 --- a/html/index.html +++ b/html/index.html @@ -1,14 +1,14 @@ - + - +
{{ cameraLabel }}
{{ dateLabel }}
@@ -219,16 +203,9 @@
-
- fingerprint + fingerprint
Fingerprint ID

No result

diff --git a/html/main.css b/html/main.css index b7b09643..418afbbe 100644 --- a/html/main.css +++ b/html/main.css @@ -1,342 +1,342 @@ -@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@100&display=swap'); +@import url("https://fonts.googleapis.com/css2?family=Poppins:wght@100&display=swap"); .databank-container { - display:none!important; - user-select: none; + display: none !important; + user-select: none; } /* Police Radar */ #policeradar { - width: 495px; - height: 202px; + width: 495px; + height: 202px; - position: absolute; - bottom: 10px; - right: 10px; - margin: auto; + position: absolute; + bottom: 10px; + right: 10px; + margin: auto; - color: white; - background: rgba(20, 20, 20, 0.97); - background: linear-gradient(to bottom, rgb(50, 50, 50), rgb(25, 25, 25)); - border-radius: 10px; + color: white; + background: rgba(20, 20, 20, 0.97); + background: linear-gradient(to bottom, rgb(50, 50, 50), rgb(25, 25, 25)); + border-radius: 10px; - display: flex; - flex-direction: column; - justify-content: space-around; - align-items: center; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; } #policeradar .antennalabel { - font-family: 'Poppins', sans-serif; - font-size: 14px; - font-weight: bold; - text-align: center; - width: 100%; - position: absolute; + font-family: "Poppins", sans-serif; + font-size: 14px; + font-weight: bold; + text-align: center; + width: 100%; + position: absolute; } #policeradar .antennalabeltop { - top: 0; - left: 0; - padding-top: 5px; + top: 0; + left: 0; + padding-top: 5px; } #policeradar .antennalabelbottom { - bottom: 0; - left: 0; - padding-bottom: 5px; + bottom: 0; + left: 0; + padding-bottom: 5px; } #policeradar .logo { - font-family: 'Poppins', sans-serif; - font-size: 17px; - font-weight: bold; - bottom: 15px; - right: 20px; - position: absolute; + font-family: "Poppins", sans-serif; + font-size: 17px; + font-weight: bold; + bottom: 15px; + right: 20px; + position: absolute; } #policeradar .main { - display: flex; - flex-direction: row; - align-items: center; - justify-content: space-around; - width: 100%; - height: 100%; + display: flex; + flex-direction: row; + align-items: center; + justify-content: space-around; + width: 100%; + height: 100%; } #policeradar .patrolcontainer { - background-color: black; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; + background-color: black; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; } #policeradar .typecontainer { - background-color: black; - display: flex; - flex-direction: column; - align-items: center; - justify-content: flex-start; - width: 0; + background-color: black; + display: flex; + flex-direction: column; + align-items: center; + justify-content: flex-start; + width: 0; } #policeradar .typecontainer .text { - font-family: 'Poppins', sans-serif; - font-size: 10px; - line-height: 27px; - margin-left: 13px; - color: black; + font-family: "Poppins", sans-serif; + font-size: 10px; + line-height: 27px; + margin-left: 13px; + color: black; } #policeradar .typecontainer .active { - color: white; + color: white; } #policeradar .container { - display: flex; - flex-direction: column; - align-items: center; - height: 100%; - justify-content: space-around; + display: flex; + flex-direction: column; + align-items: center; + height: 100%; + justify-content: space-around; } #policeradar .arrowbox { - justify-content: center; - align-items: center; + justify-content: center; + align-items: center; } #policeradar .arrowbox i { - font-size: 20px; - padding-top: 5px; - padding-bottom: 5px; - color: black; + font-size: 20px; + padding-top: 5px; + padding-bottom: 5px; + color: black; } #policeradar .arrowbox .active { - color: white; + color: white; } #policeradar .arrowbox .inactive { - color: black; + color: black; } #policeradar .container .label { - font-family: 'Poppins', sans-serif; - font-weight: bold; - font-size: 10px; - text-align: center; + font-family: "Poppins", sans-serif; + font-weight: bold; + font-size: 10px; + text-align: center; } #policeradar .container .speedsourcecontainer { - width: 135px; - height: 58px; - display: flex; - justify-content: space-around; + width: 135px; + height: 58px; + display: flex; + justify-content: space-around; } #policeradar .container .speedsourcecontainer .speednumber { - width: 100%; + width: 100%; } #policeradar .container .speedsourcecontainer .text { - font-family: 'Poppins', sans-serif; - font-size: 58px; - line-height: 58px; - width: 100%; - text-align: center; + font-family: "Poppins", sans-serif; + font-size: 58px; + line-height: 58px; + width: 100%; + text-align: center; } #policeradar .container .target { - background: rgb(200, 0, 0); - background: linear-gradient(to bottom, rgb(220, 0, 40), rgb(90, 0, 0)); + background: rgb(200, 0, 0); + background: linear-gradient(to bottom, rgb(220, 0, 40), rgb(90, 0, 0)); } #policeradar .container .patrol { - background: rgb(0, 125, 0); - background: linear-gradient(to bottom, rgb(0, 150, 0), rgb(0, 75, 0)); + background: rgb(0, 125, 0); + background: linear-gradient(to bottom, rgb(0, 150, 0), rgb(0, 75, 0)); } #policeradar .container .locked { - color: rgb(50, 0, 0); + color: rgb(50, 0, 0); } #policeradar .container .speedfastcontainer { - width: 99px; - height: 50px; - display: flex; - flex-direction: row; - justify-content: space-around; + width: 99px; + height: 50px; + display: flex; + flex-direction: row; + justify-content: space-around; } #policeradar .container .speedfastcontainer .speednumber { - width: 100%; + width: 100%; } #policeradar .container .speedfastcontainer .text { - font-family: 'Poppins', sans-serif; - font-size: 50px; - line-height: 50px; - width: 100%; - text-align: center; + font-family: "Poppins", sans-serif; + font-size: 50px; + line-height: 50px; + width: 100%; + text-align: center; } /* Police Radar - Remote Control */ #policeradarrc { - width: 290px; - height: 350px; + width: 290px; + height: 350px; - position: absolute; - top: 0; - bottom: 0; - left: 0; - right: 0; - margin: auto; - padding: 10px 5px; + position: absolute; + top: 0; + bottom: 0; + left: 0; + right: 0; + margin: auto; + padding: 10px 5px; - color: white; - background-color: rgba(20, 20, 20, 0.95); - border-radius: 5px; + color: white; + background-color: rgba(20, 20, 20, 0.95); + border-radius: 5px; - display: flex; - flex-direction: column; - justify-content: space-around; - align-items: center; + display: flex; + flex-direction: column; + justify-content: space-around; + align-items: center; } #policeradarrc .breakline { - width: 230px; - height: 10px; - background-color: white; + width: 230px; + height: 10px; + background-color: white; } #policeradarrc .label { - font-family: 'Poppins', sans-serif; + font-family: "Poppins", sans-serif; } #policeradarrc .container { - font-family: 'Poppins', sans-serif; - align-items: center; + font-family: "Poppins", sans-serif; + align-items: center; } #policeradarrc .container button { - display: inline-block; - cursor: pointer; - text-decoration: none; - outline: none; - border: none; + display: inline-block; + cursor: pointer; + text-decoration: none; + outline: none; + border: none; } #policeradarrc .container button:hover { - background-color: #6cd3f9; + background-color: #6cd3f9; } #policeradarrc .container button:active { - background-color: #56a8c7; + background-color: #56a8c7; } #policeradarrc .container .toggle { - padding: 5px 15px; - font-size: 16px; - text-align: center; - color: black; - background-color: white; - border-radius: 15px; - margin-bottom: 15px; + padding: 5px 15px; + font-size: 16px; + text-align: center; + color: black; + background-color: white; + border-radius: 15px; + margin-bottom: 15px; } #policeradarrc .container .limit { - padding: 5px 15px; - font-size: 16px; - text-align: center; - color: black; - background-color: white; - border-radius: 15px; - margin-top: 15px; + padding: 5px 15px; + font-size: 16px; + text-align: center; + color: black; + background-color: white; + border-radius: 15px; + margin-top: 15px; } #policeradarrc .container .close { - padding: 3px 7px; - font-size: 12px; + padding: 3px 7px; + font-size: 12px; } #policeradarrc .container .rowbutton { - width: 60px; - height: 60px; + width: 60px; + height: 60px; } #policeradarrc .container .frontopp { - border-top-left-radius: 50%; + border-top-left-radius: 50%; } #policeradarrc .container .frontsame { - border-top-right-radius: 50%; + border-top-right-radius: 50%; } #policeradarrc .container .rearopp { - border-bottom-left-radius: 50%; + border-bottom-left-radius: 50%; } #policeradarrc .container .rearsame { - border-bottom-right-radius: 50%; + border-bottom-right-radius: 50%; } /* Plate Reader */ #platereader { - width: 300px; - height: 50px; + width: 300px; + height: 50px; - position: absolute; - bottom: 105%; - margin: auto; + position: absolute; + bottom: 105%; + margin: auto; - color: white; - background: rgba(20, 20, 20, 0.97); - background: linear-gradient(to bottom, rgb(50, 50, 50), rgb(25, 25, 25)); - border-radius: 10px; + color: white; + background: rgba(20, 20, 20, 0.97); + background: linear-gradient(to bottom, rgb(50, 50, 50), rgb(25, 25, 25)); + border-radius: 10px; - display: grid; - grid-column-gap: 10px; - grid-row-gap: 10px; - grid-template-columns: repeat(2, 2fr); - background-color: #2196f3; - padding: 2%; + display: grid; + grid-column-gap: 10px; + grid-row-gap: 10px; + grid-template-columns: repeat(2, 2fr); + background-color: #2196f3; + padding: 2%; } #platereader .label { - display: grid; - grid-area: label; + display: grid; + grid-area: label; } #platereader .container { - display: grid; - grid-template-columns: 100%; - grid-template-rows: 75% 25%; - grid-template-areas: - "pReader" - "label"; - background-color: #2196f3; - background: linear-gradient(to bottom, rgb(220, 0, 40), rgb(90, 0, 0)); + display: grid; + grid-template-columns: 100%; + grid-template-rows: 75% 25%; + grid-template-areas: + "pReader" + "label"; + background-color: #2196f3; + background: linear-gradient(to bottom, rgb(220, 0, 40), rgb(90, 0, 0)); } #platereader .pReader { - display: grid; - grid-area: pReader; - font-family: 'Poppins', sans-serif; - font-weight: bold; - font-size: 20px; - letter-spacing: 2px; - text-align: center; - overflow-x: hidden; + display: grid; + grid-area: pReader; + font-family: "Poppins", sans-serif; + font-weight: bold; + font-size: 20px; + letter-spacing: 2px; + text-align: center; + overflow-x: hidden; } #platereader .label { - width: 100%; - height: 100%; - background-color: black; - font-family: 'Poppins', sans-serif; - font-weight: bold; - font-size: 10px; - text-align: center; + width: 100%; + height: 100%; + background-color: black; + font-family: "Poppins", sans-serif; + font-weight: bold; + font-size: 10px; + text-align: center; } diff --git a/html/script.js b/html/script.js index fefd493a..bcb4e271 100644 --- a/html/script.js +++ b/html/script.js @@ -1,5 +1,3 @@ - - const CameraApp = new Vue({ el: "#camcontainer", @@ -15,11 +13,11 @@ const CameraApp = new Vue({ methods: { OpenCameras(label, connected, cameraId, time) { var today = new Date(); - var date = today.getDate()+'/'+(today.getMonth()+1)+'/'+today.getFullYear(); - var formatTime = "00:" + time + var date = today.getDate() + "/" + (today.getMonth() + 1) + "/" + today.getFullYear(); + var formatTime = "00:" + time; this.camerasOpen = true; - this.ipLabel = "145.101.0."+cameraId; + this.ipLabel = "145.101.0." + cameraId; if (connected) { $("#blockscreen").css("display", "none"); this.cameraLabel = label; @@ -31,7 +29,7 @@ const CameraApp = new Vue({ $("#connectedlabel").addClass("connect"); } else { $("#blockscreen").css("display", "block"); - this.cameraLabel = "ERROR #400: BAD REQUEST" + this.cameraLabel = "ERROR #400: BAD REQUEST"; this.connectLabel = "CONNECTION FAILED"; this.dateLabel = "ERROR"; this.timeLabel = "ERROR"; @@ -39,7 +37,6 @@ const CameraApp = new Vue({ $("#connectedlabel").removeClass("connect"); $("#connectedlabel").addClass("disconnect"); } - }, CloseCameras() { @@ -52,81 +49,86 @@ const CameraApp = new Vue({ }, UpdateCameraTime(time) { - var formatTime = "00:" + time + var formatTime = "00:" + time; this.timeLabel = formatTime; }, - } + }, }); -HeliCam = {} -Databank = {} -Fingerprint = {} +HeliCam = {}; +Databank = {}; +Fingerprint = {}; -HeliCam.Open = function(data) { +HeliCam.Open = function (data) { $("#helicontainer").css("display", "block"); $(".scanBar").css("height", "0%"); -} +}; -HeliCam.UpdateScan = function(data) { - $(".scanBar").css("height", data.scanvalue +"%"); -} +HeliCam.UpdateScan = function (data) { + $(".scanBar").css("height", data.scanvalue + "%"); +}; -HeliCam.UpdateVehicleInfo = function(data) { +HeliCam.UpdateVehicleInfo = function (data) { $(".vehicleinfo").css("display", "block"); $(".scanBar").css("height", "100%"); - $(".heli-model").find("p").html("MODEL: " + data.model); - $(".heli-plate").find("p").html("PLATE: " + data.plate); + $(".heli-model") + .find("p") + .html("MODEL: " + data.model); + $(".heli-plate") + .find("p") + .html("PLATE: " + data.plate); $(".heli-street").find("p").html(data.street); - $(".heli-speed").find("p").html(data.speed + " KM/U"); -} + $(".heli-speed") + .find("p") + .html(data.speed + " KM/U"); +}; -HeliCam.DisableVehicleInfo = function() { +HeliCam.DisableVehicleInfo = function () { $(".vehicleinfo").css("display", "none"); -} +}; -HeliCam.Close = function() { +HeliCam.Close = function () { $("#helicontainer").css("display", "none"); $(".vehicleinfo").css("display", "none"); $(".scanBar").css("height", "0%"); -} +}; -Databank.Open = function() { +Databank.Open = function () { $(".databank-container").css("display", "block").css("user-select", "none"); $(".databank-container iframe").css("display", "block"); $(".tablet-frame").css("display", "block").css("user-select", "none"); $(".databank-bg").css("display", "block"); -} +}; -Databank.Close = function() { +Databank.Close = function () { $(".databank-container iframe").css("display", "none"); $(".databank-container").css("display", "none"); $(".tablet-frame").css("display", "none"); $(".databank-bg").css("display", "none"); $.post("https://qb-policejob/closeDatabank", JSON.stringify({})); -} +}; -Fingerprint.Open = function() { +Fingerprint.Open = function () { $(".fingerprint-container").fadeIn(150); $(".fingerprint-id").html("Fingerprint ID

No result

"); -} +}; -Fingerprint.Close = function() { +Fingerprint.Close = function () { $(".fingerprint-container").fadeOut(150); - $.post('https://qb-policejob/closeFingerprint'); -} + $.post("https://qb-policejob/closeFingerprint"); +}; -Fingerprint.Update = function(data) { - $(".fingerprint-id").html("Fingerprint ID

"+data.fingerprintId+"

"); -} +Fingerprint.Update = function (data) { + $(".fingerprint-id").html("Fingerprint ID

" + data.fingerprintId + "

"); +}; -$(document).on('click', '.take-fingerprint', function(){ - $.post('https://qb-policejob/doFingerScan'); -}) +$(document).on("click", ".take-fingerprint", function () { + $.post("https://qb-policejob/doFingerScan"); +}); document.onreadystatechange = () => { if (document.readyState === "complete") { - window.addEventListener('message', function(event) { - + window.addEventListener("message", function (event) { if (event.data.type == "enablecam") { CameraApp.OpenCameras(event.data.label, event.data.connected, event.data.id, event.data.time); } else if (event.data.type == "disablecam") { @@ -157,11 +159,11 @@ document.onreadystatechange = () => { Fingerprint.Update(event.data); } }); - }; + } }; -$(document).on('keydown', function() { - switch(event.keyCode) { +$(document).on("keydown", function () { + switch (event.keyCode) { case 27: // ESC Databank.Close(); Fingerprint.Close(); diff --git a/server/main.lua b/server/main.lua index 202f42e1..184a9a40 100644 --- a/server/main.lua +++ b/server/main.lua @@ -13,12 +13,12 @@ local function UpdateBlips() local dutyPlayers = {} local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and (v.PlayerData.job.name == "police" or v.PlayerData.job.name == "ambulance") and v.PlayerData.job.onduty then + if v and (v.PlayerData.job.type == 'leo' or v.PlayerData.job.type == 'ems') and v.PlayerData.job.onduty then local coords = GetEntityCoords(GetPlayerPed(v.PlayerData.source)) local heading = GetEntityHeading(GetPlayerPed(v.PlayerData.source)) - dutyPlayers[#dutyPlayers+1] = { + dutyPlayers[#dutyPlayers + 1] = { source = v.PlayerData.source, - label = v.PlayerData.metadata["callsign"], + label = v.PlayerData.metadata['callsign'], job = v.PlayerData.job.name, location = { x = coords.x, @@ -29,7 +29,7 @@ local function UpdateBlips() } end end - TriggerClientEvent("police:client:UpdateBlips", -1, dutyPlayers) + TriggerClientEvent('police:client:UpdateBlips', -1, dutyPlayers) end local function CreateBloodId() @@ -85,7 +85,7 @@ local function CreateObjectId() end local function IsVehicleOwned(plate) - local result = MySQL.scalar.await('SELECT plate FROM player_vehicles WHERE plate = ?', {plate}) + local result = MySQL.scalar.await('SELECT plate FROM player_vehicles WHERE plate = ?', { plate }) return result end @@ -93,7 +93,7 @@ local function GetCurrentCops() local amount = 0 local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then amount += 1 end end @@ -101,316 +101,316 @@ local function GetCurrentCops() end local function DnaHash(s) - local h = string.gsub(s, ".", function(c) - return string.format("%02x", string.byte(c)) + local h = string.gsub(s, '.', function(c) + return string.format('%02x', string.byte(c)) end) return h end -- Commands -QBCore.Commands.Add("spikestrip", Lang:t("commands.place_spike"), {}, false, function(source) +QBCore.Commands.Add('spikestrip', Lang:t('commands.place_spike'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then TriggerClientEvent('police:client:SpawnSpikeStrip', src) end end) -QBCore.Commands.Add("grantlicense", Lang:t("commands.license_grant"), {{name = "id", help = Lang:t('info.player_id')}, {name = "license", help = Lang:t('info.license_type')}}, true, function(source, args) +QBCore.Commands.Add('grantlicense', Lang:t('commands.license_grant'), { { name = 'id', help = Lang:t('info.player_id') }, { name = 'license', help = Lang:t('info.license_type') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.grade.level >= Config.LicenseRank then - if args[2] == "driver" or args[2] == "weapon" then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.grade.level >= Config.LicenseRank then + if args[2] == 'driver' or args[2] == 'weapon' then local SearchedPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) if not SearchedPlayer then return end - local licenseTable = SearchedPlayer.PlayerData.metadata["licences"] + local licenseTable = SearchedPlayer.PlayerData.metadata['licences'] if licenseTable[args[2]] then - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.license_already"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.license_already'), 'error') return end licenseTable[args[2]] = true - SearchedPlayer.Functions.SetMetaData("licences", licenseTable) - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("success.granted_license"), "success") - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.grant_license"), "success") + SearchedPlayer.Functions.SetMetaData('licences', licenseTable) + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('success.granted_license'), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.grant_license'), 'success') else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license_type"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.error_license_type'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.rank_license"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.rank_license'), 'error') end end) -QBCore.Commands.Add("revokelicense", Lang:t("commands.license_revoke"), {{name = "id", help = Lang:t('info.player_id')}, {name = "license", help = Lang:t('info.license_type')}}, true, function(source, args) +QBCore.Commands.Add('revokelicense', Lang:t('commands.license_revoke'), { { name = 'id', help = Lang:t('info.player_id') }, { name = 'license', help = Lang:t('info.license_type') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.grade.level >= Config.LicenseRank then - if args[2] == "driver" or args[2] == "weapon" then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.grade.level >= Config.LicenseRank then + if args[2] == 'driver' or args[2] == 'weapon' then local SearchedPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) if not SearchedPlayer then return end - local licenseTable = SearchedPlayer.PlayerData.metadata["licences"] + local licenseTable = SearchedPlayer.PlayerData.metadata['licences'] if not licenseTable[args[2]] then - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.error_license'), 'error') return end licenseTable[args[2]] = false - SearchedPlayer.Functions.SetMetaData("licences", licenseTable) - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("error.revoked_license"), "error") - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.revoke_license"), "success") + SearchedPlayer.Functions.SetMetaData('licences', licenseTable) + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('error.revoked_license'), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.revoke_license'), 'success') else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.error_license"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.error_license'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.rank_revoke"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.rank_revoke'), 'error') end end) -QBCore.Commands.Add("pobject", Lang:t("commands.place_object"), {{name = "type",help = Lang:t("info.poobject_object")}}, true, function(source, args) +QBCore.Commands.Add('pobject', Lang:t('commands.place_object'), { { name = 'type', help = Lang:t('info.poobject_object') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) local type = args[1]:lower() - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - if type == "cone" then - TriggerClientEvent("police:client:spawnCone", src) - elseif type == "barrier" then - TriggerClientEvent("police:client:spawnBarrier", src) - elseif type == "roadsign" then - TriggerClientEvent("police:client:spawnRoadSign", src) - elseif type == "tent" then - TriggerClientEvent("police:client:spawnTent", src) - elseif type == "light" then - TriggerClientEvent("police:client:spawnLight", src) - elseif type == "delete" then - TriggerClientEvent("police:client:deleteObject", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + if type == 'cone' then + TriggerClientEvent('police:client:spawnCone', src) + elseif type == 'barrier' then + TriggerClientEvent('police:client:spawnBarrier', src) + elseif type == 'roadsign' then + TriggerClientEvent('police:client:spawnRoadSign', src) + elseif type == 'tent' then + TriggerClientEvent('police:client:spawnTent', src) + elseif type == 'light' then + TriggerClientEvent('police:client:spawnLight', src) + elseif type == 'delete' then + TriggerClientEvent('police:client:deleteObject', src) end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("cuff", Lang:t("commands.cuff_player"), {}, false, function(source) +QBCore.Commands.Add('cuff', Lang:t('commands.cuff_player'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:CuffPlayer", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:CuffPlayer', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("escort", Lang:t("commands.escort"), {}, false, function(source) +QBCore.Commands.Add('escort', Lang:t('commands.escort'), {}, false, function(source) local src = source - TriggerClientEvent("police:client:EscortPlayer", src) + TriggerClientEvent('police:client:EscortPlayer', src) end) -QBCore.Commands.Add("callsign", Lang:t("commands.callsign"), {{name = "name", help = Lang:t('info.callsign_name')}}, false, function(source, args) +QBCore.Commands.Add('callsign', Lang:t('commands.callsign'), { { name = 'name', help = Lang:t('info.callsign_name') } }, false, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - Player.Functions.SetMetaData("callsign", table.concat(args, " ")) + Player.Functions.SetMetaData('callsign', table.concat(args, ' ')) end) -QBCore.Commands.Add("clearcasings", Lang:t("commands.clear_casign"), {}, false, function(source) +QBCore.Commands.Add('clearcasings', Lang:t('commands.clear_casign'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("evidence:client:ClearCasingsInArea", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('evidence:client:ClearCasingsInArea', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("jail", Lang:t("commands.jail_player"), {}, false, function(source) +QBCore.Commands.Add('jail', Lang:t('commands.jail_player'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:JailPlayer", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:JailPlayer', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("unjail", Lang:t("commands.unjail_player"), {{name = "id", help = Lang:t('info.player_id')}}, true, function(source, args) +QBCore.Commands.Add('unjail', Lang:t('commands.unjail_player'), { { name = 'id', help = Lang:t('info.player_id') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then local playerId = tonumber(args[1]) - TriggerClientEvent("prison:client:UnjailPerson", playerId) + TriggerClientEvent('prison:client:UnjailPerson', playerId) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("clearblood", Lang:t("commands.clearblood"), {}, false, function(source) +QBCore.Commands.Add('clearblood', Lang:t('commands.clearblood'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("evidence:client:ClearBlooddropsInArea", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('evidence:client:ClearBlooddropsInArea', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("seizecash", Lang:t("commands.seizecash"), {}, false, function(source) +QBCore.Commands.Add('seizecash', Lang:t('commands.seizecash'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:SeizeCash", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:SeizeCash', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("sc", Lang:t("commands.softcuff"), {}, false, function(source) +QBCore.Commands.Add('sc', Lang:t('commands.softcuff'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:CuffPlayerSoft", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:CuffPlayerSoft', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("cam", Lang:t("commands.camera"), {{name = "camid", help = Lang:t('info.camera_id')}}, false, function(source, args) +QBCore.Commands.Add('cam', Lang:t('commands.camera'), { { name = 'camid', help = Lang:t('info.camera_id') } }, false, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:ActiveCamera", src, tonumber(args[1])) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:ActiveCamera', src, tonumber(args[1])) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("flagplate", Lang:t("commands.flagplate"), {{name = "plate", help = Lang:t('info.plate_number')}, {name = "reason", help = Lang:t('info.flag_reason')}}, true, function(source, args) +QBCore.Commands.Add('flagplate', Lang:t('commands.flagplate'), { { name = 'plate', help = Lang:t('info.plate_number') }, { name = 'reason', help = Lang:t('info.flag_reason') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then local reason = {} for i = 2, #args, 1 do - reason[#reason+1] = args[i] + reason[#reason + 1] = args[i] end Plates[args[1]:upper()] = { isflagged = true, - reason = table.concat(reason, " ") + reason = table.concat(reason, ' ') } - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.vehicle_flagged", {vehicle = args[1]:upper(), reason = table.concat(reason, " ")})) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.vehicle_flagged', { vehicle = args[1]:upper(), reason = table.concat(reason, ' ') })) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("unflagplate", Lang:t("commands.unflagplate"), {{name = "plate", help = Lang:t('info.plate_number')}}, true, function(source, args) +QBCore.Commands.Add('unflagplate', Lang:t('commands.unflagplate'), { { name = 'plate', help = Lang:t('info.plate_number') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then if Plates and Plates[args[1]:upper()] then if Plates[args[1]:upper()].isflagged then Plates[args[1]:upper()].isflagged = false - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.unflag_vehicle", {vehicle = args[1]:upper()})) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.unflag_vehicle', { vehicle = args[1]:upper() })) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.vehicle_not_flag"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.vehicle_not_flag'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.vehicle_not_flag"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.vehicle_not_flag'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("plateinfo", Lang:t("commands.plateinfo"), {{name = "plate", help = Lang:t('info.plate_number')}}, true, function(source, args) +QBCore.Commands.Add('plateinfo', Lang:t('commands.plateinfo'), { { name = 'plate', help = Lang:t('info.plate_number') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then if Plates and Plates[args[1]:upper()] then if Plates[args[1]:upper()].isflagged then - TriggerClientEvent('QBCore:Notify', src, Lang:t('success.vehicle_flagged', {plate = args[1]:upper(), reason = Plates[args[1]:upper()].reason}), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.vehicle_flagged', { plate = args[1]:upper(), reason = Plates[args[1]:upper()].reason }), 'success') else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.vehicle_not_flag"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.vehicle_not_flag'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.vehicle_not_flag"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.vehicle_not_flag'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("depot", Lang:t("commands.depot"), {{name = "price", help = Lang:t('info.impound_price')}}, false, function(source, args) +QBCore.Commands.Add('depot', Lang:t('commands.depot'), { { name = 'price', help = Lang:t('info.impound_price') } }, false, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:ImpoundVehicle", src, false, tonumber(args[1])) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:ImpoundVehicle', src, false, tonumber(args[1])) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("impound", Lang:t("commands.impound"), {}, false, function(source) +QBCore.Commands.Add('impound', Lang:t('commands.impound'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:ImpoundVehicle", src, true) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:ImpoundVehicle', src, true) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("paytow", Lang:t("commands.paytow"), {{name = "id", help = Lang:t('info.player_id')}}, true, function(source, args) +QBCore.Commands.Add('paytow', Lang:t('commands.paytow'), { { name = 'id', help = Lang:t('info.player_id') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then local playerId = tonumber(args[1]) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) if OtherPlayer then - if OtherPlayer.PlayerData.job.name == "tow" then - OtherPlayer.Functions.AddMoney("bank", 500, "police-tow-paid") - TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t("success.tow_paid"), 'success') - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.tow_driver_paid")) + if OtherPlayer.PlayerData.job.name == 'tow' then + OtherPlayer.Functions.AddMoney('bank', 500, 'police-tow-paid') + TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t('success.tow_paid'), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.tow_driver_paid')) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_towdriver"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_towdriver'), 'error') end end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("paylawyer", Lang:t("commands.paylawyer"), {{name = "id",help = Lang:t('info.player_id')}}, true, function(source, args) +QBCore.Commands.Add('paylawyer', Lang:t('commands.paylawyer'), { { name = 'id', help = Lang:t('info.player_id') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" or Player.PlayerData.job.name == "judge" then + if Player.PlayerData.job.type == 'leo' or Player.PlayerData.job.name == 'judge' then local playerId = tonumber(args[1]) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) if not OtherPlayer then return end - if OtherPlayer.PlayerData.job.name == "lawyer" then - OtherPlayer.Functions.AddMoney("bank", 500, "police-lawyer-paid") - TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t("success.tow_paid"), 'success') - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.paid_lawyer")) + if OtherPlayer.PlayerData.job.name == 'lawyer' then + OtherPlayer.Functions.AddMoney('bank', 500, 'police-lawyer-paid') + TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t('success.tow_paid'), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.paid_lawyer')) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_lawyer"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_lawyer'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add('fine', Lang:t("commands.fine"), {{name = 'id', help = Lang:t('info.player_id')}, {name = 'amount', help = Lang:t('info.amount')}}, false, function(source, args) +QBCore.Commands.Add('fine', Lang:t('commands.fine'), { { name = 'id', help = Lang:t('info.player_id') }, { name = 'amount', help = Lang:t('info.amount') } }, false, function(source, args) local biller = QBCore.Functions.GetPlayer(source) local billed = QBCore.Functions.GetPlayer(tonumber(args[1])) local amount = tonumber(args[2]) - if biller.PlayerData.job.name == "police" then + if biller.PlayerData.job.type == 'leo' then if billed ~= nil then if biller.PlayerData.citizenid ~= billed.PlayerData.citizenid then if amount and amount > 0 then - if billed.Functions.RemoveMoney('bank', amount, "paid-fine") then - TriggerClientEvent('QBCore:Notify', source, Lang:t("info.fine_issued"), 'success') - TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, Lang:t("info.received_fine")) + if billed.Functions.RemoveMoney('bank', amount, 'paid-fine') then + TriggerClientEvent('QBCore:Notify', source, Lang:t('info.fine_issued'), 'success') + TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, Lang:t('info.received_fine')) exports['qb-management']:AddMoney(biller.PlayerData.job.name, amount) - elseif billed.Functions.RemoveMoney('cash', amount, "paid-fine") then - TriggerClientEvent('QBCore:Notify', source, Lang:t("info.fine_issued"), 'success') - TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, Lang:t("info.received_fine")) + elseif billed.Functions.RemoveMoney('cash', amount, 'paid-fine') then + TriggerClientEvent('QBCore:Notify', source, Lang:t('info.fine_issued'), 'success') + TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, Lang:t('info.received_fine')) exports['qb-management']:AddMoney(biller.PlayerData.job.name, amount) else - MySQL.Async.insert('INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)',{billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid}, function(id) + MySQL.Async.insert('INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)', { billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid }, function(id) if id then TriggerClientEvent('qb-phone:client:AcceptorDenyInvoice', billed.PlayerData.source, id, biller.PlayerData.charinfo.firstname, biller.PlayerData.job.name, biller.PlayerData.citizenid, amount, GetInvokingResource()) end @@ -418,77 +418,77 @@ QBCore.Commands.Add('fine', Lang:t("commands.fine"), {{name = 'id', help = Lang: TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source) end else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.amount_higher"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.amount_higher'), 'error') end else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.fine_yourself"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.fine_yourself'), 'error') end else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.not_online"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.not_online'), 'error') end else - TriggerClientEvent('QBCore:Notify', source, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', source, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("anklet", Lang:t("commands.anklet"), {}, false, function(source) +QBCore.Commands.Add('anklet', Lang:t('commands.anklet'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:CheckDistance", src) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:CheckDistance', src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("ankletlocation", Lang:t("commands.ankletlocation"), {{name = "cid", help = Lang:t('info.citizen_id')}}, true, function(source, args) +QBCore.Commands.Add('ankletlocation', Lang:t('commands.ankletlocation'), { { name = 'cid', help = Lang:t('info.citizen_id') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then local citizenid = args[1] local Target = QBCore.Functions.GetPlayerByCitizenId(citizenid) if not Target then return end - if Target.PlayerData.metadata["tracker"] then - TriggerClientEvent("police:client:SendTrackerLocation", Target.PlayerData.source, src) + if Target.PlayerData.metadata['tracker'] then + TriggerClientEvent('police:client:SendTrackerLocation', Target.PlayerData.source, src) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_anklet"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_anklet'), 'error') end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("takedrivinglicense", Lang:t("commands.drivinglicense"), {}, false, function(source) +QBCore.Commands.Add('takedrivinglicense', Lang:t('commands.drivinglicense'), {}, false, function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.PlayerData.job.name == "police" and Player.PlayerData.job.onduty then - TriggerClientEvent("police:client:SeizeDriverLicense", source) + if Player.PlayerData.job.type == 'leo' and Player.PlayerData.job.onduty then + TriggerClientEvent('police:client:SeizeDriverLicense', source) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.on_duty_police_only"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.on_duty_police_only'), 'error') end end) -QBCore.Commands.Add("takedna", Lang:t("commands.takedna"), {{name = "id", help = Lang:t('info.player_id')}}, true, function(source, args) +QBCore.Commands.Add('takedna', Lang:t('commands.takedna'), { { name = 'id', help = Lang:t('info.player_id') } }, true, function(source, args) local src = source local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(tonumber(args[1])) - if not OtherPlayer or Player.PlayerData.job.name ~= "police" or not Player.PlayerData.job.onduty then return end - if Player.Functions.RemoveItem("empty_evidence_bag", 1) then + if not OtherPlayer or Player.PlayerData.job.name ~= 'police' or not Player.PlayerData.job.onduty then return end + if Player.Functions.RemoveItem('empty_evidence_bag', 1) then local info = { label = Lang:t('info.dna_sample'), - type = "dna", + type = 'dna', dnalabel = DnaHash(OtherPlayer.PlayerData.citizenid) } - if not Player.Functions.AddItem("filled_evidence_bag", 1, false, info) then return end - TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items["filled_evidence_bag"], "add") + if not Player.Functions.AddItem('filled_evidence_bag', 1, false, info) then return end + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['filled_evidence_bag'], 'add') else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.have_evidence_bag"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.have_evidence_bag'), 'error') end end) RegisterNetEvent('police:server:SendTrackerLocation', function(coords, requestId) local Target = QBCore.Functions.GetPlayer(source) - local msg = Lang:t('info.target_location', {firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname}) + local msg = Lang:t('info.target_location', { firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname }) local alertData = { title = Lang:t('info.anklet_location'), coords = { @@ -498,45 +498,45 @@ RegisterNetEvent('police:server:SendTrackerLocation', function(coords, requestId }, description = msg } - TriggerClientEvent("police:client:TrackerMessage", requestId, msg, coords) - TriggerClientEvent("qb-phone:client:addPoliceAlert", requestId, alertData) + TriggerClientEvent('police:client:TrackerMessage', requestId, msg, coords) + TriggerClientEvent('qb-phone:client:addPoliceAlert', requestId, alertData) end) -QBCore.Commands.Add('911p', Lang:t("commands.police_report"), {{name='message', help= Lang:t("commands.message_sent")}}, false, function(source, args) - local src = source +QBCore.Commands.Add('911p', Lang:t('commands.police_report'), { { name = 'message', help = Lang:t('commands.message_sent') } }, false, function(source, args) + local src = source local message - if args[1] then message = table.concat(args, " ") else message = Lang:t("commands.civilian_call") end + if args[1] then message = table.concat(args, ' ') else message = Lang:t('commands.civilian_call') end local ped = GetPlayerPed(src) local coords = GetEntityCoords(ped) local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == 'police' and v.PlayerData.job.onduty then - local alertData = {title = Lang:t("commands.emergency_call"), coords = {x = coords.x, y = coords.y, z = coords.z}, description = message} - TriggerClientEvent("qb-phone:client:addPoliceAlert", v.PlayerData.source, alertData) + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then + local alertData = { title = Lang:t('commands.emergency_call'), coords = { x = coords.x, y = coords.y, z = coords.z }, description = message } + TriggerClientEvent('qb-phone:client:addPoliceAlert', v.PlayerData.source, alertData) TriggerClientEvent('police:client:policeAlert', v.PlayerData.source, coords, message) end end end) -- Items -QBCore.Functions.CreateUseableItem("handcuffs", function(source) +QBCore.Functions.CreateUseableItem('handcuffs', function(source) local src = source local Player = QBCore.Functions.GetPlayer(src) - if not Player.Functions.GetItemByName("handcuffs") then return end - TriggerClientEvent("police:client:CuffPlayerSoft", src) + if not Player.Functions.GetItemByName('handcuffs') then return end + TriggerClientEvent('police:client:CuffPlayerSoft', src) end) -QBCore.Functions.CreateUseableItem("moneybag", function(source, item) +QBCore.Functions.CreateUseableItem('moneybag', function(source, item) local src = source local Player = QBCore.Functions.GetPlayer(src) - if not Player or not Player.Functions.GetItemByName("moneybag") or not item.info or item.info == "" or Player.PlayerData.job.name == "police" or not Player.Functions.RemoveItem("moneybag", 1, item.slot) then return end - Player.Functions.AddMoney("cash", tonumber(item.info.cash), "used-moneybag") + if not Player or not Player.Functions.GetItemByName('moneybag') or not item.info or item.info == '' or Player.PlayerData.job.type == 'leo' or not Player.Functions.RemoveItem('moneybag', 1, item.slot) then return end + Player.Functions.AddMoney('cash', tonumber(item.info.cash), 'used-moneybag') end) -- Callbacks QBCore.Functions.CreateCallback('police:server:isPlayerDead', function(_, cb, playerId) local Player = QBCore.Functions.GetPlayer(playerId) - cb(Player.PlayerData.metadata["isdead"]) + cb(Player.PlayerData.metadata['isdead']) end) QBCore.Functions.CreateCallback('police:GetPlayerStatus', function(_, cb, playerId) @@ -545,7 +545,7 @@ QBCore.Functions.CreateCallback('police:GetPlayerStatus', function(_, cb, player if Player then if PlayerStatus[Player.PlayerData.source] and next(PlayerStatus[Player.PlayerData.source]) then for k in pairs(PlayerStatus[Player.PlayerData.source]) do - statList[#statList+1] = PlayerStatus[Player.PlayerData.source][k].text + statList[#statList + 1] = PlayerStatus[Player.PlayerData.source][k].text end end end @@ -554,15 +554,15 @@ end) QBCore.Functions.CreateCallback('police:IsSilencedWeapon', function(source, cb, weapon) local Player = QBCore.Functions.GetPlayer(source) - local itemInfo = Player.Functions.GetItemByName(QBCore.Shared.Weapons[weapon]["name"]) + local itemInfo = Player.Functions.GetItemByName(QBCore.Shared.Weapons[weapon]['name']) local retval = false if itemInfo then if itemInfo.info and itemInfo.info.attachments then for k in pairs(itemInfo.info.attachments) do - if itemInfo.info.attachments[k].component == "COMPONENT_AT_AR_SUPP_02" or - itemInfo.info.attachments[k].component == "COMPONENT_AT_AR_SUPP" or - itemInfo.info.attachments[k].component == "COMPONENT_AT_PI_SUPP_02" or - itemInfo.info.attachments[k].component == "COMPONENT_AT_PI_SUPP" then + if itemInfo.info.attachments[k].component == 'COMPONENT_AT_AR_SUPP_02' or + itemInfo.info.attachments[k].component == 'COMPONENT_AT_AR_SUPP' or + itemInfo.info.attachments[k].component == 'COMPONENT_AT_PI_SUPP_02' or + itemInfo.info.attachments[k].component == 'COMPONENT_AT_PI_SUPP' then retval = true end end @@ -575,10 +575,10 @@ QBCore.Functions.CreateCallback('police:GetDutyPlayers', function(_, cb) local dutyPlayers = {} local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then - dutyPlayers[#dutyPlayers+1] = { + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then + dutyPlayers[#dutyPlayers + 1] = { source = v.PlayerData.source, - label = v.PlayerData.metadata["callsign"], + label = v.PlayerData.metadata['callsign'], job = v.PlayerData.job.name } end @@ -588,7 +588,7 @@ end) QBCore.Functions.CreateCallback('police:GetImpoundedVehicles', function(_, cb) local vehicles = {} - MySQL.query('SELECT * FROM player_vehicles WHERE state = ?', {2}, function(result) + MySQL.query('SELECT * FROM player_vehicles WHERE state = ?', { 2 }, function(result) if result[1] then vehicles = result end @@ -610,7 +610,7 @@ QBCore.Functions.CreateCallback('police:GetCops', function(_, cb) local amount = 0 local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then amount = amount + 1 end end @@ -621,7 +621,7 @@ QBCore.Functions.CreateCallback('police:server:IsPoliceForcePresent', function(_ local retval = false local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == "police" and v.PlayerData.job.grade.level >= 2 then + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.grade.level >= 2 then retval = true break end @@ -644,9 +644,9 @@ RegisterNetEvent('police:server:policeAlert', function(text) local coords = GetEntityCoords(ped) local players = QBCore.Functions.GetQBPlayers() for _, v in pairs(players) do - if v and v.PlayerData.job.name == 'police' and v.PlayerData.job.onduty then - local alertData = {title = Lang:t('info.new_call'), coords = {x = coords.x, y = coords.y, z = coords.z}, description = text} - TriggerClientEvent("qb-phone:client:addPoliceAlert", v.PlayerData.source, alertData) + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then + local alertData = { title = Lang:t('info.new_call'), coords = { x = coords.x, y = coords.y, z = coords.z }, description = text } + TriggerClientEvent('qb-phone:client:addPoliceAlert', v.PlayerData.source, alertData) TriggerClientEvent('police:client:policeAlert', v.PlayerData.source, coords, text) end end @@ -656,11 +656,11 @@ RegisterNetEvent('police:server:TakeOutImpound', function(plate, garage) local src = source local playerPed = GetPlayerPed(src) local playerCoords = GetEntityCoords(playerPed) - local targetCoords = Config.Locations["impound"][garage] - if #(playerCoords - targetCoords) > 10.0 then return DropPlayer(src, "Attempted exploit abuse") end + local targetCoords = Config.Locations['impound'][garage] + if #(playerCoords - targetCoords) > 10.0 then return DropPlayer(src, 'Attempted exploit abuse') end - MySQL.update('UPDATE player_vehicles SET state = ? WHERE plate = ?', {0, plate}) - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.impound_vehicle_removed"), 'success') + MySQL.update('UPDATE player_vehicles SET state = ? WHERE plate = ?', { 0, plate }) + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.impound_vehicle_removed'), 'success') end) RegisterNetEvent('police:server:CuffPlayer', function(playerId, isSoftcuff) @@ -669,13 +669,13 @@ RegisterNetEvent('police:server:CuffPlayer', function(playerId, isSoftcuff) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(src) local CuffedPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not CuffedPlayer or (not Player.Functions.GetItemByName("handcuffs") and Player.PlayerData.job.name ~= "police") then return end + if not Player or not CuffedPlayer or (not Player.Functions.GetItemByName('handcuffs') and Player.PlayerData.job.name ~= 'police') then return end - TriggerClientEvent("police:client:GetCuffed", CuffedPlayer.PlayerData.source, Player.PlayerData.source, isSoftcuff) + TriggerClientEvent('police:client:GetCuffed', CuffedPlayer.PlayerData.source, Player.PlayerData.source, isSoftcuff) end) RegisterNetEvent('police:server:EscortPlayer', function(playerId) @@ -684,16 +684,16 @@ RegisterNetEvent('police:server:EscortPlayer', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(source) local EscortPlayer = QBCore.Functions.GetPlayer(playerId) if not Player or not EscortPlayer then return end - if (Player.PlayerData.job.name == "police" or Player.PlayerData.job.name == "ambulance") or (EscortPlayer.PlayerData.metadata["ishandcuffed"] or EscortPlayer.PlayerData.metadata["isdead"] or EscortPlayer.PlayerData.metadata["inlaststand"]) then - TriggerClientEvent("police:client:GetEscorted", EscortPlayer.PlayerData.source, Player.PlayerData.source) + if (Player.PlayerData.job.type == 'leo' or Player.PlayerData.job.name == 'ambulance') or (EscortPlayer.PlayerData.metadata['ishandcuffed'] or EscortPlayer.PlayerData.metadata['isdead'] or EscortPlayer.PlayerData.metadata['inlaststand']) then + TriggerClientEvent('police:client:GetEscorted', EscortPlayer.PlayerData.source, Player.PlayerData.source) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_cuffed_dead"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_cuffed_dead'), 'error') end end) @@ -703,17 +703,17 @@ RegisterNetEvent('police:server:KidnapPlayer', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(source) local EscortPlayer = QBCore.Functions.GetPlayer(playerId) if not Player or not EscortPlayer then return end - if EscortPlayer.PlayerData.metadata["ishandcuffed"] or EscortPlayer.PlayerData.metadata["isdead"] or EscortPlayer.PlayerData.metadata["inlaststand"] then - TriggerClientEvent("police:client:GetKidnappedTarget", EscortPlayer.PlayerData.source, Player.PlayerData.source) - TriggerClientEvent("police:client:GetKidnappedDragger", Player.PlayerData.source, EscortPlayer.PlayerData.source) + if EscortPlayer.PlayerData.metadata['ishandcuffed'] or EscortPlayer.PlayerData.metadata['isdead'] or EscortPlayer.PlayerData.metadata['inlaststand'] then + TriggerClientEvent('police:client:GetKidnappedTarget', EscortPlayer.PlayerData.source, Player.PlayerData.source) + TriggerClientEvent('police:client:GetKidnappedDragger', Player.PlayerData.source, EscortPlayer.PlayerData.source) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_cuffed_dead"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_cuffed_dead'), 'error') end end) @@ -723,15 +723,15 @@ RegisterNetEvent('police:server:SetPlayerOutVehicle', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local EscortPlayer = QBCore.Functions.GetPlayer(playerId) if not QBCore.Functions.GetPlayer(src) or not EscortPlayer then return end - if EscortPlayer.PlayerData.metadata["ishandcuffed"] or EscortPlayer.PlayerData.metadata["isdead"] then - TriggerClientEvent("police:client:SetOutVehicle", EscortPlayer.PlayerData.source) + if EscortPlayer.PlayerData.metadata['ishandcuffed'] or EscortPlayer.PlayerData.metadata['isdead'] then + TriggerClientEvent('police:client:SetOutVehicle', EscortPlayer.PlayerData.source) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_cuffed_dead"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_cuffed_dead'), 'error') end end) @@ -741,15 +741,15 @@ RegisterNetEvent('police:server:PutPlayerInVehicle', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local EscortPlayer = QBCore.Functions.GetPlayer(playerId) if not QBCore.Functions.GetPlayer(src) or not EscortPlayer then return end - if EscortPlayer.PlayerData.metadata["ishandcuffed"] or EscortPlayer.PlayerData.metadata["isdead"] then - TriggerClientEvent("police:client:PutInVehicle", EscortPlayer.PlayerData.source) + if EscortPlayer.PlayerData.metadata['ishandcuffed'] or EscortPlayer.PlayerData.metadata['isdead'] then + TriggerClientEvent('police:client:PutInVehicle', EscortPlayer.PlayerData.source) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.not_cuffed_dead"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.not_cuffed_dead'), 'error') end end) @@ -759,15 +759,15 @@ RegisterNetEvent('police:server:BillPlayer', function(playerId, price) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not OtherPlayer or Player.PlayerData.job.name ~= "police" then return end + if not Player or not OtherPlayer or Player.PlayerData.job.name ~= 'police' then return end - OtherPlayer.Functions.RemoveMoney("bank", price, "paid-bills") - exports['qb-management']:AddMoney("police", price) - TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t("info.fine_received", {fine = price})) + OtherPlayer.Functions.RemoveMoney('bank', price, 'paid-bills') + exports['qb-management']:AddMoney('police', price) + TriggerClientEvent('QBCore:Notify', OtherPlayer.PlayerData.source, Lang:t('info.fine_received', { fine = price })) end) RegisterNetEvent('police:server:JailPlayer', function(playerId, time) @@ -776,31 +776,31 @@ RegisterNetEvent('police:server:JailPlayer', function(playerId, time) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(src) local OtherPlayer = QBCore.Functions.GetPlayer(playerId) - if not Player or not OtherPlayer or Player.PlayerData.job.name ~= "police" then return end + if not Player or not OtherPlayer or Player.PlayerData.job.name ~= 'police' then return end - local currentDate = os.date("*t") + local currentDate = os.date('*t') if currentDate.day == 31 then currentDate.day = 30 end - OtherPlayer.Functions.SetMetaData("injail", time) - OtherPlayer.Functions.SetMetaData("criminalrecord", { - ["hasRecord"] = true, - ["date"] = currentDate + OtherPlayer.Functions.SetMetaData('injail', time) + OtherPlayer.Functions.SetMetaData('criminalrecord', { + ['hasRecord'] = true, + ['date'] = currentDate }) - TriggerClientEvent("police:client:SendToJail", OtherPlayer.PlayerData.source, time) - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.sent_jail_for", {time = time})) + TriggerClientEvent('police:client:SendToJail', OtherPlayer.PlayerData.source, time) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.sent_jail_for', { time = time })) end) RegisterNetEvent('police:server:SetHandcuffStatus', function(isHandcuffed) local src = source local Player = QBCore.Functions.GetPlayer(src) if Player then - Player.Functions.SetMetaData("ishandcuffed", isHandcuffed) + Player.Functions.SetMetaData('ishandcuffed', isHandcuffed) end end) @@ -839,13 +839,13 @@ RegisterNetEvent('police:server:SearchPlayer', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local SearchedPlayer = QBCore.Functions.GetPlayer(playerId) if not QBCore.Functions.GetPlayer(src) or not SearchedPlayer then return end - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.cash_found", {cash = SearchedPlayer.PlayerData.money["cash"]})) - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("info.being_searched")) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.cash_found', { cash = SearchedPlayer.PlayerData.money['cash'] })) + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('info.being_searched')) end) RegisterNetEvent('police:server:SeizeCash', function(playerId) @@ -854,18 +854,18 @@ RegisterNetEvent('police:server:SeizeCash', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(src) local SearchedPlayer = QBCore.Functions.GetPlayer(playerId) if not Player or not SearchedPlayer then return end - local moneyAmount = SearchedPlayer.PlayerData.money["cash"] + local moneyAmount = SearchedPlayer.PlayerData.money['cash'] local info = { cash = moneyAmount } - SearchedPlayer.Functions.RemoveMoney("cash", moneyAmount, "police-cash-seized") - Player.Functions.AddItem("moneybag", 1, false, info) - TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items["moneybag"], "add") - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("info.cash_confiscated")) + SearchedPlayer.Functions.RemoveMoney('cash', moneyAmount, 'police-cash-seized') + Player.Functions.AddItem('moneybag', 1, false, info) + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['moneybag'], 'add') + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('info.cash_confiscated')) end) RegisterNetEvent('police:server:SeizeDriverLicense', function(playerId) @@ -874,18 +874,18 @@ RegisterNetEvent('police:server:SeizeDriverLicense', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local SearchedPlayer = QBCore.Functions.GetPlayer(playerId) if not QBCore.Functions.GetPlayer(src) or not SearchedPlayer then return end - local driverLicense = SearchedPlayer.PlayerData.metadata["licences"]["driver"] + local driverLicense = SearchedPlayer.PlayerData.metadata['licences']['driver'] if driverLicense then - local licenses = {["driver"] = false, ["business"] = SearchedPlayer.PlayerData.metadata["licences"]["business"]} - SearchedPlayer.Functions.SetMetaData("licences", licenses) - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("info.driving_license_confiscated")) + local licenses = { ['driver'] = false, ['business'] = SearchedPlayer.PlayerData.metadata['licences']['business'] } + SearchedPlayer.Functions.SetMetaData('licences', licenses) + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('info.driving_license_confiscated')) else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.no_driver_license"), 'error') + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.no_driver_license'), 'error') end end) @@ -895,17 +895,17 @@ RegisterNetEvent('police:server:RobPlayer', function(playerId) local targetPed = GetPlayerPed(playerId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Player = QBCore.Functions.GetPlayer(src) local SearchedPlayer = QBCore.Functions.GetPlayer(playerId) if not Player or not SearchedPlayer then return end - local money = SearchedPlayer.PlayerData.money["cash"] - Player.Functions.AddMoney("cash", money, "police-player-robbed") - SearchedPlayer.Functions.RemoveMoney("cash", money, "police-player-robbed") - TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t("info.cash_robbed", {money = money})) - TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t("info.stolen_money", {stolen = money})) + local money = SearchedPlayer.PlayerData.money['cash'] + Player.Functions.AddMoney('cash', money, 'police-player-robbed') + SearchedPlayer.Functions.RemoveMoney('cash', money, 'police-player-robbed') + TriggerClientEvent('QBCore:Notify', SearchedPlayer.PlayerData.source, Lang:t('info.cash_robbed', { money = money })) + TriggerClientEvent('QBCore:Notify', Player.PlayerData.source, Lang:t('info.stolen_money', { stolen = money })) end) RegisterNetEvent('police:server:UpdateBlips', function() @@ -916,7 +916,7 @@ RegisterNetEvent('police:server:spawnObject', function(type) local src = source local objectId = CreateObjectId() Objects[objectId] = type - TriggerClientEvent("police:client:spawnObject", src, objectId, type, src) + TriggerClientEvent('police:client:spawnObject', src, objectId, type, src) end) RegisterNetEvent('police:server:deleteObject', function(objectId) @@ -930,13 +930,13 @@ RegisterNetEvent('police:server:Impound', function(plate, fullImpound, price, bo if not fullImpound then MySQL.query( 'UPDATE player_vehicles SET state = ?, depotprice = ?, body = ?, engine = ?, fuel = ? WHERE plate = ?', - {0, price, body, engine, fuel, plate}) - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.vehicle_taken_depot", {price = price})) + { 0, price, body, engine, fuel, plate }) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.vehicle_taken_depot', { price = price })) else MySQL.query( 'UPDATE player_vehicles SET state = ?, body = ?, engine = ?, fuel = ? WHERE plate = ?', - {2, body, engine, fuel, plate}) - TriggerClientEvent('QBCore:Notify', src, Lang:t("info.vehicle_seized")) + { 2, body, engine, fuel, plate }) + TriggerClientEvent('QBCore:Notify', src, Lang:t('info.vehicle_seized')) end end end) @@ -952,21 +952,21 @@ RegisterNetEvent('evidence:server:CreateBloodDrop', function(citizenid, bloodtyp dna = citizenid, bloodtype = bloodtype } - TriggerClientEvent("evidence:client:AddBlooddrop", -1, bloodId, citizenid, bloodtype, coords) + TriggerClientEvent('evidence:client:AddBlooddrop', -1, bloodId, citizenid, bloodtype, coords) end) RegisterNetEvent('evidence:server:CreateFingerDrop', function(coords) local src = source local Player = QBCore.Functions.GetPlayer(src) local fingerId = CreateFingerId() - FingerDrops[fingerId] = Player.PlayerData.metadata["fingerprint"] - TriggerClientEvent("evidence:client:AddFingerPrint", -1, fingerId, Player.PlayerData.metadata["fingerprint"], coords) + FingerDrops[fingerId] = Player.PlayerData.metadata['fingerprint'] + TriggerClientEvent('evidence:client:AddFingerPrint', -1, fingerId, Player.PlayerData.metadata['fingerprint'], coords) end) RegisterNetEvent('evidence:server:ClearBlooddrops', function(blooddropList) if blooddropList and next(blooddropList) then for _, v in pairs(blooddropList) do - TriggerClientEvent("evidence:client:RemoveBlooddrop", -1, v) + TriggerClientEvent('evidence:client:RemoveBlooddrop', -1, v) BloodDrops[v] = nil end end @@ -975,28 +975,28 @@ end) RegisterNetEvent('evidence:server:AddBlooddropToInventory', function(bloodId, bloodInfo) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.Functions.RemoveItem("empty_evidence_bag", 1) then - if Player.Functions.AddItem("filled_evidence_bag", 1, false, bloodInfo) then - TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items["filled_evidence_bag"], "add") - TriggerClientEvent("evidence:client:RemoveBlooddrop", -1, bloodId) + if Player.Functions.RemoveItem('empty_evidence_bag', 1) then + if Player.Functions.AddItem('filled_evidence_bag', 1, false, bloodInfo) then + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['filled_evidence_bag'], 'add') + TriggerClientEvent('evidence:client:RemoveBlooddrop', -1, bloodId) BloodDrops[bloodId] = nil end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.have_evidence_bag"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.have_evidence_bag'), 'error') end end) RegisterNetEvent('evidence:server:AddFingerprintToInventory', function(fingerId, fingerInfo) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.Functions.RemoveItem("empty_evidence_bag", 1) then - if Player.Functions.AddItem("filled_evidence_bag", 1, false, fingerInfo) then - TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items["filled_evidence_bag"], "add") - TriggerClientEvent("evidence:client:RemoveFingerprint", -1, fingerId) + if Player.Functions.RemoveItem('empty_evidence_bag', 1) then + if Player.Functions.AddItem('filled_evidence_bag', 1, false, fingerInfo) then + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['filled_evidence_bag'], 'add') + TriggerClientEvent('evidence:client:RemoveFingerprint', -1, fingerId) FingerDrops[fingerId] = nil end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.have_evidence_bag"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.have_evidence_bag'), 'error') end end) @@ -1007,14 +1007,14 @@ RegisterNetEvent('evidence:server:CreateCasing', function(weapon, coords) local weaponInfo = QBCore.Shared.Weapons[weapon] local serieNumber = nil if weaponInfo then - local weaponItem = Player.Functions.GetItemByName(weaponInfo["name"]) + local weaponItem = Player.Functions.GetItemByName(weaponInfo['name']) if weaponItem then - if weaponItem.info and weaponItem.info ~= "" then + if weaponItem.info and weaponItem.info ~= '' then serieNumber = weaponItem.info.serie end end end - TriggerClientEvent("evidence:client:AddCasing", -1, casingId, weapon, coords, serieNumber) + TriggerClientEvent('evidence:client:AddCasing', -1, casingId, weapon, coords, serieNumber) end) RegisterNetEvent('police:server:UpdateCurrentCops', function() @@ -1023,18 +1023,18 @@ RegisterNetEvent('police:server:UpdateCurrentCops', function() if updatingCops then return end updatingCops = true for _, v in pairs(players) do - if v and v.PlayerData.job.name == "police" and v.PlayerData.job.onduty then + if v and v.PlayerData.job.type == 'leo' and v.PlayerData.job.onduty then amount += 1 end end - TriggerClientEvent("police:SetCopCount", -1, amount) + TriggerClientEvent('police:SetCopCount', -1, amount) updatingCops = false end) RegisterNetEvent('evidence:server:ClearCasings', function(casingList) if casingList and next(casingList) then for _, v in pairs(casingList) do - TriggerClientEvent("evidence:client:RemoveCasing", -1, v) + TriggerClientEvent('evidence:client:RemoveCasing', -1, v) Casings[v] = nil end end @@ -1043,14 +1043,14 @@ end) RegisterNetEvent('evidence:server:AddCasingToInventory', function(casingId, casingInfo) local src = source local Player = QBCore.Functions.GetPlayer(src) - if Player.Functions.RemoveItem("empty_evidence_bag", 1) then - if Player.Functions.AddItem("filled_evidence_bag", 1, false, casingInfo) then - TriggerClientEvent("inventory:client:ItemBox", src, QBCore.Shared.Items["filled_evidence_bag"], "add") - TriggerClientEvent("evidence:client:RemoveCasing", -1, casingId) + if Player.Functions.RemoveItem('empty_evidence_bag', 1) then + if Player.Functions.AddItem('filled_evidence_bag', 1, false, casingInfo) then + TriggerClientEvent('inventory:client:ItemBox', src, QBCore.Shared.Items['filled_evidence_bag'], 'add') + TriggerClientEvent('evidence:client:RemoveCasing', -1, casingId) Casings[casingId] = nil end else - TriggerClientEvent('QBCore:Notify', src, Lang:t("error.have_evidence_bag"), "error") + TriggerClientEvent('QBCore:Notify', src, Lang:t('error.have_evidence_bag'), 'error') end end) @@ -1063,7 +1063,7 @@ end) RegisterNetEvent('police:server:showFingerprintId', function(sessionId) local src = source local Player = QBCore.Functions.GetPlayer(src) - local fid = Player.PlayerData.metadata["fingerprint"] + local fid = Player.PlayerData.metadata['fingerprint'] TriggerClientEvent('police:client:showFingerprintId', sessionId, fid) TriggerClientEvent('police:client:showFingerprintId', src, fid) end) @@ -1074,21 +1074,21 @@ RegisterNetEvent('police:server:SetTracker', function(targetId) local targetPed = GetPlayerPed(targetId) local playerCoords = GetEntityCoords(playerPed) local targetCoords = GetEntityCoords(targetPed) - if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, "Attempted exploit abuse") end + if #(playerCoords - targetCoords) > 2.5 then return DropPlayer(src, 'Attempted exploit abuse') end local Target = QBCore.Functions.GetPlayer(targetId) if not QBCore.Functions.GetPlayer(src) or not Target then return end - local TrackerMeta = Target.PlayerData.metadata["tracker"] + local TrackerMeta = Target.PlayerData.metadata['tracker'] if TrackerMeta then - Target.Functions.SetMetaData("tracker", false) - TriggerClientEvent('QBCore:Notify', targetId, Lang:t("success.anklet_taken_off"), 'success') - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.took_anklet_from", {firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname}), 'success') + Target.Functions.SetMetaData('tracker', false) + TriggerClientEvent('QBCore:Notify', targetId, Lang:t('success.anklet_taken_off'), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.took_anklet_from', { firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname }), 'success') TriggerClientEvent('police:client:SetTracker', targetId, false) else - Target.Functions.SetMetaData("tracker", true) - TriggerClientEvent('QBCore:Notify', targetId, Lang:t("success.put_anklet"), 'success') - TriggerClientEvent('QBCore:Notify', src, Lang:t("success.put_anklet_on", {firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname}), 'success') + Target.Functions.SetMetaData('tracker', true) + TriggerClientEvent('QBCore:Notify', targetId, Lang:t('success.put_anklet'), 'success') + TriggerClientEvent('QBCore:Notify', src, Lang:t('success.put_anklet_on', { firstname = Target.PlayerData.charinfo.firstname, lastname = Target.PlayerData.charinfo.lastname }), 'success') TriggerClientEvent('police:client:SetTracker', targetId, true) end end) @@ -1102,7 +1102,7 @@ CreateThread(function() while true do Wait(1000 * 60 * 10) local curCops = GetCurrentCops() - TriggerClientEvent("police:SetCopCount", -1, curCops) + TriggerClientEvent('police:SetCopCount', -1, curCops) end end)