Jump to content

How to make a TOP online time like this


Recommended Posts

Posted

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?

Posted
and then how to order the values from getAccountData(v) from higher to lower...

All what you need is:

table.insert() 
table.sort() 

Do not yield your back to your enemy, might feel something strange in your ass.

Two things are infinite the universe and human stupidity and i'm not sure about the universe.

UF: IsTextInGridList | GetGridListRowIndexFromText | Table.removeValue | removeHex | dxDrawTriangle

Skype: SaSuki102 | About Me | Youtube channel | Lua Tips & Tricks | Lua Strings | Lua Tables | Lua Operators

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

Wolf Inc Discord

Youtube channel
Github

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