diff --git a/resources/EasyDrift/.vscode/settings.json b/resources/EasyDrift/.vscode/settings.json deleted file mode 100644 index d12912ac1..000000000 --- a/resources/EasyDrift/.vscode/settings.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Lua.diagnostics.disable": [ - "undefined-global", - "trailing-space" - ], - "lua.targetVersion": "5.2" -} \ No newline at end of file diff --git a/resources/EasyDrift/README.md b/resources/EasyDrift/README.md deleted file mode 100644 index d600b9d4b..000000000 --- a/resources/EasyDrift/README.md +++ /dev/null @@ -1,75 +0,0 @@ -# EasyDrift -## A simple drift counter -[![Image](https://discordapp.com/api/guilds/926120299232112671/widget.png?style=shield)](https://discord.gg/fhgc3s8HzS) - -EasyDrift is a simple drift counter that also provides a multitude of events and functions to integrate the system with your own HUD - -- Drag and drop if you don't want to loose time ! -- Fixed a popular issue on drift counter where low fps would get less score -- Easy integration with your own HUD -- Pre made HUD *inspired* by forza - -![image](https://user-images.githubusercontent.com/19718604/148116457-20785570-ca14-40c7-9948-e8353927d4ed.png) - - -## Events (Client side) - -EasyDrift provides a list of events to use to integrate the system with your framework or HUD. Want to give money as a reward to your players after a great drift? It's possible! -Each event name can be changed in the resource's config file. - - -| Event | Default event name | Argument passed | -| ------ | ------ | ------ | -| Start drifting | drift:start | none | -| Stop drifting | drift:finish | 1: final score | -| Enable counter | drift:enable | none | -| Disable counter | drift:disable | none | -| Toggle counter | drift:toggle | none | - - -Some events are also available to retrieve information - -`drift:GetCurrentDriftScore` -Get the current drift score -``` --- Exemple usage -TriggerEvent("drift:GetCurrentDriftScore", function(score) - print("My score is: ", score) -end) -``` - -`drift:IsDrifting` -Get if the player is drifting or not -``` --- Exemple usage -TriggerEvent("drift:IsDrifting", function(isDrifting) - print("Am i drifitng ? ", isDrifting) -end) -``` - -`drift:IsEnabled` -Check counter is enabled -``` --- Exemple usage -TriggerEvent("drift:IsEnabled", function(isEnabled) - print("Is the counter enabled ? ", isEnabled) -end) -``` - - -# Advanced developer - -A global export is also available allowing you to access all the variables / functions of the code from another resource. I don't recommend to use this if you are not sure of what you are doing. -Export name `GetModules` -``` --- Exemple usage -local Modules = exports[‘EasyDrift’]:GetModules() -print(Modules.DriftCounter.CurrentPoints) -``` - - -# Support - -Want some support or request something to be added ? Come here ! - -[![Discord2](https://discordapp.com/api/guilds/926120299232112671/widget.png?style=banner4)](https://discord.gg/fhgc3s8HzS) diff --git a/resources/EasyDrift/client/module/handler/module_handler.lua b/resources/EasyDrift/client/module/handler/module_handler.lua deleted file mode 100644 index 270f07ef3..000000000 --- a/resources/EasyDrift/client/module/handler/module_handler.lua +++ /dev/null @@ -1,5 +0,0 @@ -Modules = {} - -exports('GetModules', function() - return Modules -end) \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/drift_counter.lua b/resources/EasyDrift/client/module/modules/drift_counter.lua deleted file mode 100644 index 47fd22bf1..000000000 --- a/resources/EasyDrift/client/module/modules/drift_counter.lua +++ /dev/null @@ -1,193 +0,0 @@ -Modules.DriftCounter = {} -Modules.DriftCounter.IsEnabled = true -Modules.DriftCounter.IsDrifting = false -Modules.DriftCounter.CurrentPoints = 0 -Modules.DriftCounter.CurrentAngle = 0 -- Only refreshed when the player is drifting -Modules.DriftCounter.ChainCooldown = ConfigShared.DriftChainTime -Modules.DriftCounter.ChainLoopStarted = false -Modules.DriftCounter.ChainTimeLeft = 0 -Modules.DriftCounter.GlobalAlpha = 0 -if ConfigShared.devmod then - Modules.DriftCounter.GlobalAlpha = 255 -end -Modules.DriftCounter.InAnimation = false -Modules.DriftCounter.CachedAllowedVeh = {} - - - --- Source: https://github.com/Blumlaut/FiveM-DriftCounter/blob/master/driftcounter_c.lua --- Lot of math stuff i don't understand, thanks Blumlaut -function Modules.DriftCounter.GetCurrentAngle() - if Modules.Player.IsPedInAnyVehicle() then - local veh = Modules.Player.GetCurrentVehicle() - local vx,vy,_ = table.unpack(GetEntityVelocity(veh)) - local modV = math.sqrt(vx*vx + vy*vy) - - - local _,_,rz = table.unpack(GetEntityRotation(veh,0)) - local sn,cs = -math.sin(math.rad(rz)), math.cos(math.rad(rz)) - - if GetEntitySpeed(veh)* 3.6 < 25 or GetVehicleCurrentGear(veh) == 0 then return 0,modV end --speed over 25 km/h - - local cosX = (sn*vx + cs*vy)/modV - return math.deg(math.acos(cosX))*0.5, modV - else - return 0 - end -end - --- Cleaning the cache to avoid any memory leak as the system will load up every vehicule entity the player goes in. If the entity is deleted or not in range it will be removed from the list to avoid memory leaks -function Modules.DriftCounter.CleanUpCache() - for veh, allowed in pairs(Modules.DriftCounter.CachedAllowedVeh) do - if not DoesEntityExist(veh) then - Modules.DriftCounter.CachedAllowedVeh[veh] = nil - end - end -end - -function Modules.DriftCounter.IsVehiculeAllowedToDrift(pVeh) - if ConfigShared.UseVehicleWhitelist then - if Modules.DriftCounter.CachedAllowedVeh[pVeh] == nil then - local pVehModel = GetEntityModel(pVeh) - if ConfigShared.WhitelistedVehicules[pVehModel] ~= nil then - Modules.DriftCounter.CachedAllowedVeh[pVeh] = true - else - Modules.DriftCounter.CachedAllowedVeh[pVeh] = false - end - Modules.DriftCounter.CleanUpCache() - else - return Modules.DriftCounter.CachedAllowedVeh[pVeh] -- Using a cache system allow better performance, we don't check the vehicle model every time. - end - else - return true - end -end - -function Modules.DriftCounter.IsPlayerDrifting() - if Modules.Player.IsPedInAnyVehicle() then - local pVeh = Modules.Player.GetCurrentVehicle() - if Modules.DriftCounter.IsVehiculeAllowedToDrift(pVeh) then - if GetEntityHeightAboveGround(pVeh) <= 1.5 then - if Modules.Player.GetPed() == GetPedInVehicleSeat(pVeh, -1) then - Modules.DriftCounter.CurrentAngle = Modules.DriftCounter.GetCurrentAngle() - if Modules.DriftCounter.CurrentAngle > 10 then - return true - else - return false - end - else - return false - end - else - return false - end - end - else - return false - end -end - -function Modules.DriftCounter.StartChainBreakLoop() - if not Modules.DriftCounter.ChainLoopStarted then - Modules.DriftCounter.ChainLoopStarted = true - if ConfigShared.UseDefaultUI then - Modules.DriftCounter.FadeInHud() - end - TriggerEvent(ConfigShared.DriftStartEvent) - Citizen.CreateThread(function() - Modules.Utils.RealWait(Modules.DriftCounter.ChainCooldown, function(cb, timeLeft) - Modules.DriftCounter.ChainTimeLeft = timeLeft - (timeLeft * 2) -- Duh - if Modules.DriftCounter.IsDrifting then - cb(false, ConfigShared.DriftChainTime) - end - end) - if ConfigShared.UseDefaultUI then - Modules.DriftCounter.FadeOutHud() - end - TriggerEvent(ConfigShared.DriftFinishedEvent, Modules.DriftCounter.CurrentPoints) - Modules.DriftCounter.ChainCooldown = ConfigShared.DriftChainTime - Modules.DriftCounter.ChainLoopStarted = false - Modules.DriftCounter.CurrentPoints = 0 - Modules.DriftCounter.CurrentAngle = 0 - Modules.DriftCounter.ChainTimeLeft = 0 - end) - end -end - -function Modules.DriftCounter.FadeInHud() - Citizen.CreateThread(function() - Modules.DriftCounter.InAnimation = true - while Modules.DriftCounter.GlobalAlpha < 255 do - Modules.DriftCounter.GlobalAlpha = Modules.DriftCounter.GlobalAlpha + (0.5 * Modules.Utils.TimeFrame) - Wait(0) - end - Modules.DriftCounter.InAnimation = false - Modules.DriftCounter.GlobalAlpha = 255 - end) -end - -function Modules.DriftCounter.FadeOutHud() - Citizen.CreateThread(function() - Modules.DriftCounter.InAnimation = true - while Modules.DriftCounter.GlobalAlpha > 0 do - Modules.DriftCounter.GlobalAlpha = Modules.DriftCounter.GlobalAlpha - (0.5 * Modules.Utils.TimeFrame) - Wait(0) - end - Modules.DriftCounter.InAnimation = false - Modules.DriftCounter.GlobalAlpha = 0 - end) -end - -Citizen.CreateThread(function() - while true do - if Modules.DriftCounter.IsEnabled then -- Check we're enabled - if Modules.DriftCounter.IsPlayerDrifting() then - Modules.DriftCounter.IsDrifting = true - Modules.DriftCounter.StartChainBreakLoop() - if Modules.DriftCounter.CurrentAngle > 10 then - if ConfigShared.AddPointBasedOnAngle then - Modules.DriftCounter.CurrentPoints = math.floor(Modules.DriftCounter.CurrentPoints + (Modules.DriftCounter.CurrentAngle / 100) * Modules.Utils.TimeFrame) -- This fix the issue where player with low fps would get less point then player with high fps count. - end - - if ConfigShared.AddStaticPointOnDrifting then - Modules.DriftCounter.CurrentPoints = math.floor(Modules.DriftCounter.CurrentPoints + ConfigShared.StaticPointToAdd * Modules.Utils.TimeFrame) -- This fix the issue where player with low fps would get less point then player with high fps count. - end - end - else - Modules.DriftCounter.IsDrifting = false - if Modules.DriftCounter.ChainLoopStarted then - Wait(0) -- Chain active, so we need to check if the player start drifting again or not as fast as possible - else - Wait(100) -- Could be longer i guess, but will take more time to detect if the player is drifting or not. - end - end - else - Wait(1000) -- Sleep if disabled - end - Wait(0) - end -end) - -AddEventHandler(ConfigShared.GetCurrentDriftScore, function(cb) - cb(Modules.DriftCounter.CurrentPoints) -end) - -AddEventHandler(ConfigShared.IsDrifting, function(cb) - cb(Modules.DriftCounter.IsDrifting) -end) - -AddEventHandler(ConfigShared.IsEnabled, function(cb) - cb(Modules.DriftCounter.IsEnabled) -end) - -AddEventHandler(ConfigShared.EnableEvent, function() - Modules.DriftCounter.IsEnabled = true -end) - -AddEventHandler(ConfigShared.DisableEvent, function() - Modules.DriftCounter.IsEnabled = false -end) - -AddEventHandler(ConfigShared.ToggleEvent, function() - Modules.DriftCounter.IsEnabled = not Modules.DriftCounter.IsEnabled -end) diff --git a/resources/EasyDrift/client/module/modules/loader.lua b/resources/EasyDrift/client/module/modules/loader.lua deleted file mode 100644 index 4ec25a04c..000000000 --- a/resources/EasyDrift/client/module/modules/loader.lua +++ /dev/null @@ -1,19 +0,0 @@ -Modules.Loader = {} -Modules.Loader.dictToLoadFirst = { - {"ui_drift"}, -} -Modules.Loader.FontToLoad = { - {"forza", "forza"}, -} - -function Modules.Loader.Run() - while Modules.UI == nil do - Wait(1) - end - for k,v in pairs(Modules.Loader.dictToLoadFirst) do - Modules.UI.LoadStreamDict(v[1]) - end - for k,v in pairs(Modules.Loader.FontToLoad) do - Modules.UI.LoadFont(v) - end -end \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/lobby.lua b/resources/EasyDrift/client/module/modules/lobby.lua deleted file mode 100644 index 0dfedf855..000000000 --- a/resources/EasyDrift/client/module/modules/lobby.lua +++ /dev/null @@ -1,5 +0,0 @@ -Modules.Lobby = {} - -Citizen.CreateThreadNow(function() - Modules.Loader.Run() -end) \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/log.lua b/resources/EasyDrift/client/module/modules/log.lua deleted file mode 100644 index e130cc2f0..000000000 --- a/resources/EasyDrift/client/module/modules/log.lua +++ /dev/null @@ -1,5 +0,0 @@ -Modules.Log = {} - -function Modules.Log.Error(...) - print("^1ERROR: ^7", ...) -end \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/native_ui.lua b/resources/EasyDrift/client/module/modules/native_ui.lua deleted file mode 100644 index 03adb293c..000000000 --- a/resources/EasyDrift/client/module/modules/native_ui.lua +++ /dev/null @@ -1,517 +0,0 @@ --- Some parts here are pretty ugly, i know. Will to a refractor to this lib someday. -Modules.UI = {} -Modules.UI.cooldown = false -Modules.UI.font = {} -Modules.UI.AnimatedFrames = {} -Modules.UI.pages = { - ["hud_drift"] = { - label = "hud_drift", - active = false, - lockControls = false, - showCursor = false, - drawFunction = function() - Modules.UI.DisplayDrift() - end, - }, -} -Modules.UI.lockedControls = { - {24, 30, 31, 32, 33, 34, 35, 69, 70, 92, 114, 121, 140, 141, 142, 257, 263, 264, 331, 1, 2, 4, 5, 17, 16, 15, 14} -} - -function Modules.UI.IsAnySubMenuActive() - for k,v in pairs(Modules.UI.pages) do - if v.active then - return true - end - end - return false -end - -function Modules.UI.SetPageActive(page) - if Modules.UI.pages[page] then - Modules.UI.pages[page].active = true - end -end - -function Modules.UI.SetPageInactive(page) - if Modules.UI.pages[page] then - Modules.UI.pages[page].active = false - end -end - -function Modules.UI.SetFullscreenLoaderActive(status) - if status then - SendNUIMessage({ - type = 'toggleLoaderOn', - }) - else - SendNUIMessage({ - type = 'toggleLoaderOff', - }) - end -end - -function Modules.UI.ForceStopIntro() - SendNUIMessage({ - type = 'stopIntro', - }) -end - -Citizen.CreateThread(function() - while true do - local lockControls = false - local showCursor = false - - - for k,v in pairs(Modules.UI.pages) do - --print(v.active, k) - if v.active then - if v.showCursor then - showCursor = true - end - if v.lockControls then - lockControls = true - end - v.drawFunction() - end - end - - if showCursor then - ShowCursorThisFrame() - SetMouseCursorSprite(1) - end - - if lockControls then - for k,v in pairs(Modules.UI.lockedControls[1]) do - if v ~= nil then - DisableControlAction(0, v, true) - end - end - end - - Wait(1) - end -end) - - --- Duplicate, need to be removed -function Modules.UI.RealWait(ms, cb) - local timer = GetGameTimer() + ms - while GetGameTimer() < timer do - if cb ~= nil then - cb(function(stop) - if stop then - timer = 0 - return - end - end) - end - Wait(0) - end -end - -function Modules.UI.LoadStreamDict(dict) - while not HasStreamedTextureDictLoaded(dict) do - RequestStreamedTextureDict(dict, 1) - print("Loading dict ", dict) - Wait(0) - end - print("Dict loaded! ", dict) -end - -function Modules.UI.LoadFont(font) - RegisterFontFile(font[1]) -- the name of your .gfx, without .gfx - local fontId = RegisterFontId(font[2]) -- the name from the .xml - - Modules.UI.font[font[2]] = fontId -end - - -function Modules.UI.DrawSlider(screenX, screenY, width, height, backgroundColor, progressColor, value, max, settings, cb) - if settings.devmod ~= nil and settings.devmod == true then - local x = GetControlNormal(0, 239) - local y = GetControlNormal(0, 240) - - - screenX = x - screenY = y - - - if IsControlJustReleased(0, 38) then - TriggerEvent("addToCopy", x..", "..y) - end - end - - if value > max then - value = max - end - - if settings.direction == nil then - settings.direction = 1 - end - - local valueUpdated = false - local newValue = value - - local pos = (vector2(screenX, screenY) + vector2(width, height) / 2.0) - DrawRect(pos[1], pos[2], width, height, backgroundColor[1], backgroundColor[2], backgroundColor[3], backgroundColor[4]) - - local progressWidth = (value/max) * width - local progressHeight = height - - if settings.direction == 1 then -- left-to-right - pos = (vector2(screenX, screenY) + vector2(progressWidth, height) / 2.0) - elseif settings.direction == 2 then -- right-to-left - pos = pos + vector2(width / 2.0, 0.0) - vector2(progressWidth / 2.0, 0.0) - elseif settings.direction == 3 then -- bottom-to-top - progressWidth = width - progressHeight = (value/max) * width - pos = pos + vector2(0.0, height / 2.0) - vector2(0.0, progressHeight / 2.0) - elseif settings.direction == 4 then -- top-to-bottom - progressWidth = width - progressHeight = (value/max) * width - pos = pos - vector2(0.0, height / 2.0) + vector2(0.0, progressHeight / 2.0) - end - - DrawRect(pos[1], pos[2], progressWidth, progressHeight, progressColor[1], progressColor[2], progressColor[3], progressColor[4]) - - if settings.noHover == false then - if Modules.UI.isMouseOnButton({x = GetControlNormal(0, 239) , y = GetControlNormal(0, 240)}, {x = screenX, y = screenY}, width, height) then - SetMouseCursorSprite(4) - if IsControlPressed(0, 24) then - local mouse = GetControlNormal(0, 239) - local size = ((mouse - screenX) * max) / width - newValue = size - - --print(newValue) - valueUpdated = true - end - end - end - - cb(valueUpdated, newValue) -end - - - -Modules.UI.HoveredCache = {} - -function Modules.UI.CheckIfAlreadyHovered(textureDict, textureName, screenX, screenY) - local uniqueID = textureDict .. textureName .. screenX .. screenY - if Modules.UI.HoveredCache[uniqueID] == nil then - Modules.UI.HoveredCache[uniqueID] = false - return false, uniqueID - else - return Modules.UI.HoveredCache[uniqueID], uniqueID - end -end - -function Modules.UI.SetHoveredStatus(uniqueID, status) - if Modules.UI.HoveredCache[uniqueID] ~= nil then - Modules.UI.HoveredCache[uniqueID] = status - end -end - -function Modules.UI.DrawSpriteNew(textureDict, textureName, screenX, screenY, width, height, heading, red, green, blue, alpha, settings, cb) - local onSelected = false - local onHovered = false - - if settings.devmod ~= nil and settings.devmod == true then - local x = GetControlNormal(0, 239) - local y = GetControlNormal(0, 240) - - print(x, y) - - screenX = x - screenY = y - - if IsControlJustReleased(0, 38) then - TriggerEvent("addToCopy", x..", "..y) - end - end - - local pos - if settings.centerDraw ~= nil and settings.centerDraw == true then - pos = vector2(screenX, screenY) - else - pos = (vector2(screenX, screenY) + vector2(width, height) / 2.0) - end - - -- if Modules.Sheets.IsSpriteAnimated(textureDict, textureName) then - -- textureName = textureName..Modules.Sheets.GetActualFrame(textureDict, textureName) - -- end - - if settings.Draw3d ~= nil then - SetDrawOrigin(settings.Draw3d.pos.x, settings.Draw3d.pos.y, settings.Draw3d.pos.z, 0) - pos = (vector2(0.0, 0.0) + vector2(width, height) / 2.0) - end - - if settings.NoHover ~= nil and settings.NoHover == true then - DrawSprite(textureDict, textureName, pos[1], pos[2], width, height, heading, red, green, blue, alpha) - else - if settings.Draw3d ~= nil then - _, screenX, screenY = GetScreenCoordFromWorldCoord(settings.Draw3d.pos.x, settings.Draw3d.pos.y, settings.Draw3d.pos.z) - end - if Modules.UI.isMouseOnButton({x = GetControlNormal(0, 239) , y = GetControlNormal(0, 240)}, {x = screenX, y = screenY}, width, height) then - onHovered = true - local aleadyHovered, spriteUniqueId = Modules.UI.CheckIfAlreadyHovered(textureDict, textureName, screenX, screenY) - if not aleadyHovered then - Modules.UI.SetHoveredStatus(spriteUniqueId, true) - Modules.Sound.PlaySound(math.random(1,99999), "FrontEnd/Navigate_Highlight", false, 0.02) - end - if settings.CustomHoverTexture ~= nil and settings.CustomHoverTexture ~= false then - if settings.CustomHoverTexture[3] ~= nil and settings.CustomHoverTexture[4] ~= nil then - local x,y = Modules.UI.ConvertToPixel(settings.CustomHoverTexture[3], settings.CustomHoverTexture[4]) - width = x - height = y - end - - DrawSprite(settings.CustomHoverTexture[1], settings.CustomHoverTexture[2], pos[1], pos[2], width, height, heading, red, green, blue, alpha) - else - DrawSprite(textureDict, textureName, pos[1], pos[2], width, height, heading, red, green, blue, alpha) - end - else - onHovered = false - local aleadyHovered, spriteUniqueId = Modules.UI.CheckIfAlreadyHovered(textureDict, textureName, screenX, screenY) - if aleadyHovered then - Modules.UI.SetHoveredStatus(spriteUniqueId, false) - end - DrawSprite(textureDict, textureName, pos[1], pos[2], width, height, heading, red, green, blue, alpha) - end - end - - - if settings.NoSelect == nil or settings.NoSelect == false and not settings.devmod == true then - if Modules.UI.isMouseOnButton({x = GetControlNormal(0, 239) , y = GetControlNormal(0, 240)}, {x = screenX, y = screenY}, width, height) then - SetMouseCursorSprite(4) - onHovered = true - if Modules.UI.HandleControl() then - --PlayCustomSound("FrontEnd/Navigate_Apply_01_Wave 0 0 0", 0.02) - Modules.Sound.PlaySound(math.random(1,99999), "FrontEnd/Navigate_Apply_01_Wave 0 0 0", false, 0.02) - onSelected = true - end - end - end - - if settings.Draw3d ~= nil then - ClearDrawOrigin() - end - - cb(onSelected, onHovered, pos) -end - --- Position = mouse pos -function Modules.UI.isMouseOnButton(position, buttonPos, Width, Heigh) - -- print(position, buttonPos, Width, Heigh) - return position.x >= buttonPos.x and position.y >= buttonPos.y and position.x < buttonPos.x + Width and position.y < buttonPos.y + Heigh -end - - - -function Modules.UI.HandleCooldown() - if not Modules.UI.cooldown then - Modules.UI.cooldown = true - Citizen.CreateThread(function() - Wait(150) - Modules.UI.cooldown = false - end) - end -end - -local clickControl = {24, 176} -function Modules.UI.HandleControl() - for k,v in pairs(clickControl) do - if not Modules.UI.cooldown then - if IsControlJustReleased(0, v) or IsDisabledControlJustReleased(0, v) then - Modules.UI.HandleCooldown() - return true - end - end - end - return false -end - - -function Modules.UI.DrawTexts(x, y, text, center, scale, rgb, font, rightJustify, devmod) - - if devmod then - local x2 = GetControlNormal(0, 239) - local y2 = GetControlNormal(0, 240) - - x = x2 - y = y2 - - if IsControlJustReleased(0, 38) then - TriggerEvent("addToCopy", x..", "..y) - end - end - - if rightJustify ~= 0 and rightJustify ~= false then - SetTextJustification(2) - SetTextWrap(0.0, x) - end - - SetTextFont(font) - SetTextScale(scale, scale) - - SetTextColour(rgb[1], rgb[2], rgb[3], rgb[4]) - SetTextEntry("STRING") - SetTextCentre(center) - AddTextComponentString(text) - EndTextCommandDisplayText(x,y) -end - -function Modules.UI.DrawTextsNoLimit(x, y, text, center, scale, rgb, font, rightJustify, devmod) - AddTextEntry("text", text) - - if devmod then - local x2 = GetControlNormal(0, 239) - local y2 = GetControlNormal(0, 240) - - print(x2, y2) - - x = x2 - y = y2 - end - - if rightJustify ~= 0 and rightJustify ~= false then - SetTextJustification(2) - SetTextWrap(0.0, x) - end - - SetTextFont(font) - SetTextScale(scale, scale) - - SetTextColour(rgb[1], rgb[2], rgb[3], rgb[4]) - SetTextEntry("STRING") - SetTextCentre(center) - AddTextComponentString(text) - EndTextCommandDisplayText(x,y) -end - -function Modules.UI.Draw3DText(x,y,z,textInput,fontId,scaleX,scaleY) - local px,py,pz=table.unpack(GetGameplayCamCoords()) - local dist = GetDistanceBetweenCoords(px,py,pz, x,y,z, 1) - local scale = (1/dist)*20 - local fov = (1/GetGameplayCamFov())*100 - local scale = scale*fov - SetTextScale(scaleX*scale, scaleY*scale) - SetTextFont(fontId) - SetTextProportional(1) - SetTextColour(250, 250, 250, 255) -- You can change the text color here - SetTextDropshadow(1, 1, 1, 1, 255) - SetTextEdge(2, 0, 0, 0, 150) - SetTextDropShadow() - SetTextOutline() - SetTextEntry("STRING") - SetTextCentre(1) - AddTextComponentString(textInput) - SetDrawOrigin(x,y,z, 0) - DrawText(0.0, 0.0) - ClearDrawOrigin() -end - - --- pos.xyz --- textureDict --- textureName --- x --- y --- width --- height --- heading --- r --- g --- b --- a -function Modules.UI.DrawSprite3d(data, dontDrawHowOfScreen) - if dontDrawHowOfScreen == nil then - dontDrawHowOfScreen = false - end - - local draw = false - if dontDrawHowOfScreen == false then - draw = true - else - local get, x,y = GetScreenCoordFromWorldCoord(data.pos.x, data.pos.y, data.pos.z) - --print(get, x, y) - if not get or x < 0.0 or x > 1.0 or y < 0.0 or y > 1.0 then - draw = false - else - draw = true - end - end - - if draw then - local dist = #(GetGameplayCamCoords().xy - data.pos.xy) - local fov = (1 / GetGameplayCamFov()) * 100 - local scale = ((1 / dist) * 2) * fov - SetDrawOrigin(data.pos.x, data.pos.y, data.pos.z, 0) - DrawSprite( - data.textureDict, - data.textureName, - (data.x or 0) * scale, - (data.y or 0) * scale, - data.width * scale, - data.height * scale, - data.heading or 0, - data.r or 255, - data.g or 255, - data.b or 255, - data.a or 255 - ) - ClearDrawOrigin() - end - return draw -end - -function Modules.UI.DrawSprite3dNoDownSize(data, dontDrawHowOfScreen) - if dontDrawHowOfScreen == nil then - dontDrawHowOfScreen = false - end - - local draw = false - if dontDrawHowOfScreen == false then - draw = true - else - local get, x,y = GetScreenCoordFromWorldCoord(data.pos.x, data.pos.y, data.pos.z) - if not get or x < 0.0 or x > 1.0 or y < 0.0 or y > 1.0 then - draw = false - else - draw = true - end - end - - if draw then - local scale = 1 - SetDrawOrigin(data.pos.x, data.pos.y, data.pos.z, 0) - DrawSprite( - data.textureDict, - data.textureName, - data.x or (0 * scale), - data.y or (0 * scale), - data.width * scale, - data.height * scale, - data.heading or 0, - data.r or 255, - data.g or 255, - data.b or 255, - data.a or 255 - ) - ClearDrawOrigin() - end - return draw - -end - --- function Modules.UI.ConvertToPixel(x, y) --- return (x * 1920), (y * 1080) --- end - -function Modules.UI.ConvertToPixel(x, y) - return (x / 1920), (y / 1080) -end - -function Modules.UI.ConvertToRes(x, y) - return (x * 1920), (y * 1080) -end \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/player.lua b/resources/EasyDrift/client/module/modules/player.lua deleted file mode 100644 index a7de0a183..000000000 --- a/resources/EasyDrift/client/module/modules/player.lua +++ /dev/null @@ -1,41 +0,0 @@ -Modules.Player = {} -Modules.Player.IsDead = false - - -function Modules.Player.GetPed() - return PlayerPedId() -end - -function Modules.Player.GetDeadStatus() - return Modules.Player.IsDead -end - -function Modules.Player.SetDeadStatus(status) - Modules.Player.IsDead = status -end - -function Modules.Player.GetPos() - return GetEntityCoords(Modules.Player.GetPed()) -end - -function Modules.Player.GetHeading() - return GetEntityHeading(Modules.Player.GetPed()) -end - -function Modules.Player.GetCurrentVehicle() - return GetVehiclePedIsIn(Modules.Player.GetPed(), false) -end - -function Modules.Player.GetLastVehicle() - return GetVehiclePedIsIn(Modules.Player.GetPed(), true) -end - -function Modules.Player.IsPedInAnyVehicle() - if IsPedInAnyVehicle(Modules.Player.GetPed(), false) or IsPedInAnyVehicle(Modules.Player.GetPed(), true) then - return true - end -end - -function Modules.Player.GetHealth() - return GetEntityHealth(Modules.Player.GetPed()) -end \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/ui_native_pages/drift.lua b/resources/EasyDrift/client/module/modules/ui_native_pages/drift.lua deleted file mode 100644 index 42a1e146a..000000000 --- a/resources/EasyDrift/client/module/modules/ui_native_pages/drift.lua +++ /dev/null @@ -1,88 +0,0 @@ -function Modules.UI.DisplayDrift() - if ConfigShared.PositionsCoords[ConfigShared.Position] ~= nil then - local alphaToUse = math.floor(Modules.DriftCounter.GlobalAlpha) - - local baseX = ConfigShared.PositionsCoords[ConfigShared.Position][1] - local baseY = ConfigShared.PositionsCoords[ConfigShared.Position][2] - - local x,y = Modules.UI.ConvertToPixel(360, 76) - Modules.UI.DrawSpriteNew("ui_drift", "plate", baseX, baseY, x,y, 0, 255, 255, 255, alphaToUse, { - NoHover = true, - CustomHoverTexture = false, - NoSelect = true, - devmod = false - }, function(onSelected, onHovered) - - end) - - -- 0.51041668653488, 0.88999997615814 - Modules.UI.DrawTexts(baseX + 0.109375, baseY - 0.00259260892868, tostring(Modules.Utils.Comma_value(Modules.DriftCounter.CurrentPoints)) .." ~c~PTS", true, 0.8, {250, 224, 64, alphaToUse}, Modules.UI.font["forza"], false, false) - - - - -- Condition is a bit hacky, but it's to avoid displaying the bars while drifting on the hud as it make the hud less cool - if Modules.DriftCounter.ChainTimeLeft <= ConfigShared.DriftChainTime - 100 then - local x,y = Modules.UI.ConvertToPixel(279, 2) - -- 0.44010418653488, 0.89259254932404 - Modules.UI.DrawSlider(baseX + 0.0390625, baseY - 0.00000003576278, x, y, {0, 0, 0, 0}, {207, 5, 81, alphaToUse}, Modules.DriftCounter.ChainTimeLeft, ConfigShared.DriftChainTime, { - noHover = true, - direction = 1, - devmod = false, - }, function(onUpdate, newValue) - - end) - - -- 0.44010418653488, 0.96018517017365 - Modules.UI.DrawSlider(baseX + 0.0390625, baseY + 0.06759258508683, x, y, {0, 0, 0, 0}, {207, 5, 81, alphaToUse}, Modules.DriftCounter.ChainTimeLeft, ConfigShared.DriftChainTime, { - noHover = true, - direction = 1, - devmod = false, - }, function(onUpdate, newValue) - - end) - end - - if ConfigShared.DisplayAngle then - local alphaToUseForAngle = 150 - if alphaToUse < alphaToUseForAngle then - alphaToUseForAngle = alphaToUse - end - - local x,y = Modules.UI.ConvertToPixel(180, 13) - local baseYToAdd = 0.08 - Modules.UI.DrawSlider(baseX + x, baseY + baseYToAdd, x, y, {0, 0, 0, alphaToUseForAngle}, {207, 5, 81, alphaToUse}, Modules.DriftCounter.CurrentAngle, ConfigShared.MaxAngle, { - noHover = true, - direction = 1, - devmod = false, - }, function(onUpdate, newValue) - - end) - Modules.UI.DrawSlider(baseX, baseY + baseYToAdd, x, y, {0, 0, 0, alphaToUseForAngle}, {207, 5, 81, alphaToUse}, Modules.DriftCounter.CurrentAngle, ConfigShared.MaxAngle, { - noHover = true, - direction = 2, - devmod = false, - }, function(onUpdate, newValue) - - end) - Modules.UI.DrawTexts(baseX + x, baseY + baseYToAdd - 0.0122, tostring(math.floor(Modules.DriftCounter.CurrentAngle)) .."°", true, 0.4, {250, 224, 64, alphaToUse}, Modules.UI.font["forza"], false, false) - end - else - Modules.Log.Error("Wrong value used in config for ConfigShared.Position. Positon do not exist") - end -end - -Citizen.CreateThread(function() - if ConfigShared.UseDefaultUI then - while true do - if Modules.DriftCounter.IsDrifting or Modules.DriftCounter.ChainLoopStarted or Modules.DriftCounter.InAnimation then - Modules.UI.SetPageActive("hud_drift") - else - Modules.UI.SetPageInactive("hud_drift") - end - if ConfigShared.devmod then - Modules.UI.SetPageActive("hud_drift") - end - Wait(100) - end - end -end) \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/utils.lua b/resources/EasyDrift/client/module/modules/utils.lua deleted file mode 100644 index 9a2d691ad..000000000 --- a/resources/EasyDrift/client/module/modules/utils.lua +++ /dev/null @@ -1,46 +0,0 @@ -Modules.Utils = {} -Modules.Utils.cachedData = {} -Modules.Utils.TimeFrame = 0 - -function Modules.Utils.RealWait(ms, cb) - local timer = GetGameTimer() + ms - local timeLeft = GetGameTimer() - timer - while GetGameTimer() < timer do - timeLeft = GetGameTimer() - timer - if cb ~= nil then - cb(function(stop, setValue) - if stop then - timer = 0 - return - end - - if setValue ~= nil then - timer = GetGameTimer() + setValue - end - end, timeLeft) - end - Wait(0) - end -end - --- Source: http://lua-users.org/wiki/FormattingNumbers -function Modules.Utils.Comma_value(amount) - local formatted = amount - local k - while true do - formatted, k = string.gsub(formatted, "^(-?%d+)(%d%d%d)", '%1,%2') - if (k==0) then - break - end - end - return formatted -end - -local timer = GetGameTimer() -Citizen.CreateThread(function() - while true do - Modules.Utils.TimeFrame = (GetGameTimer() - timer) - timer = GetGameTimer() - Wait(0) - end -end) \ No newline at end of file diff --git a/resources/EasyDrift/client/module/modules/world.lua b/resources/EasyDrift/client/module/modules/world.lua deleted file mode 100644 index 74c686d59..000000000 --- a/resources/EasyDrift/client/module/modules/world.lua +++ /dev/null @@ -1,83 +0,0 @@ -Modules.World = {} - - -function Modules.World.GetDistanceBetweenCoords(coords1, coords2) - local coords1 = vector3(coords1.x, coords1.y, coords1.z) - local coords2 = vector3(coords2.x, coords2.y, coords2.z) - return #(coords1 - coords2) -end - -function Modules.World.GetPlayersServerIdsInZone(size) - local players = {} - - local currentPosition = Modules.Player.GetPosition() - for k,v in pairs(GetActivePlayers()) do - local position = GetEntityCoords(GetPlayerPed(v)) - if Modules.World.GetDistanceBetweenCoords(currentPosition, position) <= size then - table.insert(players, v) - end - end - return players -end - -function Modules.World.LoadModel(modelName) - local model = GetHashKey(modelName) - if IsModelInCdimage(model) then - RequestModel(model) - while not HasModelLoaded(model) do - Wait(0) - end - return model - else - Modules.Log.Error("Model " .. modelName .. " not found") - return false - end -end - -function Modules.World.CreatePed(modelName, position) - local model = Modules.World.LoadModel(modelName) - if model ~= false then - local ped = CreatePed(4, model, position.x, position.y, position.z, position.w, false, false) - SetEntityAsMissionEntity(ped, true, true) - return ped - else - return false - end -end - -function Modules.World.CreateVehicle(modelName, position, networked) - local model = Modules.World.LoadModel(modelName) - if model ~= false then - local vehicle = CreateVehicle(model, position.x, position.y, position.z, position.w, networked, true) - SetEntityAsMissionEntity(vehicle, true, true) - return vehicle - else - return false - end -end - -function Modules.World.CreateVehicleWithPlayerHeading(modelName, position, networked) - local model = Modules.World.LoadModel(modelName) - if model ~= false then - local vehicle = CreateVehicle(model, position.x, position.y, position.z, Modules.Player.GetHealth(), networked, true) - SetEntityAsMissionEntity(vehicle, true, true) - return vehicle - else - return false - end -end - -function Modules.World.DrawText3D(x, y, z, text) - SetTextScale(0.35, 0.35) - SetTextFont(4) - SetTextProportional(1) - SetTextColour(255, 255, 255, 215) - SetTextEntry("STRING") - SetTextCentre(true) - AddTextComponentString(text) - SetDrawOrigin(x,y,z, 0) - DrawText(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) - ClearDrawOrigin() -end \ No newline at end of file diff --git a/resources/EasyDrift/config/config_shared.lua b/resources/EasyDrift/config/config_shared.lua deleted file mode 100644 index b5953800d..000000000 --- a/resources/EasyDrift/config/config_shared.lua +++ /dev/null @@ -1,63 +0,0 @@ -ConfigShared = {} -ConfigShared.devmod = false -- Keep the UI on by default, usefull when tweaking UI -ConfigShared.UseDefaultUI = true -- Set this to false if you want to use your own UI - - -ConfigShared.DriftChainTime = 5000 -- Time in MS -ConfigShared.AddStaticPointOnDrifting = true -- Add a static number of point on every frame when the player is drifting -ConfigShared.StaticPointToAdd = 1 -- This is added every frame, so it will grow very fast - -ConfigShared.AddPointBasedOnAngle = true -- Add an angle based point every frame when the player is drifting. The more angle the player take, the more point he will get - - -ConfigShared.DriftStartEvent = "drift:start" -- Name of the evet triggered when a drift is started, this is a client side event. -ConfigShared.DriftFinishedEvent = "drift:finish" -- Name of the evet triggered when a drift is finished, this is a client side event. The drift score is sent as first arg -ConfigShared.EnableEvent = "drift:enable" -- Enables the drift counter -ConfigShared.DisableEvent = "drift:disable" -- Disables the drift counter -ConfigShared.ToggleEvent = "drift:toggle" -- Toggles the drift counter -ConfigShared.GetCurrentDriftScore = "drift:GetCurrentDriftScore" -- Get the current drift score ... I mean it's in the name ... - --- Example usage --- TriggerEvent("drift:GetCurrentDriftScore", function(score) --- print("My score is: ", score) --- end) - -ConfigShared.IsDrifting = "drift:IsDrifting" -- Return true or false if the player is drifting or not - --- Example usage --- TriggerEvent("drift:IsDrifting", function(isDrifting) --- print("Am i drifitng?", isDrifting) --- end) - - -ConfigShared.IsEnabled = "drift:IsEnabled" -- Checks if the counter is enabled - --- Example usage --- TriggerEvent("drift:IsEnabled", function(isEnabled) --- print("Is the counter enabled?", isEnabled) --- end) - -ConfigShared.UseVehicleWhitelist = false -- Allow only listed vehicule to use the drift counter -ConfigShared.WhitelistedVehicules = { - [GetHashKey("180sx")] = true, -- This is an exemple, add more lines and replace '180sx' with the model name you want to add. the '= true' means nothing, it's just here because with this syntaxe, a value is needed. Also yes, i could use `` instead of GetHashKey but my IDE don't like it and the it doesn't impact performance in this use case. Please don't make a PR to change that - [GetHashKey("gtr")] = true, - [GetHashKey("futo")] = true, -} - - --- Possible positions: --- 1 = bottom of the screen in the middle --- 2 = top of the screen in the middle -ConfigShared.Position = 1 - --- Do not touch this if you don't know what you are doing. --- This allow you to add custom position, first value is pos X of the screen, second in pos Y of the screen. --- min value is 0, max value is 1 -ConfigShared.PositionsCoords = { - [1] = {0.40104168653488, 0.89259258508682}, - [2] = {0.40104168653488, 0.05259258508682}, -} - - -ConfigShared.DisplayAngle = true -ConfigShared.MaxAngle = 50 \ No newline at end of file diff --git a/resources/EasyDrift/fxmanifest.lua b/resources/EasyDrift/fxmanifest.lua deleted file mode 100644 index 349d602f1..000000000 --- a/resources/EasyDrift/fxmanifest.lua +++ /dev/null @@ -1,18 +0,0 @@ -fx_version 'adamant' - -game 'gta5' - - -shared_scripts { - "config/*.lua", -} - -client_scripts { - "client/module/handler/module_handler.lua", - "client/module/modules/*.lua", - "client/module/modules/ui_native_pages/*.lua", -} - --- server_scripts { --- "server/modules/*.lua", --- } \ No newline at end of file diff --git a/resources/EasyDrift/stream/assets/fonts/forza.gfx b/resources/EasyDrift/stream/assets/fonts/forza.gfx deleted file mode 100644 index a422d4623..000000000 Binary files a/resources/EasyDrift/stream/assets/fonts/forza.gfx and /dev/null differ diff --git a/resources/EasyDrift/stream/ui_drift.ytd b/resources/EasyDrift/stream/ui_drift.ytd deleted file mode 100644 index a67aaa53c..000000000 --- a/resources/EasyDrift/stream/ui_drift.ytd +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:5d6d251220bd363601be0a703342d986987fcad993fd1918d29bdc1383d9ef6f -size 992 diff --git a/resources/LegacyFuel/config.lua b/resources/LegacyFuel/config.lua index 8ca032298..2a34c6be7 100644 --- a/resources/LegacyFuel/config.lua +++ b/resources/LegacyFuel/config.lua @@ -17,32 +17,32 @@ Config.FuelDecor = "_FUEL_LEVEL" Config.DisableKeys = {0, 22, 23, 24, 29, 30, 31, 37, 44, 56, 82, 140, 166, 167, 168, 170, 288, 289, 311, 323} -- Want to use the HUD? Turn this to true. -Config.EnableHUD = true +Config.EnableHUD = false -- Configure blips here. Turn both to false to disable blips all together. -Config.ShowNearestGasStationOnly = true -Config.ShowAllGasStations = false +Config.ShowNearestGasStationOnly = false +Config.ShowAllGasStations = true -- Modify the fuel-cost here, using a multiplier value. Setting the value to 2.0 would cause a doubled increase. Config.CostMultiplier = 1.0 Config.Strings = { ExitVehicle = "Exit the vehicle to refuel", - EToRefuel = "Press ~g~E ~w~to refuel vehicle", + EToRefuel = "Press ~r~E ~w~to refuel vehicle", JerryCanEmpty = "Jerry can is empty", FullTank = "Tank is full", - PurchaseJerryCan = "You purchased a jerry can for ~g~$" .. Config.JerryCanCost, - CancelFuelingPump = "Press ~g~E ~w~to cancel the fueling", - CancelFuelingJerryCan = "Press ~g~E ~w~to cancel the fueling", + PurchaseJerryCan = "You picked up a jerry can", + CancelFuelingPump = "Press ~r~E ~w~to cancel the fueling", + CancelFuelingJerryCan = "Press ~r~E ~w~to cancel the fueling", NotEnoughCash = "~r~Not enough cash", RefillJerryCan = "You refilled the jerry can for ", NotEnoughCashJerryCan = "~r~Not enough cash to refill jerry can", - JerryCanFull = "~g~Jerry can is full", + JerryCanFull = "~r~Jerry can is full", TotalCost = "Cost", } if not Config.UseESX then - Config.Strings.PurchaseJerryCan = "You purchased a jerry can" + Config.Strings.PurchaseJerryCan = "You picked up a jerry can" Config.Strings.RefillJerryCan = "You refilled the jerry can" end diff --git a/resources/LegacyFuel/source/fuel_client.lua b/resources/LegacyFuel/source/fuel_client.lua index 17ec8f9ce..e9f53fa9c 100644 --- a/resources/LegacyFuel/source/fuel_client.lua +++ b/resources/LegacyFuel/source/fuel_client.lua @@ -313,3 +313,35 @@ if Config.EnableHUD then end end) end + +local barHeight = 0.010 -- Height of Bar Variable +local barWidth = 0.140 -- Width of Bar Variable +local barPos = { x = 0.0855, y = 0.812 } -- Position On Screen (Above Mini Map) + +-- NOTE -- As you change the HEIGHT or WIDTH you may also need to change the POSITION. +-- NOTE -- WIDTH and HEIGHT should be divisible by TWO to make it easier for POSITION. + +Citizen.CreateThread(function() + while true do Citizen.Wait(0) + + local playerPed = PlayerPedId() -- The Player + local vehicle = GetVehiclePedIsIn(playerPed) -- Is The Player in a vehicle? + local driver = GetPedInVehicleSeat(vehicle, -1) -- Is The Player in the Driver Seat? + local dead = IsPedDeadOrDying(playerPed, true) -- Is The Player dead or dying? + local class = GetVehicleClass(vehicle) -- What class of vehicle? Ignore bikes. + + if (vehicle ~= 0) and (class ~= 13) then + -- If IN a vehicle, and NOT a bike then + if driver and not dead then + -- If The Player is in the Driver Seat and IS NOT dead + local currentFuel = GetVehicleFuelLevel(vehicle) -- Current Fuel In Vehicle + local fuelWidth = (barWidth * currentFuel) / 100 -- Fuel Value x Max Bar Width Show The Level Range Within The Bar + + DrawRect(barPos.x, barPos.y, barWidth, barHeight, 40, 40, 40, 150) -- Bar Background (Black) + DrawRect(barPos.x - (barWidth - fuelWidth) / 2, barPos.y, fuelWidth, barHeight, 200, 46, 46, 150) -- Current Fuel (Red) + else + Wait(500) -- Wait and don't crash + end + end + end +end) \ No newline at end of file diff --git a/resources/refuelingnozzle/settings.ini b/resources/refuelingnozzle/settings.ini index 1268fe5e3..3d46df958 100644 --- a/resources/refuelingnozzle/settings.ini +++ b/resources/refuelingnozzle/settings.ini @@ -4,8 +4,8 @@ InteractionKey 38 //Second Interaction Key Use For Handling Actions (G) InteractionKey2 47 //Jerry Can Stuff -JerryCanCost 100 -JerryCanRefillCost 50 +JerryCanCost 0 +JerryCanRefillCost 0 UnarmPedWhenHoldingNozzle true WaitTimeAfterRefuel 500 //If the player can use the fuel nozzle to drop fuel on groun @@ -18,8 +18,8 @@ DropNozzle Press ~r~E~w~ To Drop The Nozzle MountFuelPump [~g~E~w~] Mount Fuel Pump PlaceFuelPump [~r~E~w~] Place Fuel Pump PickupFuelPump [~g~E~w~] Pickup Fuel Pump -PurchaseJerryCan [~r~G~w~] Purchase Jerry Can For -RefillJerryCan [~g~G~w~] Refill Jery Can For +PurchaseJerryCan [~r~G~w~] Pickup Jerry Can +RefillJerryCan [~g~G~w~] Refill Jerry Can UseJerryCan [~g~E~w~] Use Jerry Can JerryCanEmpty ~w~Jerry Can Empty VehicleTankFull ~g~Tank Full diff --git a/server.cfg b/server.cfg index 1b9264f85..5d0b8a447 100644 --- a/server.cfg +++ b/server.cfg @@ -158,7 +158,6 @@ start Speed-Warning start Laptop-UI start carsounds start carsounds4 -start EasyDrift start rcore_pool start asedrussounds start LegacyFuel