-- Config (DON'T TOUCH) Config = { Model = axon } -- THIS IS WHERE YOU DONT TOUCH, THESE ARE THE SOUNDS. local function PlayAxonBodyOn() local playerNetId = NetworkGetNetworkIdFromEntity(PlayerPedId()) TriggerServerEvent("Server:SoundToRadius", playerNetId, 4.0, "BODYCAMAXON_ON", 0.6) end local function PlayAxonBodyOff() local playerNetId = NetworkGetNetworkIdFromEntity(PlayerPedId()) TriggerServerEvent("Server:SoundToRadius", playerNetId, 4.0, "BODYCAMAXON_OFF", 0.6) end local function PlayAxonBodyDPress() local playerNetId = NetworkGetNetworkIdFromEntity(PlayerPedId()) TriggerServerEvent("Server:SoundToRadius", playerNetId, 4.0, "BODYCAMAXON_DPRESS", 0.6) end local function PlayAxonBodyPress() local playerNetId = NetworkGetNetworkIdFromEntity(PlayerPedId()) TriggerServerEvent("Server:SoundToRadius", playerNetId, 4.0, "BODYCAMAXON_PRESS", 0.6) end local function PlayAxonBodyLowCharge() local playerNetId = NetworkGetNetworkIdFromEntity(PlayerPedId()) TriggerServerEvent("Server:SoundToRadius", playerNetId, 4.0, "BODYCAMAXON_LOWBATTERY", 0.6) end local function PlayGBodycamSoundOn() PlaySoundFrontend(-1, "5_SEC_WARNING", "HUD_MINI_GAME_SOUNDSET", 1) end local function PlayGBodycamSoundOff() PlaySoundFrontend(-1, "ATM_WINDOW", "HUD_FRONTEND_DEFAULT_SOUNDSET", 1) end function StartAxonTaserRecording() PlayAxonBodyOn() Notify("~y~Axon Taser: ~o~Taser unholstered. ~w~Body camera has ~g~started ~w~recording.") end ---- ---- ---- -- START OF MAIN CODE SORTA local isABCon = false local isTaserDrawn = false local isTaserFired = false local batteryLevel = 100 local lowBatteryThreshold = 20 local batteryDrainRate = 1 local rechargeRate = 5 local rechargeInterval = 60000 local isRecharging = false local isCalibrated = false RegisterCommand("bcCalibrate", function() isCalibrated = true Notify("~g~Bodycam calibrated successfully.") end, false) function ToggleBodycam() if isABCon then isABCon = false else if batteryLevel > 0 then isABCon = true else Notify("~r~Battery depleted. Unable to start recording.") PlayAxonBodyLowCharge() end end end Citizen.CreateThread(function() while true do Citizen.Wait(60000) if isABCon and batteryLevel > 0 and not isRecharging then batteryLevel = batteryLevel - 5 if batteryLevel <= 10 then Notify("~r~Bodycam Battery Low: ~w~" .. batteryLevel .. "% remaining.") end elseif batteryLevel <= 0 then isABCon = false Notify("~r~Bodycam Battery: ~w~Depleted. Recording stopped.") end end end) function StartRecharge() if isRecharging or batteryLevel >= 100 then return end isRecharging = true Citizen.CreateThread(function() while isRecharging and batteryLevel < 100 do Citizen.Wait(rechargeInterval) batteryLevel = math.min(batteryLevel + rechargeRate, 100) if batteryLevel < 100 then Notify("~y~Bodycam Battery: ~g~" .. batteryLevel .. "% ~y~(Still Charging...)") else Notify("~g~Bodycam battery fully recharged. Charging stopped.") PlayAxonBodyLowCharge() isRecharging = false end end end) end RegisterCommand("bodycamCharge", function() Notify("~y~Bodycam Battery Level: ~g~" .. batteryLevel .. "%") end, false) RegisterCommand("rechargeBodycam", function() local playerPed = PlayerPedId() if IsPedInAnyVehicle(playerPed, false) then if batteryLevel < 100 then Notify("~y~Axon Body: ~w~ You're bodycam has started charging.") StartRecharge() elseif batteryLevel == 100 then Notify("~y~Axon Body: ~w~You're bodycam has started charging.") Notify("~y~Axon Body: ~w~Battery ~r~Full~w~, Charging has stopped.") PlayAxonBodyLowCharge() end else Notify("~r~You must be in a vehicle to recharge the bodycam.") end end, false) Citizen.CreateThread(function() while true do Citizen.Wait(0) local playerPed = PlayerPedId() local playerWeapon = GetSelectedPedWeapon(playerPed) if isCalibrated then if playerWeapon == GetHashKey("WEAPON_STUNGUN") then if not isTaserDrawn then Citizen.Wait(3000) isTaserDrawn = true if not isABCon then isABCon = true Config.Model = 'axon' StartAxonTaserRecording() end end if IsPedShooting(playerPed) and not isTaserFired then isTaserFired = true Notify("~y~Axon Taser: ~o~Taser fired, updating dispatch.") Citizen.Wait(1000) end else if isTaserDrawn then isTaserDrawn = false isTaserFired = false end end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(3000) if isABCon == true then Citizen.Wait(120000) PlayAxonBodyOn() end end end) local isShowingAxon = false local record = false local bdWeapons = { 'WEAPON_PISTOL', 'WEAPON_COMBATPISTOL', 'WEAPON_SNSPISTOL', 'WEAPON_HEAVYPISTOL' } Citizen.CreateThread(function() while true do Citizen.Wait(100) local ped = PlayerPedId() local currentWeapon = GetSelectedPedWeapon(ped) local isWeaponMatched = false for _, weapon in ipairs(bdWeapons) do if currentWeapon == GetHashKey(weapon) then isWeaponMatched = true break end end if not IsPedInAnyVehicle(ped, true) then if isWeaponMatched and not isABCon then if not isCalibrated then return end Citizen.Wait(2000) Notify("~y~Axon Signal Sidearm: ~o~Weapon unholstered. ~w~Body camera has ~g~started ~w~recording.") PlayAxonBodyOn() isABCon = true Config.Model = 'axon' end else Citizen.Wait(1000) end end end) ----- -- VEHICLE AXON SIGNAL Citizen.CreateThread(function() while true do Citizen.Wait(100) local ped = PlayerPedId() if IsPedInAnyVehicle(ped, false) then local currentVehicle = GetVehiclePedIsIn(ped, false) local LightsOn = IsVehicleSirenOn(currentVehicle) if isCalibrated then if LightsOn and not isABCon then Citizen.Wait(2000) if IsVehicleSirenOn(currentVehicle) then Notify("~y~Axon Signal Vehicle: ~o~Emergency lights activated. ~w~Body camera has ~g~started ~w~recording.") PlayAxonBodyOn() isABCon = true Config.Model = 'axon' end end else Citizen.Wait(1000) end else Citizen.Wait(1000) end end end) RegisterKeyMapping('axonbc', 'Toggle your Axon Bodycam', 'keyboard', 'numpad7') RegisterCommand("axonbc", function(source, args, rawCommand) if isCalibrated == false then Notify("~r~Please calibrate your bodycam first using /bcCalibrate.") else local ped = PlayerPedId() while not HasAnimDictLoaded("clothingtie") do RequestAnimDict("clothingtie") Citizen.Wait(0) end local pos = GetEntityCoords(ped, true) local rot = GetEntityHeading(ped) if isABCon then TaskPlayAnimAdvanced(ped, "clothingtie", "outro", pos, 0.0, 0.0, rot, 8.0, 3.0, -1, 50, 0.125, 0, 0) Citizen.Wait(300) PlayAxonBodyPress() Citizen.Wait(600) ClearPedTasks(ped) Notify("~y~AXON BODY: ~w~Body Camera has ~r~stopped~w~ recording.") PlayAxonBodyOff() else TaskPlayAnimAdvanced(ped, "clothingtie", "outro", pos, 0.0, 0.0, rot, 8.0, 3.0, -1, 50, 0.125, 0, 0) Citizen.Wait(600) PlayAxonBodyDPress() Citizen.Wait(600) ClearPedTasks(ped) Notify("~y~AXON BODY: ~w~Body Camera has ~g~started~w~ recording.") PlayAxonBodyOn() end isABCon = not isABCon Config.Model = 'axon' end end, false) RegisterCommand("togglerec", function(source, args, rawCommand) record = not record if not record then TriggerEvent('chat:addMessage', { color = {255, 0, 0}, multiline = true, args = {"Bodycam", "Bodycam recording set to ^1 false"} }) else TriggerEvent('chat:addMessage', { color = {255, 0, 0}, multiline = true, args = {"Bodycam", "Bodycam recording set to ^2 true"} }) end end, false) function Notify(string) SetNotificationTextEntry("STRING") AddTextComponentString(string) DrawNotification(false, true) end Citizen.CreateThread(function() while true do if isABCon then local year, month, day, hour, minute, second = GetLocalTime() if month < 10 then month = "0" .. month end if day < 10 then day = "0" .. day end if isShowingAxon and Config.Model == 'axon' then SendNUIMessage({ transactionType = 'updateTime', timestamp = year .. '-0' .. month .. '-' .. day .. ' ' .. 'T' .. hour .. ':' .. minute .. ':' .. second, }) end if Config.Model == 'axon' and not isShowingAxon then SendNUIMessage({ transactionType = 'showAxon', show = true, timestamp = year .. '-0' .. month .. '-' .. day .. ' ' .. 'T' .. hour .. ':' .. minute .. ':' .. second, }) isShowingAxon = true end else if isShowingAxon and Config.Model == 'axon' then SendNUIMessage({ transactionType = 'showAxon', show = false, }) isShowingAxon = false end end Citizen.Wait(100) end end) Citizen.CreateThread(function() while true do Citizen.Wait(0) -- Continuous check if isABCon then Citizen.Wait(20000) -- Wait 20 seconds after the bodycam is turned on while isABCon do PlayAxonBodyOn() -- Play the activation sound Citizen.Wait(20000) -- Repeat every 20 seconds end else Citizen.Wait(100) -- Prevent excessive looping when the bodycam is off end end end)