----------------------------------- -- Area of Patrol, Made by FAXES -- ----------------------------------- --- "Ramsus" --- local isUiOpen = false local speedBuffer = {} local velBuffer = {} local SeatbeltON = false local InVehicle = false function Notify(string) SetNotificationTextEntry("STRING") AddTextComponentString(string) DrawNotification(false, true) end AddEventHandler('seatbelt:sounds', function(soundFile, soundVolume) SendNUIMessage({ transactionType = 'playSound', transactionFile = soundFile, transactionVolume = soundVolume }) end) function IsCar(veh) local vc = GetVehicleClass(veh) return (vc >= 0 and vc <= 7) or (vc >= 9 and vc <= 12) or (vc >= 17 and vc <= 20) end function Fwv(entity) local hr = GetEntityHeading(entity) + 90.0 if hr < 0.0 then hr = 360.0 + hr end hr = hr * 0.0174533 return { x = math.cos(hr) * 2.0, y = math.sin(hr) * 2.0 } end Citizen.CreateThread(function() while true do Citizen.Wait(0) local ped = PlayerPedId() local car = GetVehiclePedIsIn(ped) if car ~= 0 and (InVehicle or IsCar(car)) then InVehicle = true if isUiOpen == false and not IsPlayerDead(PlayerId()) then if Config.Blinker then SendNUIMessage({displayWindow = 'true'}) end isUiOpen = true end if SeatbeltON then DisableControlAction(0, 75, true) -- Disable exit vehicle when stop DisableControlAction(27, 75, true) -- Disable exit vehicle when Driving end speedBuffer[2] = speedBuffer[1] speedBuffer[1] = GetEntitySpeed(car) if not SeatbeltON and speedBuffer[2] ~= nil and GetEntitySpeedVector(car, true).y > 1.0 and speedBuffer[1] > (Config.Speed / 3.6) and (speedBuffer[2] - speedBuffer[1]) > (speedBuffer[1] * 0.255) then local co = GetEntityCoords(ped) local fw = Fwv(ped) SetEntityCoords(ped, co.x + fw.x, co.y + fw.y, co.z - 0.47, true, true, true) SetEntityVelocity(ped, velBuffer[2].x, velBuffer[2].y, velBuffer[2].z) Citizen.Wait(1) SetPedToRagdoll(ped, 1000, 1000, 0, 0, 0, 0) end velBuffer[2] = velBuffer[1] velBuffer[1] = GetEntityVelocity(car) if IsControlJustReleased(0, Config.Control) and GetLastInputMethod(0) then SeatbeltON = not SeatbeltON if SeatbeltON then Citizen.Wait(1) if Config.Sounds then TriggerEvent("seatbelt:sounds", "buckle", Config.Volume) --Added buckle notification event exports['EGRP-Notifications']:CaptionIcon("Vehicle System", "Seatbelt has been buckled!", "top", 3000, "dark", "", true, "mdi-seatbelt") end if Config.Notification then Notify(Config.Strings.seatbelt_on) end if Config.Blinker then SendNUIMessage({displayWindow = 'false'}) end isUiOpen = true else if Config.Notification then Notify(Config.Strings.seatbelt_off) end if Config.Sounds then TriggerEvent("seatbelt:sounds", "unbuckle", Config.Volume) --Added buckle notification event exports['EGRP-Notifications']:CaptionIcon("Vehicle System", "Seatbelt has been un-buckled!", "top", 3000, "dark", "", true, "mdi-seatbelt") end if Config.Blinker then SendNUIMessage({displayWindow = 'true'}) end isUiOpen = true end end elseif InVehicle then InVehicle = false SeatbeltON = false speedBuffer[1], speedBuffer[2] = 0.0, 0.0 if isUiOpen == true and not IsPlayerDead(PlayerId()) then if Config.Blinker then SendNUIMessage({displayWindow = 'false'}) end isUiOpen = false end end end end) Citizen.CreateThread(function() while true do Citizen.Wait(10) local Vehicle = GetVehiclePedIsIn(GetPlayerPed(-1), false) local VehSpeed = GetEntitySpeed(Vehicle) * 3.6 if Config.AlarmOnlySpeed and VehSpeed > Config.AlarmSpeed then ShowWindow = true else ShowWindow = false SendNUIMessage({displayWindow = 'false'}) end if IsPlayerDead(PlayerId()) or IsPauseMenuActive() then if isUiOpen == true then SendNUIMessage({displayWindow = 'false'}) end elseif not SeatbeltON and InVehicle and not IsPauseMenuActive() and not IsPlayerDead(PlayerId()) and Config.Blinker then if Config.AlarmOnlySpeed and ShowWindow and VehSpeed > Config.AlarmSpeed then SendNUIMessage({displayWindow = 'true'}) end end end end) Citizen.CreateThread(function() while true do --Citizen.Wait(3500) Citizen.Wait(30000) if not SeatbeltON and InVehicle and not IsPauseMenuActive() and Config.LoopSound and ShowWindow then TriggerEvent("seatbelt:sounds", "seatbelt", Config.Volume) end end end) --- NO NEED TO EDIT THIS FILE!!!! EDIT THE CONFIG.LUA --- --- NO NEED TO EDIT THIS FILE!!!! EDIT THE CONFIG.LUA --- --- NO NEED TO EDIT THIS FILE!!!! EDIT THE CONFIG.LUA --- --- NO NEED TO EDIT THIS FILE!!!! EDIT THE CONFIG.LUA --- --- NO NEED TO EDIT THIS FILE!!!! EDIT THE CONFIG.LUA --- local cooldown = 0 peacetimeActive = false local year, month, day, hour, minute, second = GetLocalTime() local AOPxNew = 0.660 local AOPyNew = 1.430 local AOPyNew2 = 1.430 AddEventHandler('onClientMapStart', function() TriggerEvent('AOP:RunConfig') Wait(2000) TriggerServerEvent('AOP:Sync') TriggerServerEvent('AOP:PTSync') end) AddEventHandler('playerSpawned', function() local ped = GetPlayerPed(-1) if AOPSpawnsEnabled then TriggerEvent('AOP:SetPlayerSpawnPoint', ped) end end) RegisterNetEvent('AOP:NoPerms') AddEventHandler('AOP:NoPerms', function() ShowInfo(noPermsMessage) end) RegisterNetEvent('Fax:ClientPrint') AddEventHandler('Fax:ClientPrint', function(text) print(text) end) RegisterNetEvent('AOP:DisNotification') AddEventHandler('AOP:DisNotification', function(textPassed) BeginTextCommandDisplayHelp("STRING") AddTextComponentSubstringPlayerName(textPassed) EndTextCommandDisplayHelp(0, 0, 1, - 1) end) RegisterNetEvent('AOP:PTSound') AddEventHandler('AOP:PTSound', function() PlaySoundFrontend(-1,"CONFIRM_BEEP", "HUD_MINI_GAME_SOUNDSET",1) end) RegisterNetEvent('AOP:RunConfig') AddEventHandler('AOP:RunConfig', function() if AOPLocation == 0 then -- Default if serverPLD then AOPxNew = 0.660 AOPyNew = 1.370 AOPyNew2 = AOPyNew + 0.025 else AOPxNew = 0.660 AOPyNew = 1.430 AOPyNew2 = AOPyNew + 0.025 end elseif AOPLocation == 1 then -- Bottom Center AOPxNew = 1.000 AOPyNew = 1.430 AOPyNew2 = AOPyNew + 0.025 elseif AOPLocation == 2 then -- Bottom Right [WIP] AOPxNew = 0.660 AOPyNew = 1.430 AOPyNew2 = AOPyNew + 0.025 elseif AOPLocation == 3 then -- Top Right [WIP] AOPxNew = 0.660 AOPyNew = 1.430 AOPyNew2 = AOPyNew + 0.025 elseif AOPLocation == 4 then -- Top Center AOPxNew = 1.000 AOPyNew = 0.50 AOPyNew2 = AOPyNew + 0.025 elseif AOPLocation == 5 then -- Top Left AOPxNew = 0.00 AOPyNew = 0.50 AOPyNew2 = AOPyNew + 0.025 elseif AOPLocation == 6 then -- Custom AOPxNew = AOPx AOPyNew = AOPy AOPyNew2 = AOPyNew + 0.025 end Citizen.Trace("[FAXES AOP SCRIPT] Config Ran") end) RegisterNetEvent('AOP:SendAOP') AddEventHandler('AOP:SendAOP', function(newCurAOP) FaxCurAOP = newCurAOP end) RegisterNetEvent('AOP:SendPT') AddEventHandler('AOP:SendPT', function(newCurPT) peacetimeActive = newCurPT end) RegisterNetEvent('AOP:SetPlayerSpawnPoint') AddEventHandler('AOP:SetPlayerSpawnPoint', function(ped) for i=1, #AOPSpawns do local AOPTab = AOPSpawns[i] if string.lower(AOPTab.AOPName) == string.lower(FaxCurAOP) then SetEntityCoords(ped, AOPTab.AOPCoords.x, AOPTab.AOPCoords.y, AOPTab.AOPCoords.z) end end end) Citizen.CreateThread(function() while true do if localTime == 1 then -- client time year, month, day, hour, minute, second = GetLocalTime() newMinute = minute miid = GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))) if minute < 10 then newMinute = "0" .. minute end drawTimeText = featColor .. "Time: ~w~" .. hour .. ":" .. newMinute .. featColor .." | Date: ~w~" .. day .. featColor .."/~w~" .. month .. featColor .. "/~w~" .. year .. featColor .. " | Player ID: ~w~" .. miid elseif localTime == 2 then year = GetClockYear();month = GetClockMonth();day = GetClockDayOfMonth() hour = GetClockHours();minute = GetClockMinutes();second = GetClockSeconds() newMinute = minute miid = GetPlayerServerId(NetworkGetEntityOwner(GetPlayerPed(-1))) if minute < 10 then newMinute = "0" .. minute end drawTimeText = featColor .. "Time: ~w~" .. hour .. ":" .. newMinute .. featColor .." | Date: ~w~" .. day .. featColor .."/~w~" .. month .. featColor .. "/~w~" .. year .. featColor .. " | Player ID: ~w~" .. miid elseif localTime == 0 then drawTimeText = "" end Citizen.Wait(1) local player = GetPlayerPed(-1) local veh = GetVehiclePedIsIn(player) local mph = math.ceil(GetEntitySpeed(veh) * 2.23) if peacetimeActive then if peacetimeNS then if IsControlPressed(0, 106) then ShowInfo("~r~Peacetime is enabled. ~n~~s~You can not shoot.") end SetPlayerCanDoDriveBy(player, false) DisablePlayerFiring(player, true) DisableControlAction(0, 140) -- Melee R end if GetPedInVehicleSeat(veh, -1) == player then if mph > maxPTSpeed then ShowInfo("~r~Please keep in mind peacetime is active! ~n~~w~Slow down or stop.") end end DrawTextAOP(AOPxNew, AOPyNew, 1.0,1.0,0.45, drawTimeText, 255, 255, 255, 255) DrawTextAOP(AOPxNew, AOPyNew2, 1.0,1.0,0.45, "~w~Current " .. featColor .. "AOP: ~w~" .. FaxCurAOP .. featColor .. " | ~w~PeaceTime: ~g~Enabled" .. featColor , 255, 255, 255, 255) elseif not peacetimeActive then if peacetime then DrawTextAOP(AOPxNew, AOPyNew, 1.0,1.0,0.45, drawTimeText, 255, 255, 255, 255) DrawTextAOP(AOPxNew, AOPyNew2, 1.0,1.0,0.45, "~w~Current " .. featColor .. "AOP: ~w~" .. FaxCurAOP .. featColor .. " | ~w~PeaceTime: ~r~Disabled" .. featColor , 255, 255, 255, 255) else DrawTextAOP(AOPxNew, AOPyNew, 1.0,1.0,0.45, drawTimeText, 255, 255, 255, 255) DrawTextAOP(AOPxNew, AOPyNew2, 1.0,1.0,0.45, "~w~Current " .. featColor .. "AOP: ~w~" .. FaxCurAOP .. featColor , 255, 255, 255, 255) end end end end) Citizen.CreateThread(function() while true do if IsPedInAnyVehicle(GetPlayerPed(-1)) then local ped = GetPlayerPed(-1) local veh = GetVehiclePedIsIn(ped) local plate = GetVehicleNumberPlateText(veh) local rpm = math.ceil(GetVehicleCurrentRpm(veh) * 11) - 1 local speed = math.ceil(GetEntitySpeed(veh) * 2.236936) local gear = GetVehicleCurrentGear(veh) if speed == 0 then gear = "N" elseif gear == 0 then gear = "~r~R" end DrawTextAOP(0.665, 1.340, 1.0,1.0,0.45,"~r~Plate: ~w~"..plate.."~r~ | MPH: ~w~"..speed.." ~r~| RPM: ~w~"..rpm.."X ~r~| Gear: ~w~"..gear, 255,255,255,255) end Citizen.Wait(1) end end) function DrawTextAOP(x,y ,width,height,scale, text, r,g,b,a) if AOPLocation == 1 or AOPLocation == 4 then SetTextCentre(true) end SetTextFont(4) SetTextProportional(0) SetTextScale(scale, scale) SetTextColour(r, g, b, a) SetTextDropShadow(0, 0, 0, 0,255) SetTextEdge(2, 0, 0, 0, 255) SetTextDropShadow() SetTextOutline() SetTextEntry("STRING") AddTextComponentString(text) DrawText(x - width/2, y - height/2 + 0.005) end Citizen.CreateThread(function() while true do Citizen.Wait(1) local MyPed = GetPlayerPed(-1) if SeatbeltON == true then seatbeltmsg = "Enabled" elseif SeatbeltON == false then seatbeltmsg = "Disabled" end if(IsPedInAnyVehicle(MyPed, false))then local MyPedVeh = GetVehiclePedIsIn(MyPed) local VehStopped = IsVehicleStopped(MyPedVeh) local VehEngineHP = GetVehicleEngineHealth(MyPedVeh) local VehEngineOn = GetIsVehicleEngineRunning(MyPedVeh) if VehEngineOn then if VehEngineHP > 500 and VehEngineHP < 750 and SeatbeltON == true then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~y~Partially Damaged ~r~| Seatbelt: ~g~"..seatbeltmsg, 255, 255, 255, 255) elseif VehEngineHP > 500 and VehEngineHP < 750 and SeatbeltON == false then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~y~Partially Damaged ~r~| Seatbelt: ~r~"..seatbeltmsg, 255, 255, 255, 255) elseif (VehEngineHP > 200) and (VehEngineHP < 500) and SeatbeltON == true then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~y~Heavily Damaged ~r~| Seatbelt: ~g~"..seatbeltmsg, 255, 255, 255, 255) elseif (VehEngineHP > 200) and (VehEngineHP < 500) and SeatbeltON == false then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~y~Heavily Damaged ~r~| Seatbelt: ~r~"..seatbeltmsg, 255, 255, 255, 255) elseif VehEngineHP < 200 and SeatbeltON == true then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~r~Permanently Damaged ~r~| Seatbelt: ~g~"..seatbeltmsg, 255, 255, 255, 255) elseif VehEngineHP < 200 and SeatbeltON == false then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~r~Permanently Damaged ~r~| Seatbelt: ~r~"..seatbeltmsg, 255, 255, 255, 255) elseif VehEngineHP > 750 and SeatbeltON == true then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~g~Fully Functional ~r~| Seatbelt: ~g~"..seatbeltmsg, 255, 255, 255, 255) elseif VehEngineHP > 750 and SeatbeltON == false then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~g~Fully Functional ~r~| Seatbelt: ~r~"..seatbeltmsg, 255, 255, 255, 255) end else if SeatbeltON == true then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~r~Engine Off ~r~| Seatbelt: ~g~"..seatbeltmsg, 255, 255, 255, 255) elseif SeatbeltON == false then DrawTextAOP(0.665, 1.314, 1.0,1.0,0.45, "~r~Engine Status: ~r~Engine Off ~r~| Seatbelt: ~r~"..seatbeltmsg, 255, 255, 255, 255) end end end end end) function ShowInfo(text) BeginTextCommandThefeedPost("STRING") AddTextComponentSubstringPlayerName(text) EndTextCommandThefeedPostTicker(true, false) end