goodiewarrior Posted July 14, 2016 Posted July 14, 2016 Ok, so online time is stored like this: local user_time = getAccountData(account, "on_time") Now if I want to make a GUI with the most 3 online users in the server, how can I do that?
goodiewarrior Posted July 17, 2016 Author Posted July 17, 2016 and then how to order the values from getAccountData(v) from higher to lower...
Walid Posted July 17, 2016 Posted July 17, 2016 and then how to order the values from getAccountData(v) from higher to lower... All what you need is: table.insert() table.sort()
Captain Cody Posted July 17, 2016 Posted July 17, 2016 table = {} for i,v in pairs (getAccounts()) do local time = getAccountData(v, "on_time") table.insert(table,{v,time}) end table.sort(table) local 1= table[1] local 2= table[2] local 3= table[3] local first = getAccountName(1[1]) local secound= getAccountName(2[1]) local third= getAccountName(3[1]) Not tested, and could be put together better, but quick example.
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