Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print 'Admin Console 1.0 Loaded'
- --[[
- Hio. Make sure you have the latest and greatest version of this tool. Get it at http://ironnoob.com/forums/index.php/board,26.0.html
- - John Shedletsky
- ]]--
- -- Install Gui
- local copy = script.JohnsConsoleGui:Clone()
- --copy.Archivable = false
- copy.Parent = game.StarterGui
- local lastPing = {} -- {player, ms}
- function split(str, delimiter)
- local result = { }
- local from = 1
- local delim_from, delim_to = string.find( str, delimiter, from )
- while delim_from do
- table.insert( result, string.sub( str, from , delim_from-1 ) )
- from = delim_to + 1
- delim_from, delim_to = string.find( str, delimiter, from )
- end
- table.insert( result, string.sub( str, from ) )
- return result
- end
- function getAvgPing()
- local p = game.Players:GetPlayers()
- local total = 0
- for i=1,#p do
- if lastPing[p[i].Name] ~= nil then
- total = total + lastPing[p[i].Name]
- end
- end
- if #p == 0 then return 0 end
- return total / #p
- end
- function incomingMessage(msg)
- if string.sub(msg.Name, 1, 4) == "ping" then
- print("SERV MSG: " .. msg.Value)
- local args = split(msg.Value, ",")
- print("player: " .. args[1] .. "ping: " .. args[2])
- lastPing[args[1]] = args[2]
- local result = getAvgPing()
- print("avg ping: " .. result)
- msg.Value = "." .. result
- end
- end
- script.ChildAdded:connect(incomingMessage)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement