Jump to content

Get account if money => 500000


Miika

Recommended Posts

Hi!

Anyone have ideas, how to count accounts with more than 500k money?

This says all accounts, but, i want it to display only if you have more than 500k money

function printAmountOfAccounts ( thePlayer ) 
    local accountTable = getAccounts () 
    if #accountTable == 0 then 
         outputChatBox( "There are no accounts.", thePlayer ) 
    else 
        outputChatBox( "There are " .. #accountTable .. " accounts in this server!", thePlayer, 0, 255, 0 ) 
    end 
end 
addCommandHandler( "accountcount", printAmountOfAccounts )  

Link to comment
function printAmountOfAccounts ( thePlayer ) 
    local accountTable = getAccounts () 
    if #accountTable > 0 then 
        local n = 0 
        for _, account in pairs ( accountTable ) do 
            local money = getAccountData ( account, "nordea-cash" ); 
            if ( money >= 500000 ) then 
                n = n + 1; 
            end 
        end 
        outputChatBox ( "There is " .. n .. " accounts with >= 500000 money.", thePlayer ); 
    end 
end 
addCommandHandler( "accountcount", printAmountOfAccounts ) 

Link to comment
function printAmountOfAccounts ( thePlayer ) 
    local accountTable = getAccounts () 
    if #accountTable > 0 then 
        local n = 0 
        for _, account in pairs ( accountTable ) do 
            local money = getAccountData ( account, "nordea-cash" ); 
            if ( money >= 500000 ) then 
                n = n + 1; 
            end 
        end 
        outputChatBox ( "There is " .. n .. " accounts with >= 500000 money.", thePlayer ); 
    end 
end 
addCommandHandler( "accountcount", printAmountOfAccounts ) 

Thanks dude! Your script works good!

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