1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
addhook("die","topscore")
addhook("flagcapture","topscore")
addhook("bombexplode","topscore")
addhook("bombdefuse","topscore")
addhook("endround","topscore")
addhook("parse","topscore")
addhook("rcon","topscore")
addhook("hostagerescue","topscore")
addhook("join","topscore")
addhook("leave","topscore")
function topscore()
	local scores={}
	for _,id in pairs(player(0,"table")) do
		table.insert(scores,{id,player(id,"score")})
	end
	table.sort(scores,function(a,b) return a[2]>b[2] end)
	parse('hudtxt 1 "Top scores:" 16 240')
	for i=1,#scores do
		if i<=3 then
			parse('hudtxt '..i+1 ..' "'..i..'. '..player(scores[i][1],"name")..' ('..scores[i][2]..')" 16 '..(256+16*(i-1)))
		end
	end
end