KOLISAO
Member
- Joined
- Apr 26, 2019
- Messages
- 8
- Reaction score
- 7
When I show Ping in OTClient, it looks like this. Hosted at my home.
In code, decreasing to refresh in less time, nothing is changed.
Lua:
local stime = 4
local time = os.clock()
function updatePing(ping)
local text = 'Ping: '
local color
local ping = math.ceil(ping/2)
if (time + stime) <= os.clock() then
time = os.clock()
if ping < 0 then
text = text .. "??"
color = 'yellow'
else
text = text .. ping .. ' ms'
if ping >= 290 then
color = 'red'
elseif ping >= 150 then
color = 'yellow'
else
color = 'green'
end
end
pingLabel:setColor(color)
pingLabel:setText(text)
end
end