Miika Posted April 8, 2015 Posted April 8, 2015 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 ) Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Miika Posted April 8, 2015 Author Posted April 8, 2015 Did you save money to accountData somehow? setAccountData(account , "nordea-cash", amount) Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
WhoAmI Posted April 8, 2015 Posted April 8, 2015 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 )
Miika Posted April 8, 2015 Author Posted April 8, 2015 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! Real motorbike backflip / frontflip script: https://forum.mtasa.com/viewtopic.php?f=108&t=98191
Et-win Posted April 8, 2015 Posted April 8, 2015 There are* ~Scripts~ Clan War System V1.2.0 ~Maps~ [DM]Et-win - The Run [FUN]Et-win - Drift Rocket [FUN]Et-win - Drift Rocket // [DD]Et-win - Cross 3xC
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now