Jump to content

How do I stop this lag?


Recommended Posts

I have this script, it works but when I use it, it lags the player massively. As it is using onClientRender. Here it is

  
localPlayer = getLocalPlayer() 
health=0 
sTime=0 
ping=0 
hours=0 
minutes=0 
  
  
function GetCurrentPlayerDateAndTime() 
    local tTime = getRealTime() 
    return string.format("%02d:%02d", tTime.hour, tTime.minute) 
end 
  
function getInfo() 
    ping = getPlayerPing(getLocalPlayer()) 
     
    sTime = GetCurrentPlayerDateAndTime() 
     
    health = getElementHealth(localPlayer) 
end 
--addEventHandler ( "onClientRender", root, getInfo) 
  
  
function loadTheBox() 
    background = guiCreateStaticImage(1174, 0, 186, 123, "Blackbox.png", false) 
    guiSetAlpha(background, 30) 
end 
--addEventHandler('onClientResourceStart', resourceRoot, loadTheBox) 
  
function bInfo() 
    localtime = guiCreateLabel(10, 1, 148, 15, "Local Time: " ..sTime.. "", false, background) 
    igtime = guiCreateLabel(11, 26, 148, 15, "In-Game Time: " ..string.format("%02d:%02d", getTime()).. "", false, background) 
    lagblud = guiCreateLabel(11, 51, 148, 15, "Ping: " ..ping.. "", false, background) 
    hp = guiCreateLabel(11, 76, 148, 15, "Health: " ..string.gsub(health,"%.%d*","").."%" , false, background) 
end 
--addEventHandler ( "onClientRender", root, bInfo) 
  

Link to comment

OK, I have but it in one label and it still lags, I will try dxDrawText

writelines = guiCreateLabel(13, 11, 163, 102, "Local Time: " ..sTime.. "\n\nIn-Game Time: " ..string.format("%02d:%02d", getTime()).. "\n\nPing: " ..ping.. "\n\nHealth: " ..string.gsub(health,"%.%d*","").."%", false, background) 

Edit: Thanks dxDrawText works, but it is not in same place for all resoultions

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...