-- Returns the 'cid' of the highest level online player.
function getHighestLevelOnlinePlayer()
local highest = {
level = 0,
player = 0
}
for _, name in ipairs(getOnlinePlayers()) do -- Loop through all online players
local cid = getPlayerByName(name)
if isPlayer(cid) then
if getPlayerLevel(cid) > highest.level then
highest.level = getPlayerLevel(cid)
highest.player = cid
end
end
end
print("Highest level online player was: " ...