Jump to content

Is this possible?


abu5lf

Recommended Posts

I did not understand but try this

function joinTime () 
    setElementData ( source, "joinTime", getTickCount() ) 
    setElementData ( source, "Online Time", "0 :, 0 :, 0 :" ) 
end 
addEventHandler ( "onPlayerJoin", root, joinTime ) 
  

Link to comment
I did not understand but try this

Yes good try

function joinTime () 
    setElementData ( source, "joinTime", getTickCount() ) 
end 
addEventHandler ( "onPlayerJoin", root, joinTime ) 
function checkonline (player) 
   local timeon =( getTickCount() - getElementData ( player, "joinTime")) /60000  
   outputChatBox("Time spent in server: "..timeon.. " minutes.",player,255,255,255) 
end 
addCommandHandler ( "timeinserver",checkonline) 
  

Now you can use a for loop to check who is online for most time.

Edited by Guest
Link to comment
I did not understand but try this

Yes good try

function joinTime () 
    setElementData ( source, "joinTime", getTickCount() ) 
end 
addEventHandler ( "onPlayerJoin", root, joinTime ) 
function checkonline (player) 
   local timeon = getTickCount() - getElementData ( player, "joinTime") /60000  
   outputChatBox("Time spent in server: "..timeon.. " minutes.",player,255,255,255) 
end 
addCommandHandler ( "timeinserver",checkonline) 
  

Now you can use a for loop to check who is online for most time.

basic math rule:

local timeon = (getTickCount() - getElementData ( player, "joinTime")) /60000

otherwise it would divide the element data with 60000 first

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