Page 1 of 1
How to Check age.
Posted: Fri Apr 21, 2006 6:49 am
by Damien
Hello, I got a question about a script that shows how much u totally been online.
As my sentence says, The script should only count the time when your ONLINE.
and to show ur ingame age you should write a command like .checkmyage
it should also be in minutes
Please help?
Posted: Fri Apr 21, 2006 7:19 am
by tekproxy
If you're using the distro, look at the onlinetimer prop set on characters.
Look at /scripts/misc/logoff.src and /scripts/misc/logon, particularly logoff.src. Here's the code that handles updating onlinetimer:
Code: Select all
program onlogoff(who)
var acct := FindAccount(who.acctname);
acct.setprop("LastLogin", readGameclock());
var sessiontime := ReadGameClock() - GetObjProperty(who,"logontime");
var timer := GetObjProperty(who,"onlinetimer");
if(!timer)
timer := 0;
endif
SetObjProperty(who,"onlinetimer",timer+sessiontime);
EraseObjProperty(who,"LoggedIn");
When you login, it records the time you logged in. When you logoff, it subtracts the current time minus the time you logged in to get your total online time that session and then adds that to onlinetimer.
Changing to be in minutes would be as simple as dividing by 60 since everything is recorded in seconds.