Jump to content
  • 0
Hijirikawa

Player logout time

Question

11 answers to this question

Recommended Posts

  • 0

Gettimetick(2) is the number of seconds since the unix epoch (Jan 1st 1970). When you log out, "set LogOutTick, gettimetick(2)". For example, let's say 1000000.

When you log in, "set LogInTick, gettimetick(2)". For example, let's say 1100000.

So "LogInTick - LogOutTick" is 1100000 - 1000000 = 100000. The player has been offline for 100000 seconds.

Link to comment
Share on other sites

  • 0

how would the calculation be? The description says it counts the second since start of current day. However, what if, for instance the player played at 01:00 server time, and then log back in the next day at 12:00, would it not result in a negative number?

Link to comment
Share on other sites

  • 0

https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L2959-L2968

gettimetick(2) returns the epoch time

 

So on logout, you store the timetick [logouttime]. On login, you get the timetick [logintime], then the offline time is [logintime - logouttime]

Link to comment
Share on other sites

  • 0

Sorry I'm still confused, but if the formula would be logintime - logouttime, wouldn't there be a chance of it being negative if we use gettimetick(2)?

Link to comment
Share on other sites

  • 0

I see now, thanks.

Now, for instance, limit is 24 hours, then I should do this?

OnPCLogoutEvent:
	
	set checkday,gettimetick(1);
	
	end;
	
OnPCLoginEvent:

	if(gettimetick(1) >= checkday)
		dispbottom "You have been away for more than 1 day";
		
	end;
Link to comment
Share on other sites

  • 0

How about this?

OnPCLogoutEvent:
	
	set checkday,gettimetick(2) + 84600; //logout time + 24 hours
	
	end;
	
OnPCLoginEvent:

	if(gettimetick(2) >= checkday)
		dispbottom "You have been away for more than 1 day";
		
	end;
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.