diff --git a/server-data/resources/[bpt_addons]/bpt_hud/README.md b/server-data/resources/[bpt_addons]/bpt_hud/README.md index 5b5d64a06..cfe018010 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/README.md +++ b/server-data/resources/[bpt_addons]/bpt_hud/README.md @@ -1,7 +1,7 @@
Discord -Copyright (C) 2022-2023 bitpredator +Copyright (C) 2022-2024 bitpredator This program Is free software: you can redistribute it And/Or modify it under the terms Of the GNU General Public License As published by the Free Software Foundation, either version 3 Of the License, Or (at your option) any later version. diff --git a/server-data/resources/[bpt_addons]/bpt_hud/client/carhud.lua b/server-data/resources/[bpt_addons]/bpt_hud/client/carhud.lua index e7d32b92f..55ab5425b 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/client/carhud.lua +++ b/server-data/resources/[bpt_addons]/bpt_hud/client/carhud.lua @@ -1,40 +1,40 @@ -- SCREEN POSITION PARAMETERS -local screenPosX = 0.165 -- X coordinate (top left corner of HUD) -local screenPosY = 0.882 -- Y coordinate (top left corner of HUD) +local screenPosX = 0.165 -- X coordinate (top left corner of HUD) +local screenPosY = 0.882 -- Y coordinate (top left corner of HUD) -- GENERAL PARAMETERS -local enableController = true -- Enable controller inputs +local enableController = true -- Enable controller inputs -- SPEEDOMETER PARAMETERS -local speedLimit = 100.0 -- Speed limit for changing speed color -local speedColorText = {255, 255, 255} -- Color used to display speed label text -local speedColorUnder = {255, 255, 255} -- Color used to display speed when under speedLimit -local speedColorOver = {255, 96, 96} -- Color used to display speed when over speedLimit +local speedLimit = 100.0 -- Speed limit for changing speed color +local speedColorText = { 255, 255, 255 } -- Color used to display speed label text +local speedColorUnder = { 255, 255, 255 } -- Color used to display speed when under speedLimit +local speedColorOver = { 255, 96, 96 } -- Color used to display speed when over speedLimit -- FUEL PARAMETERS -local fuelShowPercentage = true -- Show fuel as a percentage (disabled shows fuel in liters) -local fuelWarnLimit = 25.0 -- Fuel limit for triggering warning color -local fuelColorText = {255, 255, 255} -- Color used to display fuel text -local fuelColorOver = {255, 255, 255} -- Color used to display fuel when good -local fuelColorUnder = {255, 96, 96} -- Color used to display fuel warning +local fuelShowPercentage = true -- Show fuel as a percentage (disabled shows fuel in liters) +local fuelWarnLimit = 25.0 -- Fuel limit for triggering warning color +local fuelColorText = { 255, 255, 255 } -- Color used to display fuel text +local fuelColorOver = { 255, 255, 255 } -- Color used to display fuel when good +local fuelColorUnder = { 255, 96, 96 } -- Color used to display fuel warning -- SEATBELT PARAMETERS -local seatbeltInput = 252 -- Toggle seatbelt on/off with K or DPAD down (controller) -local seatbeltPlaySound = true -- Play seatbelt sound -local seatbeltDisableExit = true -- Disable vehicle exit when seatbelt is enabled -local seatbeltEjectSpeed = 45.0 -- Speed threshold to eject player (MPH) -local seatbeltEjectAccel = 100.0 -- Acceleration threshold to eject player (G's) -local seatbeltColorOn = {160, 255, 160} -- Color used when seatbelt is on -local seatbeltColorOff = {255, 96, 96} -- Color used when seatbelt is off +local seatbeltInput = 252 -- Toggle seatbelt on/off with K or DPAD down (controller) +local seatbeltPlaySound = true -- Play seatbelt sound +local seatbeltDisableExit = true -- Disable vehicle exit when seatbelt is enabled +local seatbeltEjectSpeed = 45.0 -- Speed threshold to eject player (MPH) +local seatbeltEjectAccel = 100.0 -- Acceleration threshold to eject player (G's) +local seatbeltColorOn = { 160, 255, 160 } -- Color used when seatbelt is on +local seatbeltColorOff = { 255, 96, 96 } -- Color used when seatbelt is off -- CRUISE CONTROL PARAMETERS -local cruiseInput = 137 -- Toggle cruise on/off with CAPSLOCK or A button (controller) -local cruiseColorOn = {160, 255, 160} -- Color used when seatbelt is on -local cruiseColorOff = {255, 255, 255} -- Color used when seatbelt is off +local cruiseInput = 137 -- Toggle cruise on/off with CAPSLOCK or A button (controller) +local cruiseColorOn = { 160, 255, 160 } -- Color used when seatbelt is on +local cruiseColorOff = { 255, 255, 255 } -- Color used when seatbelt is off -- LOCATION AND TIME PARAMETERS -local locationAlwaysOn = false -- Always display location and time -local locationColorText = {255, 255, 255} -- Color used to display location and time +local locationAlwaysOn = false -- Always display location and time +local locationColorText = { 255, 255, 255 } -- Color used to display location and time -- Globals local pedInVeh = false @@ -43,161 +43,193 @@ local currentFuel = 0.0 -- Main thread CreateThread(function() - -- Initialize local variable - local currSpeed = 0.0 - local cruiseSpeed = 999.0 - local prevVelocity = {x = 0.0, y = 0.0, z = 0.0} - local cruiseIsOn = false - local seatbeltIsOn = false - - while true do - -- Loop forever and update HUD every frame - Wait(0) - - -- Get player PED, position and vehicle and save to locals - local player = GetPlayerPed(-1) - local position = GetEntityCoords(player) - local vehicle = GetVehiclePedIsIn(player, false) - - -- Set vehicle states - if IsPedInAnyVehicle(player, false) then - pedInVeh = true - else - -- Reset states when not in car - pedInVeh = false - cruiseIsOn = false - seatbeltIsOn = false - end - - -- Display Location and time when in any vehicle or on foot (if enabled) - if pedInVeh or locationAlwaysOn then - -- Get time and display - drawTxt(timeText, 4, locationColorText, 0.4, screenPosX, screenPosY + 0.048) - - -- Display remainder of HUD when engine is on and vehicle is not a bicycle - local vehicleClass = GetVehicleClass(vehicle) - if pedInVeh and GetIsVehicleEngineRunning(vehicle) and vehicleClass ~= 13 then - -- Save previous speed and get current speed - local prevSpeed = currSpeed - currSpeed = GetEntitySpeed(vehicle) - - -- Set PED flags - SetPedConfigFlag(PlayerPedId(), 32, true) - - -- Check if seatbelt button pressed, toggle state and handle seatbelt logic - if IsControlJustReleased(0, seatbeltInput) and (enableController or GetLastInputMethod(0)) and vehicleClass ~= 8 then - -- Toggle seatbelt status and play sound when enabled - seatbeltIsOn = not seatbeltIsOn - if seatbeltPlaySound then - PlaySoundFrontend(-1, "Faster_Click", "RESPAWN_ONLINE_SOUNDSET", 1) - end - end - if not seatbeltIsOn then - -- Eject PED when moving forward, vehicle was going over 45 MPH and acceleration over 100 G's - local vehIsMovingFwd = GetEntitySpeedVector(vehicle, true).y > 1.0 - local vehAcc = (prevSpeed - currSpeed) / GetFrameTime() - if (vehIsMovingFwd and (prevSpeed > (seatbeltEjectSpeed/2.237)) and (vehAcc > (seatbeltEjectAccel*9.81))) then - SetEntityCoords(player, position.x, position.y, position.z - 0.47, true, true, true) - SetEntityVelocity(player, prevVelocity.x, prevVelocity.y, prevVelocity.z) - Wait(1) - SetPedToRagdoll(player, 1000, 1000, 0, 0, 0, 0) - else - -- Update previous velocity for ejecting player - prevVelocity = GetEntityVelocity(vehicle) - end - elseif seatbeltDisableExit then - -- Disable vehicle exit when seatbelt is on - DisableControlAction(0, 75) - end - - -- When player in driver seat, handle cruise control - if (GetPedInVehicleSeat(vehicle, -1) == player) then - -- Check if cruise control button pressed, toggle state and set maximum speed appropriately - if IsControlJustReleased(0, cruiseInput) and (enableController or GetLastInputMethod(0)) then - cruiseIsOn = not cruiseIsOn - cruiseSpeed = currSpeed - end - local maxSpeed = cruiseIsOn and cruiseSpeed or GetVehicleHandlingFloat(vehicle,"CHandlingData","fInitialDriveMaxFlatVel") - SetEntityMaxSpeed(vehicle, maxSpeed) - else - -- Reset cruise control - cruiseIsOn = false - end - - -- Check what units should be used for speed - if ShouldUseMetricMeasurements() then - -- Get vehicle speed in KPH and draw speedometer - local speed = currSpeed*3.6 - local speedColor = (speed >= speedLimit) and speedColorOver or speedColorUnder - drawTxt(("%.3d"):format(math.ceil(speed)), 2, speedColor, 0.8, screenPosX + 0.000, screenPosY + 0.000) - drawTxt("KPH", 2, speedColorText, 0.4, screenPosX + 0.030, screenPosY + 0.018) - else - -- Get vehicle speed in MPH and draw speedometer - local speed = currSpeed*2.23694 - local speedColor = (speed >= speedLimit) and speedColorOver or speedColorUnder - drawTxt(("%.3d"):format(math.ceil(speed)), 2, speedColor, 0.8, screenPosX + 0.000, screenPosY + 0.000) - drawTxt("MPH", 2, speedColorText, 0.4, screenPosX + 0.030, screenPosY + 0.018) - end - - -- Draw fuel gauge - local fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder - drawTxt(("%.3d"):format(math.ceil(currentFuel)), 2, fuelColor, 0.8, screenPosX + 0.055, screenPosY + 0.000) - drawTxt("FUEL", 2, fuelColorText, 0.4, screenPosX + 0.085, screenPosY + 0.018) - - -- Draw cruise control status - local cruiseColor = cruiseIsOn and cruiseColorOn or cruiseColorOff - drawTxt("CRUISE", 2, cruiseColor, 0.4, screenPosX + 0.020, screenPosY + 0.048) - - -- Draw seatbelt status if not a motorcyle - if vehicleClass ~= 8 then - local seatbeltColor = seatbeltIsOn and seatbeltColorOn or seatbeltColorOff - drawTxt("SEATBELT", 2, seatbeltColor, 0.4, screenPosX + 0.080, screenPosY + 0.048) - end - end - end - end + -- Initialize local variable + local currSpeed = 0.0 + local cruiseSpeed = 999.0 + local prevVelocity = { x = 0.0, y = 0.0, z = 0.0 } + local cruiseIsOn = false + local seatbeltIsOn = false + + while true do + -- Loop forever and update HUD every frame + Wait(0) + + -- Get player PED, position and vehicle and save to locals + local player = GetPlayerPed(-1) + local position = GetEntityCoords(player) + local vehicle = GetVehiclePedIsIn(player, false) + + -- Set vehicle states + if IsPedInAnyVehicle(player, false) then + pedInVeh = true + else + -- Reset states when not in car + pedInVeh = false + cruiseIsOn = false + seatbeltIsOn = false + end + + -- Display Location and time when in any vehicle or on foot (if enabled) + if pedInVeh or locationAlwaysOn then + -- Get time and display + drawTxt(timeText, 4, locationColorText, 0.4, screenPosX, screenPosY + 0.048) + + -- Display remainder of HUD when engine is on and vehicle is not a bicycle + local vehicleClass = GetVehicleClass(vehicle) + if pedInVeh and GetIsVehicleEngineRunning(vehicle) and vehicleClass ~= 13 then + -- Save previous speed and get current speed + local prevSpeed = currSpeed + currSpeed = GetEntitySpeed(vehicle) + + -- Set PED flags + SetPedConfigFlag(PlayerPedId(), 32, true) + + -- Check if seatbelt button pressed, toggle state and handle seatbelt logic + if + IsControlJustReleased(0, seatbeltInput) + and (enableController or GetLastInputMethod(0)) + and vehicleClass ~= 8 + then + -- Toggle seatbelt status and play sound when enabled + seatbeltIsOn = not seatbeltIsOn + if seatbeltPlaySound then + PlaySoundFrontend(-1, "Faster_Click", "RESPAWN_ONLINE_SOUNDSET", 1) + end + end + if not seatbeltIsOn then + -- Eject PED when moving forward, vehicle was going over 45 MPH and acceleration over 100 G's + local vehIsMovingFwd = GetEntitySpeedVector(vehicle, true).y > 1.0 + local vehAcc = (prevSpeed - currSpeed) / GetFrameTime() + if + vehIsMovingFwd + and (prevSpeed > (seatbeltEjectSpeed / 2.237)) + and (vehAcc > (seatbeltEjectAccel * 9.81)) + then + SetEntityCoords(player, position.x, position.y, position.z - 0.47, true, true, true) + SetEntityVelocity(player, prevVelocity.x, prevVelocity.y, prevVelocity.z) + Wait(1) + SetPedToRagdoll(player, 1000, 1000, 0, 0, 0, 0) + else + -- Update previous velocity for ejecting player + prevVelocity = GetEntityVelocity(vehicle) + end + elseif seatbeltDisableExit then + -- Disable vehicle exit when seatbelt is on + DisableControlAction(0, 75) + end + + -- When player in driver seat, handle cruise control + if GetPedInVehicleSeat(vehicle, -1) == player then + -- Check if cruise control button pressed, toggle state and set maximum speed appropriately + if IsControlJustReleased(0, cruiseInput) and (enableController or GetLastInputMethod(0)) then + cruiseIsOn = not cruiseIsOn + cruiseSpeed = currSpeed + end + local maxSpeed = cruiseIsOn and cruiseSpeed + or GetVehicleHandlingFloat(vehicle, "CHandlingData", "fInitialDriveMaxFlatVel") + SetEntityMaxSpeed(vehicle, maxSpeed) + else + -- Reset cruise control + cruiseIsOn = false + end + + -- Check what units should be used for speed + if ShouldUseMetricMeasurements() then + -- Get vehicle speed in KPH and draw speedometer + local speed = currSpeed * 3.6 + local speedColor = (speed >= speedLimit) and speedColorOver or speedColorUnder + drawTxt( + ("%.3d"):format(math.ceil(speed)), + 2, + speedColor, + 0.8, + screenPosX + 0.000, + screenPosY + 0.000 + ) + drawTxt("KPH", 2, speedColorText, 0.4, screenPosX + 0.030, screenPosY + 0.018) + else + -- Get vehicle speed in MPH and draw speedometer + local speed = currSpeed * 2.23694 + local speedColor = (speed >= speedLimit) and speedColorOver or speedColorUnder + drawTxt( + ("%.3d"):format(math.ceil(speed)), + 2, + speedColor, + 0.8, + screenPosX + 0.000, + screenPosY + 0.000 + ) + drawTxt("MPH", 2, speedColorText, 0.4, screenPosX + 0.030, screenPosY + 0.018) + end + + -- Draw fuel gauge + local fuelColor = (currentFuel >= fuelWarnLimit) and fuelColorOver or fuelColorUnder + drawTxt( + ("%.3d"):format(math.ceil(currentFuel)), + 2, + fuelColor, + 0.8, + screenPosX + 0.055, + screenPosY + 0.000 + ) + drawTxt("FUEL", 2, fuelColorText, 0.4, screenPosX + 0.085, screenPosY + 0.018) + + -- Draw cruise control status + local cruiseColor = cruiseIsOn and cruiseColorOn or cruiseColorOff + drawTxt("CRUISE", 2, cruiseColor, 0.4, screenPosX + 0.020, screenPosY + 0.048) + + -- Draw seatbelt status if not a motorcyle + if vehicleClass ~= 8 then + local seatbeltColor = seatbeltIsOn and seatbeltColorOn or seatbeltColorOff + drawTxt("SEATBELT", 2, seatbeltColor, 0.4, screenPosX + 0.080, screenPosY + 0.048) + end + end + end + end end) -- Secondary thread to update strings CreateThread(function() - while true do - -- Update when player is in a vehicle or on foot (if enabled) - if pedInVeh or locationAlwaysOn then - -- Get player, position and vehicle - local player = GetPlayerPed(-1) - local _ = GetEntityCoords(player) - - -- Update fuel when in a vehicle - if pedInVeh then - local vehicle = GetVehiclePedIsIn(player, false) - if fuelShowPercentage then - -- Display remaining fuel as a percentage - currentFuel = 100 * GetVehicleFuelLevel(vehicle) / GetVehicleHandlingFloat(vehicle,"CHandlingData","fPetrolTankVolume") - else - -- Display remainign fuel in liters - currentFuel = GetVehicleFuelLevel(vehicle) - end - end - - -- Update every second - Wait(1000) - else - -- Wait until next frame - Wait(0) - end - end + while true do + -- Update when player is in a vehicle or on foot (if enabled) + if pedInVeh or locationAlwaysOn then + -- Get player, position and vehicle + local player = GetPlayerPed(-1) + local _ = GetEntityCoords(player) + + -- Update fuel when in a vehicle + if pedInVeh then + local vehicle = GetVehiclePedIsIn(player, false) + if fuelShowPercentage then + -- Display remaining fuel as a percentage + currentFuel = 100 + * GetVehicleFuelLevel(vehicle) + / GetVehicleHandlingFloat(vehicle, "CHandlingData", "fPetrolTankVolume") + else + -- Display remainign fuel in liters + currentFuel = GetVehicleFuelLevel(vehicle) + end + end + + -- Update every second + Wait(1000) + else + -- Wait until next frame + Wait(0) + end + end end) -- Helper function to draw text to screen function drawTxt(content, font, colour, scale, x, y) - SetTextFont(font) - SetTextScale(scale, scale) - SetTextColour(colour[1],colour[2],colour[3], 255) - SetTextEntry("STRING") - SetTextDropShadow(0, 0, 0, 0,255) - SetTextDropShadow() - SetTextEdge(4, 0, 0, 0, 255) - SetTextOutline() - AddTextComponentString(content) - DrawText(x, y) -end \ No newline at end of file + SetTextFont(font) + SetTextScale(scale, scale) + SetTextColour(colour[1], colour[2], colour[3], 255) + SetTextEntry("STRING") + SetTextDropShadow(0, 0, 0, 0, 255) + SetTextDropShadow() + SetTextEdge(4, 0, 0, 0, 255) + SetTextOutline() + AddTextComponentString(content) + DrawText(x, y) +end diff --git a/server-data/resources/[bpt_addons]/bpt_hud/client/client.lua b/server-data/resources/[bpt_addons]/bpt_hud/client/client.lua index 6ac36f387..9eca5adc2 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/client/client.lua +++ b/server-data/resources/[bpt_addons]/bpt_hud/client/client.lua @@ -1,65 +1,64 @@ local minimap = RequestScaleformMovie("minimap") CreateThread(function() - while true do - Wait(1250) + while true do + Wait(1250) - if IsPauseMenuActive() then - SendNUIMessage({mapfoil = true}) - SendNUIMessage({mapoutline = false}) - else - SendNUIMessage({mapfoil = false}) - SendNUIMessage({mapoutline = true}) - end + if IsPauseMenuActive() then + SendNUIMessage({ mapfoil = true }) + SendNUIMessage({ mapoutline = false }) + else + SendNUIMessage({ mapfoil = false }) + SendNUIMessage({ mapoutline = true }) + end - SetRadarZoom(1150) + SetRadarZoom(1150) - if Config.Hidemapoutsidecar then - if Config.Hidemapwhenengineoff then - local player = PlayerPedId() - local vehicle = GetVehiclePedIsIn(player, false) - local vehicleIsOn = GetIsVehicleEngineRunning(vehicle) - if IsPedInAnyVehicle(player, false) and vehicleIsOn then - ToggleRadar(true) - SendNUIMessage({mapoutline = true}) - TriggerVehicleLoop() - else - ToggleRadar(false) - SendNUIMessage({mapoutline = false}) - end - else - local player = PlayerPedId() - if IsPedInAnyVehicle(player, false) then - ToggleRadar(true) - SendNUIMessage({mapoutline = true}) - TriggerVehicleLoop() - else - ToggleRadar(false) - SendNUIMessage({mapoutline = false}) - end - end - end - end + if Config.Hidemapoutsidecar then + if Config.Hidemapwhenengineoff then + local player = PlayerPedId() + local vehicle = GetVehiclePedIsIn(player, false) + local vehicleIsOn = GetIsVehicleEngineRunning(vehicle) + if IsPedInAnyVehicle(player, false) and vehicleIsOn then + ToggleRadar(true) + SendNUIMessage({ mapoutline = true }) + TriggerVehicleLoop() + else + ToggleRadar(false) + SendNUIMessage({ mapoutline = false }) + end + else + local player = PlayerPedId() + if IsPedInAnyVehicle(player, false) then + ToggleRadar(true) + SendNUIMessage({ mapoutline = true }) + TriggerVehicleLoop() + else + ToggleRadar(false) + SendNUIMessage({ mapoutline = false }) + end + end + end + end end) local x = -0.025 local y = -0.015 CreateThread(function() - RequestStreamedTextureDict("circlemap", false) while not HasStreamedTextureDictLoaded("circlemap") do Wait(100) end AddReplaceTexture("platform:/textures/graphics", "radarmasksm", "circlemap", "radarmasksm") - SetMinimapClipType(1) - SetMinimapComponentPosition('minimap', 'L', 'B', -0.022, -0.026, 0.16, 0.245) - SetMinimapComponentPosition('minimap_mask', 'L', 'B', x + 0.21, y + 0.09, 0.071, 0.164) - SetMinimapComponentPosition('minimap_blur', 'L', 'B', -0.032, -0.04, 0.18, 0.22) - ThefeedSpsExtendWidescreenOn() - SetRadarBigmapEnabled(true, false) - SetRadarBigmapEnabled(false, false) + SetMinimapClipType(1) + SetMinimapComponentPosition("minimap", "L", "B", -0.022, -0.026, 0.16, 0.245) + SetMinimapComponentPosition("minimap_mask", "L", "B", x + 0.21, y + 0.09, 0.071, 0.164) + SetMinimapComponentPosition("minimap_blur", "L", "B", -0.032, -0.04, 0.18, 0.22) + ThefeedSpsExtendWidescreenOn() + SetRadarBigmapEnabled(true, false) + SetRadarBigmapEnabled(false, false) end) ToggleRadar = function(state) @@ -72,6 +71,6 @@ end TriggerVehicleLoop = function() CreateThread(function() ToggleRadar(true) - SetRadarBigmapEnabled(false, false) + SetRadarBigmapEnabled(false, false) end) end diff --git a/server-data/resources/[bpt_addons]/bpt_hud/client/status.lua b/server-data/resources/[bpt_addons]/bpt_hud/client/status.lua index 5a1035d4f..b142248cf 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/client/status.lua +++ b/server-data/resources/[bpt_addons]/bpt_hud/client/status.lua @@ -6,7 +6,7 @@ local posi = "bottom" ESX = exports["es_extended"]:getSharedObject() -AddEventHandler('playerSpawned', function() -- Enable hud only after player spawn +AddEventHandler("playerSpawned", function() -- Enable hud only after player spawn CreateThread(function() while true do Wait(0) @@ -16,15 +16,15 @@ AddEventHandler('playerSpawned', function() -- Enable hud only after player spa health = math.ceil(GetEntityHealth(GetPlayerPed(-1)) - 100) end armor = math.ceil(GetPedArmour(GetPlayerPed(-1))) - TriggerEvent('esx_status:getStatus', 'hunger', function(status) + TriggerEvent("esx_status:getStatus", "hunger", function(status) food = status.getPercent() end) - TriggerEvent('esx_status:getStatus', 'thirst', function(status) + TriggerEvent("esx_status:getStatus", "thirst", function(status) thirst = status.getPercent() end) SendNUIMessage({ posi = posi, - show = IsPauseMenuActive(), -- Disable hud if settings menu is active + show = IsPauseMenuActive(), -- Disable hud if settings menu is active health = health, armor = armor, food = food, @@ -32,4 +32,4 @@ AddEventHandler('playerSpawned', function() -- Enable hud only after player spa }) end end) -end) \ No newline at end of file +end) diff --git a/server-data/resources/[bpt_addons]/bpt_hud/config.lua b/server-data/resources/[bpt_addons]/bpt_hud/config.lua index 9e830811e..4897edbb1 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/config.lua +++ b/server-data/resources/[bpt_addons]/bpt_hud/config.lua @@ -1,4 +1,4 @@ Config = {} Config.Hidemapoutsidecar = true -- set to true if you want to hide the minimap when not in a vehicle -Config.Hidemapwhenengineoff = true -- set to true if you want to hide the map when a vehicles engine is off \ No newline at end of file +Config.Hidemapwhenengineoff = true -- set to true if you want to hide the map when a vehicles engine is off diff --git a/server-data/resources/[bpt_addons]/bpt_hud/fxmanifest.lua b/server-data/resources/[bpt_addons]/bpt_hud/fxmanifest.lua index b96e6d13f..395202164 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/fxmanifest.lua +++ b/server-data/resources/[bpt_addons]/bpt_hud/fxmanifest.lua @@ -1,22 +1,22 @@ -fx_version 'adamant' +fx_version("adamant") -game 'gta5' -author 'bitpredator' -description 'bitpredator HUD' -version '1.0.0' +game("gta5") +author("bitpredator") +description("bitpredator HUD") +version("1.0.1") -ui_page 'html/ui.html' +ui_page("html/ui.html") -shared_script '@es_extended/imports.lua' +shared_script("@es_extended/imports.lua") -files { - 'html/*.css', - 'html/*.js', - 'html/*.png', - 'html/ui.html', -} +files({ + "html/*.css", + "html/*.js", + "html/*.png", + "html/ui.html", +}) -client_scripts { - 'client/*.lua', - 'config.lua' -} \ No newline at end of file +client_scripts({ + "client/*.lua", + "config.lua", +}) diff --git a/server-data/resources/[bpt_addons]/bpt_hud/html-map/script.js b/server-data/resources/[bpt_addons]/bpt_hud/html-map/script.js index 56f64a624..746ef0108 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/html-map/script.js +++ b/server-data/resources/[bpt_addons]/bpt_hud/html-map/script.js @@ -1,17 +1,18 @@ $(document).ready(function () { -window.addEventListener("message", function (event) { - let data = event.data; + window.addEventListener("message", function (event) { + let data = event.data; - if (data.mapoutline == true) { - $(".outline").show(); - } else if (data.mapoutline == false) { - $(".outline").hide(); - } + if (data.mapoutline == true) { + $(".outline").show(); + } else if (data.mapoutline == false) { + $(".outline").hide(); + } - if (data.mapfoil == true) { - $(".mapfoil").hide(); - } else if (data.mapfoil == false) { - $(".mapfoil").show(); - } + if (data.mapfoil == true) { + $(".mapfoil").hide(); + } else if (data.mapfoil == false) { + $(".mapfoil").show(); + } -})}) + }) +}) diff --git a/server-data/resources/[bpt_addons]/bpt_hud/html/style.css b/server-data/resources/[bpt_addons]/bpt_hud/html/style.css index bbf4961bd..06af473d9 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/html/style.css +++ b/server-data/resources/[bpt_addons]/bpt_hud/html/style.css @@ -1,26 +1,27 @@ - -.main{ +.main { position: absolute; - padding: 0; - margin: 0; - right: 42.5%; - bottom: 0.3%; + padding: 0; + margin: 0; + right: 42.5%; + bottom: 0.3%; } -ul{ - padding-left:0vw; - margin:0px; + +ul { + padding-left: 0vw; + margin: 0px; } -ul > li{ + +ul>li { display: inline-block; - margin-left: 5px + margin-left: 5px } -img{ +img { width: 70%; position: absolute; - top: 50%; - left: 50%; + top: 50%; + left: 50%; transform: translate(-50%, -50%); background-color: transparent } @@ -30,7 +31,7 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; border: 2px solid transparent; box-shadow: 0 0 0 2px #37AD6F; border-radius: 50%; @@ -43,10 +44,10 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; border: 2px solid transparent; - box-shadow: 0 0 0 2px rgba(40,40,198,1); + box-shadow: 0 0 0 2px rgba(40, 40, 198, 1); border-radius: 50%; overflow: hidden; } @@ -56,7 +57,7 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; /*background: #ccc;*/ border: 2px solid transparent; box-shadow: 0 0 0 2px #FAAA03; @@ -69,12 +70,12 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; border: 2px solid transparent; box-shadow: 0 0 0 2px #1EB7E6; border-radius: 50%; overflow: hidden; - + } .circle5 { @@ -82,7 +83,7 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; /*background: #ccc;*/ border: 2px solid transparent; box-shadow: 0 0 0 2px #677BBB; @@ -95,121 +96,118 @@ img{ top: 50%; left: 50%; width: 2vw; - height:2vw; + height: 2vw; /*background: #ccc;*/ border: 2px solid transparent; - box-shadow: 0 0 0 2px rgba(198.40,40,1); + box-shadow: 0 0 0 2px rgba(198.40, 40, 1); border-radius: 50%; overflow: hidden; } -.wave{ +.wave { position: relative; width: 100%; - height:100%; - + height: 100%; + background: #37AD6F; border-radius: 20%; /*color: rgba(225,0,0,1)*/ - + } -.wave2{ +.wave2 { position: relative; width: 100%; - height:100%; - background: rgba(40,40,198,1); + height: 100%; + background: rgba(40, 40, 198, 1); border-radius: 20%; /*color: rgba(225,0,0,1)*/ } .wave2:before, -.wave2:after{ +.wave2:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -50%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave2:before{ +.wave2:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave2:after{ +.wave2:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } .wave:before, -.wave:after{ +.wave:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -40%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave:before{ +.wave:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave:after{ +.wave:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } -.wave3{ +.wave3 { position: relative; width: 100%; - height:100%; + height: 100%; background: #FAAA03; border-radius: 20%; } .wave3:before, -.wave3:after{ +.wave3:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -50%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave3:before{ +.wave3:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave3:after{ +.wave3:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } -.wave4{ +.wave4 { position: relative; width: 100%; - height:100%; + height: 100%; background: #1EB7E6; border-radius: 20%; /*color: rgba(225,0,0,1)*/ @@ -217,33 +215,32 @@ img{ } .wave4:before, -.wave4:after{ +.wave4:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -50%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave4:before{ +.wave4:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave4:after{ +.wave4:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } -.wave5{ +.wave5 { position: relative; width: 100%; - height:100%; + height: 100%; background: #677BBB; border-radius: 20%; /*color: rgba(225,0,0,1)*/ @@ -251,72 +248,68 @@ img{ } .wave5:before, -.wave5:after{ +.wave5:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -50%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave5:before{ +.wave5:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave5:after{ +.wave5:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } -.wave6{ +.wave6 { position: relative; width: 100%; - height:100%; - background: rgba(198.40,40,1); + height: 100%; + background: rgba(198.40, 40, 1); border-radius: 20%; /*color: rgba(225,0,0,1)*/ } .wave6:before, -.wave6:after{ +.wave6:after { content: ''; position: absolute; width: 200%; height: 200%; top: var(--top, -50%); left: 50%; - transform: translate(-50%,-75%); + transform: translate(-50%, -75%); background: #000 - } -.wave6:before{ +.wave6:before { border-radius: 75%; animation: animate 5s linear infinite; } -.wave6:after{ +.wave6:after { border-radius: 40%; - background: rgba(225,225,225,.5); + background: rgba(225, 225, 225, .5); animation: animate 5s linear infinite; } -@keyframes animate -{ - 0% - { - transform: translate(-50%,-75%) rotate(0deg); +@keyframes animate { + 0% { + transform: translate(-50%, -75%) rotate(0deg); } - 100% - { - transform: translate(-50%,-75%) rotate(360deg); + + 100% { + transform: translate(-50%, -75%) rotate(360deg); } } @@ -332,77 +325,77 @@ img{ .mapborder { width: 24.25vh; height: 21.5vh; - border: 0.45vh solid rgb(159,163,171,0.85); + border: 0.45vh solid rgb(159, 163, 171, 0.85); border-radius: 50%; - box-shadow: 0px 0px 16px rgba(0,0,0,0.5) inset; + box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.5) inset; position: relative; right: 2.8vh; top: 2.75vh; display: inline-block; } - + @media only screen and (max-width: 1366px) { .outline { - position: fixed; - bottom: 10vh; - left: 2.6vh; - width: 29.529vh; - text-align: center; + position: fixed; + bottom: 10vh; + left: 2.6vh; + width: 29.529vh; + text-align: center; } - + .mapborder { - width: 24.25vh; - height: 21.5vh; - border: 4px solid #9fa3ab; - border-radius: 50%; - box-shadow: 0px 0px 16px rgba(0,0,0,0.5); - position: relative; - right: 2.8vh; - top: 2.4vh; - display: inline-block; + width: 24.25vh; + height: 21.5vh; + border: 4px solid #9fa3ab; + border-radius: 50%; + box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.5); + position: relative; + right: 2.8vh; + top: 2.4vh; + display: inline-block; } } - + @media only screen and (max-width: 1280px) { .outline { - position: fixed; - bottom: 10vh; - left: 2.8vh; - width: 29.529vh; - text-align: center; + position: fixed; + bottom: 10vh; + left: 2.8vh; + width: 29.529vh; + text-align: center; } - + .mapborder { - width: 180px; - height: 150.25px; - border: 4px solid #9fa3ab; - border-radius: 50%; - box-shadow: 0px 0px 16px rgba(0,0,0,0.5); - position: relative; - right: 36.50px; - top: 39.5px; - display: inline-block; - } -} - + width: 180px; + height: 150.25px; + border: 4px solid #9fa3ab; + border-radius: 50%; + box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.5); + position: relative; + right: 36.50px; + top: 39.5px; + display: inline-block; + } +} + @media only screen and (max-width: 1768px) { .outline { - position: fixed; - bottom: 8.5vh; - left: 1.4vh; - width: 29.529vh; - text-align: center; + position: fixed; + bottom: 8.5vh; + left: 1.4vh; + width: 29.529vh; + text-align: center; } - + .mapborder { - width: 240px; - height: 210.25px; - border: 4px solid #9fa3ab; - border-radius: 50%; - box-shadow: 0px 0px 16px rgba(0,0,0,0.5); - position: relative; - right: 36.50px; - top: 39.5px; - display: inline-block; + width: 240px; + height: 210.25px; + border: 4px solid #9fa3ab; + border-radius: 50%; + box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.5); + position: relative; + right: 36.50px; + top: 39.5px; + display: inline-block; } } \ No newline at end of file diff --git a/server-data/resources/[bpt_addons]/bpt_hud/html/style.js b/server-data/resources/[bpt_addons]/bpt_hud/html/style.js index 5cbb03696..efaee6d8d 100644 --- a/server-data/resources/[bpt_addons]/bpt_hud/html/style.js +++ b/server-data/resources/[bpt_addons]/bpt_hud/html/style.js @@ -1,41 +1,40 @@ -$(document).ready(function(){ - window.addEventListener('message', function(event) { - var data = event.data; - if (data.show == false){ - if (data.posi == "bottom"){ - $("body").show(); - soMany = 50-data.health; - document.querySelectorAll('.wave')[0].style.setProperty("--top", `${soMany}%`); - - armorJS = 50 - data.armor - document.querySelectorAll('.wave2')[0].style.setProperty("--top", `${armorJS}%`); - - foodJS = 50 - data.food - document.querySelectorAll('.wave3')[0].style.setProperty("--top", `${foodJS}%`); - - waterJS = 50 - data.thirst - document.querySelectorAll('.wave4')[0].style.setProperty("--top", `${waterJS}%`); +$(document).ready(function () { + window.addEventListener('message', function (event) { + var data = event.data; + if (data.show == false) { + if (data.posi == "bottom") { + $("body").show(); + soMany = 50 - data.health; + document.querySelectorAll('.wave')[0].style.setProperty("--top", `${soMany}%`); + + armorJS = 50 - data.armor + document.querySelectorAll('.wave2')[0].style.setProperty("--top", `${armorJS}%`); + + foodJS = 50 - data.food + document.querySelectorAll('.wave3')[0].style.setProperty("--top", `${foodJS}%`); + + waterJS = 50 - data.thirst + document.querySelectorAll('.wave4')[0].style.setProperty("--top", `${waterJS}%`); + } + else { + $(".main").css("top", "15vh"); + $(".main").css("right", "5vw"); + $("body").show(); + soMany = 50 - data.health; + document.querySelectorAll('.wave')[0].style.setProperty("--top", `${soMany}%`); + + armorJS = 50 - data.armor + document.querySelectorAll('.wave2')[0].style.setProperty("--top", `${armorJS}%`); + + foodJS = 50 - data.food + document.querySelectorAll('.wave3')[0].style.setProperty("--top", `${foodJS}%`); + + waterJS = 50 - data.thirst + document.querySelectorAll('.wave4')[0].style.setProperty("--top", `${waterJS}%`); + } } - else - { - $(".main").css("top", "15vh"); - $(".main").css("right", "5vw"); - $("body").show(); - soMany = 50-data.health; - document.querySelectorAll('.wave')[0].style.setProperty("--top", `${soMany}%`); - - armorJS = 50 - data.armor - document.querySelectorAll('.wave2')[0].style.setProperty("--top", `${armorJS}%`); - - foodJS = 50 - data.food - document.querySelectorAll('.wave3')[0].style.setProperty("--top", `${foodJS}%`); - - waterJS = 50 - data.thirst - document.querySelectorAll('.wave4')[0].style.setProperty("--top", `${waterJS}%`); - }} - else - { + else { $("body").hide(); } - }); + }); }); \ No newline at end of file