-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Mini Map Issues #11
Open
robert4049
wants to merge
233
commits into
nojdh:main
Choose a base branch
from
Xxpromw3mtxX:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In the previous version there were three threads one running every 1000 ticks, one every tick and the other one running every 100 ticks. I've moved the loading of the minimap to the resource start. Since the removal of every component of the old map works good even every 1000 ticks, I've moved that section to when the player is in a vehicle. We've gone from 0.04/5ms to 0.01/2ms in idle. That's big performance achievement.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
ESX = nil
local beltStatus = false
local hunger, thirst, stress = 0, 0, 0
local minimap minimap = RequestScaleformMovie("minimap")
local PlayerLoaded = false
Citizen.CreateThread(function()
while ESX == nil do
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
Citizen.Wait(100)
end
end)
RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
print("ESX Player Loaded Called")
if xPlayer ~= nil then
PlayerLoaded = true
end
end)
-- Principal Event
AddEventHandler('esx_status:onTick', function(data)
local playerPed = PlayerPedId()
end)
-- Principal Loop
Citizen.CreateThread(function()
while PlayerLoaded == false do Citizen.Wait(10) end -- Wait for ESX:PlayerLoaded before showing minimap & NUI
while true do
Citizen.Wait(shared.ticktime)
local pedID = PlayerPedId()
local pHealth = (GetEntityHealth(pedID) - 100)
local pArmour = GetPedArmour(pedID)
end)
-- SpeedO configs
Citizen.CreateThread(function()
while PlayerLoaded == false do Citizen.Wait(10) end -- Wait for ESX:PlayerLoaded before showing minimap & NUI
while true do
Citizen.Wait(100)
local pedID = PlayerPedId()
end)
-- Minimap swap
function swapMinimap()
local posX, posY, width, height = -0.015, -0.015, 0.16, 0.25
end
-- Microphone
AddEventHandler('pma-voice:setTalkingMode', function(newTalkingRange)
SendNUIMessage({
action = "voice_level",
voicelevel = newTalkingRange
})
end)
-- Seatbelt events
RegisterNetEvent("cosmo_hud:isSeatbeltOn")
AddEventHandler("cosmo_hud:isSeatbeltOn", function(isOn)
beltStatus = isOn
SendNUIMessage({
isBeltOn = beltStatus
})
end)
if shared.showstress then
-- Stress function that makes you close your eyes when stress is too high
function forRepeat()
Citizen.Wait(750)
DoScreenFadeOut(200)
Citizen.Wait(shared.ticktime)
DoScreenFadeIn(200)
end
end
-- Refresh ui client
RegisterCommand("ui:restart", function()
if shared.npwd then
ExecuteCommand("phone:restart")
end
end, false)