Skip to content

Commit

Permalink
General Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
GhzGarage committed Nov 2, 2023
1 parent aa3ee4f commit 97fce87
Show file tree
Hide file tree
Showing 15 changed files with 1,421 additions and 1,630 deletions.
66 changes: 30 additions & 36 deletions client/anpr.lua
Original file line number Diff line number Diff line change
@@ -1,58 +1,52 @@
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
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
Expand Down
30 changes: 15 additions & 15 deletions client/camera.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -44,7 +44,7 @@ local function InstructionButton(ControlButton)
end

local function InstructionButtonMessage(text)
BeginTextCommandScaleformString("STRING")
BeginTextCommandScaleformString('STRING')
AddTextComponentScaleform(text)
EndTextCommandScaleformString()
end
Expand All @@ -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)
Expand All @@ -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,
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand All @@ -164,7 +164,7 @@ CreateThread(function()
end
CloseSecurityCamera()
SendNUIMessage({
type = "disablecam",
type = 'disablecam',
})
DoScreenFadeIn(250)
end
Expand Down
49 changes: 24 additions & 25 deletions client/evidence.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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
Expand Down Expand Up @@ -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,
Expand All @@ -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)

Expand All @@ -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,
Expand All @@ -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)

Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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
}
Expand All @@ -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
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading

0 comments on commit 97fce87

Please sign in to comment.