#Horus Posted September 22, 2018 Share Posted September 22, 2018 Boa tarde, alguem sabe o nome desse mod? usam ele em todos os servidores praticamente. LINK DA IMAGEM DELE ABAIXO: https://imgur.com/a/fXq0oRK Link to comment
Jonas^ Posted September 22, 2018 Share Posted September 22, 2018 10 minutes ago, #Horus said: Boa tarde, alguem sabe o nome desse mod? usam ele em todos os servidores praticamente. LINK DA IMAGEM DELE ABAIXO: https://imgur.com/a/fXq0oRK Não consegui acessar o link da imagem, poste neste site: prnt.sc Link to comment
Tommy. Posted September 23, 2018 Share Posted September 23, 2018 Opa, fiz aqui pra você (: client-side: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) serverName = "Nome do Servidor" addEventHandler("onClientRender", root, function() local time = getRealTime() local day = time.monthday local month = time.month local year = time.year + 1900 dxDrawText(serverName.."\1-\1FPS: "..getElementData(getLocalPlayer(), "fps").."\n"..day.."/"..month.."/"..year.."\1-\1"..getTimeS(), x*1190, y*723, x*1360, y*757, tocolor(255, 254, 254, 150), x*1.00, "clear", "right", "center", false, false, false, true, false) end ) function getTimeS() local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second if (hours >= 0 and hours < 10) then hours = "0"..time.hour end if (minutes >= 0 and minutes < 10) then minutes = "0"..time.minute end if (seconds >= 0 and seconds < 10) then seconds = "0"..time.second end return hours..":"..minutes..":"..seconds end local fps = false function getCurrentFPS() -- Setup the useful function return fps end local function updateFPS(msSinceLastFrame) -- FPS are the frames per second, so count the frames rendered per milisecond using frame delta time and then convert that to frames per second. fps = (1 / msSinceLastFrame) * 1000 end addEventHandler("onClientPreRender", root, updateFPS) local function getAverageFPSOfFPSArray(table) -- Average FPS = (FPS1 + FPS2 + ... + FPSX) / X local totalFPS = 0 for _, fps in pairs(table) do totalFPS = totalFPS + fps end return totalFPS / #table end local currentSecondFPS = {} local lastSecondTicks = getTickCount() local lastFiveSecondsFPS = {} local function smoothFPS() -- Do we have a FPS rate already? if not getCurrentFPS() then return end -- Insert current FPS into a table for reference table.insert(currentSecondFPS, getCurrentFPS()) -- If a second passed, get the average FPS using the table -- (We always have at least one frame rendered, so dividing by 0 it's not a problem) if getTickCount() - lastSecondTicks >= 1000 then local averageFPSPerSecond = getAverageFPSOfFPSArray(currentSecondFPS) -- Reset variables currentSecondFPS = {} lastSecondTicks = getTickCount() -- Update the table containing last five seconds FPS -- Also update the FPS limit accordingly table.insert(lastFiveSecondsFPS, averageFPSPerSecond) -- Silently discard too old average FPS if #lastFiveSecondsFPS == 6 then table.remove(lastFiveSecondsFPS, 1) end -- Get the average FPS of the average FPS of each of the last five seconds, and use the result as the frame limit setElementData(localPlayer, "fps", (math.ceil(getAverageFPSOfFPSArray(lastFiveSecondsFPS)))); -- Sets elementData "fps" end end addEventHandler("onClientHUDRender", root, smoothFPS) Link to comment
#Horus Posted September 24, 2018 Author Share Posted September 24, 2018 18 hours ago, Tommy. said: Opa, fiz aqui pra você client-side: local screenW,screenH = guiGetScreenSize() local resW, resH = 1366,768 local x, y = (screenW/resW), (screenH/resH) serverName = "Nome do Servidor" addEventHandler("onClientRender", root, function() local time = getRealTime() local day = time.monthday local month = time.month local year = time.year + 1900 dxDrawText(serverName.."\1-\1FPS: "..getElementData(getLocalPlayer(), "fps").."\n"..day.."/"..month.."/"..year.."\1-\1"..getTimeS(), x*1190, y*723, x*1360, y*757, tocolor(255, 254, 254, 150), x*1.00, "clear", "right", "center", false, false, false, true, false) end ) function getTimeS() local time = getRealTime() local hours = time.hour local minutes = time.minute local seconds = time.second if (hours >= 0 and hours < 10) then hours = "0"..time.hour end if (minutes >= 0 and minutes < 10) then minutes = "0"..time.minute end if (seconds >= 0 and seconds < 10) then seconds = "0"..time.second end return hours..":"..minutes..":"..seconds end local fps = false function getCurrentFPS() -- Setup the useful function return fps end local function updateFPS(msSinceLastFrame) -- FPS are the frames per second, so count the frames rendered per milisecond using frame delta time and then convert that to frames per second. fps = (1 / msSinceLastFrame) * 1000 end addEventHandler("onClientPreRender", root, updateFPS) local function getAverageFPSOfFPSArray(table) -- Average FPS = (FPS1 + FPS2 + ... + FPSX) / X local totalFPS = 0 for _, fps in pairs(table) do totalFPS = totalFPS + fps end return totalFPS / #table end local currentSecondFPS = {} local lastSecondTicks = getTickCount() local lastFiveSecondsFPS = {} local function smoothFPS() -- Do we have a FPS rate already? if not getCurrentFPS() then return end -- Insert current FPS into a table for reference table.insert(currentSecondFPS, getCurrentFPS()) -- If a second passed, get the average FPS using the table -- (We always have at least one frame rendered, so dividing by 0 it's not a problem) if getTickCount() - lastSecondTicks >= 1000 then local averageFPSPerSecond = getAverageFPSOfFPSArray(currentSecondFPS) -- Reset variables currentSecondFPS = {} lastSecondTicks = getTickCount() -- Update the table containing last five seconds FPS -- Also update the FPS limit accordingly table.insert(lastFiveSecondsFPS, averageFPSPerSecond) -- Silently discard too old average FPS if #lastFiveSecondsFPS == 6 then table.remove(lastFiveSecondsFPS, 1) end -- Get the average FPS of the average FPS of each of the last five seconds, and use the result as the frame limit setElementData(localPlayer, "fps", (math.ceil(getAverageFPSOfFPSArray(lastFiveSecondsFPS)))); -- Sets elementData "fps" end end addEventHandler("onClientHUDRender", root, smoothFPS) Obrigado amigo Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now