Thread Rating:
- 0 Votes - 0 Average
- 1
- 2
- 3
- 4
- 5
Regarding Time Online
|
Author |
Message |
pinku
Journeyman
Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4
|
Regarding Time Online
Hey there!
With this function, I can calculate the total online time a player was online:
Code:
IF ( <TAG0.LASTCONNECTTIME> == 0 )
TAG0.LASTCONNECTTIME=<TIME>
IF (<TAG0.TOTALCONNECTTIME> == 0)
TAG0.TOTALCONNECTTIME=0
ENDIF
RETURN <eval ((<TAG0.TOTALCONNECTTIME> + <TIME> - <TAG0.LASTCONNECTTIME>)/10 )>
With this, they can grab prizes for 10 minutes online, 1 hour online, 1 day online, etc...
However, let's say I want to give my players one point (just +1 from a tag) per hour online:
Code:
<counts online time>
<1 hour online>
<eval tag bla +1>
<counts again online time from 0>
<1 hour online>
<eval tag bla +1>
...
...
How can I start it? Can someone enlighten me?
Thanks once again!
|
|
08-05-2013 01:56 PM |
|
|
pinku
Journeyman
Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4
|
RE: Regarding Time Online
Thanks for your attention!
I want them to get a TAG (that is going to work like a point, but this does not matter anyway) for every 1 hour online.
Let me --try-- to explain better what I want to happen, without more TAGS on our way. I'll use gold as a reward.
Code:
Player logins in, time starts counting;
Player completes 1 hour online;
Player gets 1000 gold;
Timer restarts;
Player stays one more hour logged in;
Player gets 1000 gold;
Timer restarts;
...
...
Player log out, timer stops.
Did I make it easier or I failed miserably?
Thanks again!
(This post was last modified: 08-05-2013 02:28 PM by pinku.)
|
|
08-05-2013 02:28 PM |
|
|
Rattlehead
Master
Posts: 290
Likes Given: 3
Likes Received: 8 in 6 posts
Joined: Jun 2012
Reputation: 8
|
RE: Regarding Time Online
Code:
[function f_time_online]
src.tag.online_hours += 1
[events e_online_time]
on=@login
if ((<isempty <src.tag.online_hours>>) || (<src.tag.online_hours> > 0))
src.tag.online_hours = 0
endif
src.timerf 3600,f_time_online
they log in, the trigger fires it checks to see if they have the tag, or if the tag is more than 0, if so it makes the tag 0 and after 3600 seconds (one hour) the function fires adding 1 to the tag.
untested, wrote on the fly gl
|
|
08-05-2013 05:53 PM |
|
|
pinku
Journeyman
Posts: 118
Likes Given: 4
Likes Received: 2 in 2 posts
Joined: Apr 2013
Reputation: 4
|
RE: Regarding Time Online
(08-06-2013 02:44 AM)Mordaunt Wrote: If you're not wanting to carry any time from the previous session you could use ctag instead of tag, which is automatically removed when a player logs out, thus reducing memory usage for your server.
Thanks for the tip Mordaunt! They are always welcome.
(08-06-2013 03:19 AM)darksun84 Wrote: Pay attention to use timerf.
If the player logs out , timerf will still continue to run(while a timer item will stop), also you can't stop a timerf function without actually stopping all the timerf functions a player have! So you have to add some check for preventention(like checking if the player is online when the timerf finish)
Thanks for the tip, darksun!
I haven't tested TIMERF in this case yet, but I'm sure a timer item will not stop. o:
I know that because I have a script to stop the timer from a certain memory.
Or are you talking about something else? =P
(This post was last modified: 08-06-2013 04:03 AM by pinku.)
|
|
08-06-2013 04:03 AM |
|
|
User(s) browsing this thread: 2 Guest(s)