• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua Broadcast request

sick

Member
Joined
Feb 5, 2009
Messages
258
Reaction score
6
Location
Lithuania, Vilnius
I was wondering if someone could make script that broadcasts top 5 fraggers online at that moment ( I mean it tells the frags you made from your log in ). So for example I have total 355 frags at the moment, and i made 15 frags from my log in so the broadcaster will show my name and those 15 frags every 10 mins.

Broadcast example:
1. Name 15 frags
2. Name2 12 frags
3. And so on...

Anyone has ides how to do it? :huh:
 
Lua:
local config = {
	limit = 5
}
function onThink(interval, lastExecution)
	local t, ret, tmp = {}, "Top " .. math.min(config.limit, getWorldCreatures(0)) .. " fraggers online:"
	for _, cid in ipairs(getPlayersOnline()) do
		tmp = db.getResult("SELECT COUNT(*) as count FROM killers WHERE death_id IN (SELECT kill_id FROM player_killers) AND " .. getPlayerGUID(cid) .. " IN (SELECT player_id FROM player_killers WHERE kill_id = death_id)")
		table.insert(t, {cid, tmp:getDataInt("count")})
		tmp:free()
	end
	table.sort(t, function(a,b) return a[2] > b[2] end)
	for i = 1, math.min(#t, config.limit) do
		ret = ret .. "\n" .. i .. ". " .. getPlayerName(t[i][1]) .. " - " .. t[i][2] .. " frags"
	end
	return doBroadcastMessage(ret)
end
 
Back
Top