Jump to content

Tabela Rank


Recommended Posts

Opa, gostaria de saber como faço para que quando o rank for chamado ele organize  em ordem por Kills. Tipo 1,2,3 e etc...
function recebeKills ()
	local data = getAccounts ()
	local accTable = {}
	local killsTable = {}
	local deathsTable = {}
	local killDeath = {}
	local kill = 0
	local death = 0
	if not data[1] then
		triggerClientEvent (client, "showScores", client)
		return
	end
	for i, acc in ipairs (data) do
		table.insert (accTable, getAccountName (data[i]))
		if not getAccountData (data[i], "kills") then
			table.insert (killsTable, "0")
			kill = 0
		else
			table.insert (killsTable, tostring (getAccountData (data[i], "kills")))
			kill = tonumber (getAccountData (data[i], "kills"))
		end
		if not getAccountData (data[i], "deaths") then
			table.insert (deathsTable, "0")
			death = 0
		else
			table.insert (deathsTable, tostring (getAccountData (data[i], "deaths")))
			death = tonumber (getAccountData (data[i], "deaths"))
		end
		if death == 0 and kill == 0 then
			table.insert (killDeath, 0)
		else
			table.insert (killDeath, kill / death)
		end
	end
	triggerClientEvent (client, "showRank", client, accTable, killsTable, deathsTable, killDeath)
end
addEvent ("getRank", true)
addEventHandler ("getRank", getRootElement(), recebeKills)

 

Edited by Lipee Lima
Link to comment
  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...