Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Returns a table with the following syntax:
- -- t = getpostable()
- -- t[player] = position
- function getpostable()
- local pos = {}
- local temp = {}
- for player,_ in pairs(scores) do
- local m_player = getplayer(player)
- if m_player then
- local t = {}
- t.player = player
- t.score = scores[player]
- t.kills = readword(m_player, 0x9C)
- t.deaths = readword(m_player, 0xAE)
- t.assists = readword(m_player, 0xA4)
- table.insert(temp, t)
- end
- end
- table.sort(temp,
- function(a,b)
- if a.score == b.score then
- if a.kills == b.kills then
- if a.deaths == b.deaths then
- if a.assists == b.assists then
- return a.player > b.player
- else
- return a.assists > b.assists
- end
- else
- return a.deaths < b.deaths
- end
- else
- return a.kills > b.kills
- end
- else
- return a.score > b.score
- end
- end)
- local place = 0
- local actual_place = 0
- for k,v in ipairs(temp) do
- if temp[k - 1] then
- if temp[k - 1].score ~= temp[k].score or temp[k - 1].kills ~= temp[k].kills or temp[k - 1].deaths ~= temp[k].deaths or temp[k - 1].assists ~= temp[k].assists then
- place = actual_place + 1
- end
- else
- place = 1
- end
- actual_place = actual_place + 1
- pos[temp[k].player] = place
- end
- return pos
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement