Jump to content

help


Recommended Posts

Hi there, i have this script ..

  
function top(playerSource, cmd, toptype) 
    if toptype == "cash" then 
    local moneyB = {} 
        outputChatBox("Top 5 of rich players:",getRootElement(),255,120,0) 
        for i,v in ipairs(getElementsByType('player')) do 
            if i > 0 and i <= 5 then  
                local serial = getPlayerSerial(v) 
                local Money = executeSQLSelect ( "MoneyB", "Money","serial = '" .. serial .. "'") 
                Money = Money[1]["Money"] 
                outputChatBox("- "..i..": "..string.gsub(getPlayerName(v),"#%x%x%x%x%x%x","").." have $"..Money,getRootElement(),255,255,0) 
            end 
        end 
         
    end 
end 
addCommandHandler("top",top) 
  

it outputs on chat 5 players with their names and money amounts.

i want it to be arranged from the bigger player's money to the lower player's money, how can i do that?

Example:

- 1 : Player1 have $5000

- 2 : Player2 have $3500

- 3 : Player3 have $2000

- 4 : Player4 have $1500

- 5 : Player5 have $500

not

- 1 : Player1 have $3500

- 2 : Player2 have $5000

- 3 : Player3 have $1500

- 4 : Player4 have $2000

- 5 : Player5 have $500

Link to comment

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