Jump to content

[HELP] Largest Player Money


xXGhostXx

Recommended Posts

4 minutes ago, Ceeser said:

Please expain a bit more:

Are you using a db?
Are you using accountData?
Are you using elementData?
Do you wanna use something else?

Does not count, because i want know.

for example i use elementData.

Please answer me.

Link to post

That actually makes a difference.. Well for elementData you could do that:

 

funciton getRichestPlayer()
	local tblPlayersMoney = {};

	for _, player in pairs(getElementsByType("player")) do
  		table.insert(tblPlayerMoney, {player = getPlayerName(player), money = getElementData(player, "money")});
  	end

	table.sort(tblPlayersMoney, function (a, b) return a.money > b.money end);

	for i, v in pairs(tblPlayersMoney) do
  		outputChatbox("Place " .. i .. " is " .. v.player .. " with " .. v.money .. "$", 255, 255, 255, true);
  	end
end

 

Link to post

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...