DanielEscadas / conde-b1g_inventory

GNU General Public License v3.0
27 stars 23 forks source link

Need performance improved since fivem limit client tick #18

Open luthanirgi opened 4 years ago

luthanirgi commented 4 years ago
Citizen.CreateThread(function()
    while ESX == nil do
        Citizen.Wait(10)
    end
    while true do
        Citizen.Wait(7)
        if not IsPlayerDead(PlayerId()) then
            DisableControlAction(0, 37, true)
            if IsDisabledControlJustPressed(1, Config.OpenControl) and GetLastInputMethod(0) then
               -- if IsInputDisabled(0) then
                    openInventory()
               --[[  if not HasAnimDictLoaded('amb@prop_human_parking_meter@male@base') then
                        while (not HasAnimDictLoaded('amb@prop_human_parking_meter@male@base')) do
                            RequestAnimDict('amb@prop_human_parking_meter@male@base')
                            Citizen.Wait(10)
                        end
                    end
                    while isInInventory do
                        if canPlayAnim then
                            TaskPlayAnim(PlayerPedId(),'amb@prop_human_parking_meter@male@base', 'base', 1.0, 1.0, -1, 48, 0.0, 0, 0, 0)
                            Citizen.Wait(2000)
                        end
                        Citizen.Wait(10)
                    end --]]
            --    end
            elseif  IsDisabledControlJustReleased(1,  Keys["1"]) and canFire then
                if fastWeapons[1] ~= nil then
                    TriggerServerEvent("esx:useItem", fastWeapons[1])
                end
            elseif IsDisabledControlJustReleased(1, Keys["2"]) and canFire then
                if fastWeapons[2] ~= nil then
                    TriggerServerEvent("esx:useItem", fastWeapons[2])
                end
            elseif IsDisabledControlJustReleased(1, Keys["3"]) and canFire then
                if fastWeapons[3] ~= nil then
                    TriggerServerEvent("esx:useItem", fastWeapons[3])
                end
            elseif IsDisabledControlJustReleased(1, Keys["4"]) and canFire then
                if fastWeapons[4] ~= nil then
                    TriggerServerEvent("esx:useItem", fastWeapons[4])
                end
            elseif IsDisabledControlJustReleased(1, Keys["5"]) and canFire then
                if fastWeapons[5] ~= nil then
                    TriggerServerEvent("esx:useItem", fastWeapons[5])
                end
            elseif IsDisabledControlJustReleased(1, Keys ["LEFTALT"]) then
                showHotbar()
            end
        else
            Citizen.Wait(1000)
        end
    end
end)
Syltann commented 4 years ago

So why exactly did you post a copy of a piece of code from this resource?

luthanirgi commented 4 years ago

So why exactly did you post a copy of a piece of code from this resource?

i mean this line need performance...

bdxndev commented 3 years ago

Do you still need help?

luthanirgi commented 3 years ago

Do you still need help?

yup for sure

RockySouthpaw commented 3 years ago

Well its a thread so... all you would need to do is add waits where needed.