Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- r2 = {}
- mice = {}
- rank = false
- function r2:rank(name)
- scores = {}
- rank = true
- txt="Name\t\t - \t\tScore\n\n"
- table.foreach(mice, function(k, v) table.insert(scores,{name=k,score=v.score}) end)
- table.sort(scores, function(a, b) return a.score>b.score end)
- table.foreachi(scores, function(k, v) txt = txt..""..k..") "..v.name.."\t\t - \t\t"..v.score.."\n" end)
- ui.addTextArea(0, txt, name, 100, 50, 400, 200, 0x191919, 0x191919, 0.6, true)
- end
- _G["eventNewPlayer"]=function(name)
- mice[name] = {
- score = 0,
- rank = r2.rank
- }
- end
- function eventPlayerWon(name)
- mice[name].score = mice[name].score + 1
- end
- function eventChatCommand(name, command)
- if command:lower() == "rank" and not rank then
- mice[name].rank(name)
- else
- ui.removeTextArea(0, name)
- rank = false
- end
- end
- table.foreach(tfm.get.room.playerList,_G["eventNewPlayer"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement