Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
24h hour online when server crash timer dissapear...
Author Message
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #1
24h hour online when server crash timer dissapear...
Hi i have create a 24 hour online reward system it mean's if player stay online for 24h he get reward, but the problem is when server crash all player timer go to 0 so they can take reward how to repair this thing ?
I am using this for login and logout

ON=@LOGIN
findid(i_reward_timer).timer = <findid(i_reward_timer).tag0.timer>
findid(i_reward_timer).tag0.timer = 0

ON=@LOGOUT
findid(i_reward_timer).timer = <findid(i_reward_timer).tag0.timer>
findid(i_reward_timer).tag0.timer = -1

but when server crash timer go to 0 Confused

Thanks, and sorry for bad english
09-13-2012 04:55 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #2
RE: 24h hour online when server crash timer dissapear...
maybe you need to solve crash problem first Big Grin

anyway you can use Mordaunt's idea or timerf:

http://forum.spherecommunity.net/showthr...35#pid5535
09-13-2012 06:09 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #3
RE: 24h hour online when server crash timer dissapear...
Only put that:

ON=@LOGOUT
findid(i_reward_timer).timer = 86400 // 24 hours in seconds

If the server crashes, there is no LOGOUT fired and no Timer reset to original position.
When the players logins again, the timer is in the position of the last save.

But anytime the player logout normally, his timer will set to a full 24 hour timer.
(This post was last modified: 09-13-2012 06:52 AM by Gil Amarth.)
09-13-2012 06:47 AM
Find all posts by this user Like Post Quote this message in a reply
Shaklaban
Master
**

Posts: 378
Likes Given: 0
Likes Received: 1 in 1 posts
Joined: Mar 2012
Reputation: 8

DOT

Post: #4
RE: 24h hour online when server crash timer dissapear...
he says server is crashed so logout will not fire, maybe he can reset all timers f_on_server_start or on=@login timer=86400
(This post was last modified: 09-13-2012 07:05 AM by Shaklaban.)
09-13-2012 07:05 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #5
RE: 24h hour online when server crash timer dissapear...
I doubt he wants all the timer reseted when the server is crashed, don´t have much sense. It´s not the players fault.
But if he wants that, on=@login timer=86400 is the better way.

ON=@LOGOUT
findid(i_reward_timer).timer = 86400 // 24 hours in seconds
tag.safe_logout=1

ON=@LOGIN
if !(<tag0.safe_logout>) // logout with crash
findid(i_reward_timer).timer = 86400
else // logout without crash
// put here anything you want
endif
tag.safe_logout=
(This post was last modified: 09-13-2012 07:31 AM by Gil Amarth.)
09-13-2012 07:20 AM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #6
RE: 24h hour online when server crash timer dissapear...
Well... how about updating their play time in a tag and using f_onserver_timer as a mechanism to update it.
That way you could update the tag periodically and should the server crash the player would only be down by whatever the interval your using is.

[Image: 2nis46r.jpg]
09-13-2012 08:52 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #7
RE: 24h hour online when server crash timer dissapear...
Use timerf as mentioned above or fire the timer every second and add the tag, then compare the tag to see if you have X amount of seconds, a little example:
Code:
on=@login
findid.i_reward_timer.timer=1

[itemdef i_reward_timer]
defname=i_reward_timer
name=Reward Timer
id=i_memory

on=@create
attr=attr_move_never|attr_invis

on=@timer
tag0.timer += 1 //add 1 second
if (<dtag0.timer> >= 86400) //1 day?
  //give reward
  tag.timer=0 //reset timer
endif
timer=1
return 1

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 09-13-2012 10:39 AM by Skul.)
09-13-2012 10:39 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Alias
Journeyman
*

Posts: 107
Likes Given: 0
Likes Received: 0 in 0 posts
Joined: Apr 2012
Reputation: 0



Post: #8
RE: 24h hour online when server crash timer dissapear...
My server is not crashing but the problem is when any of my familly can turn off pc and it the same as crash, i will try your suggestion when i will be at home, tyvm for helping Smile
09-13-2012 01:46 PM
Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #9
RE: 24h hour online when server crash timer dissapear...
(09-13-2012 10:39 AM)Skul Wrote:  Use timerf as mentioned above or fire the timer every second and add the tag, then compare the tag to see if you have X amount of seconds, a little example:
Code:
on=@login
findid.i_reward_timer.timer=1

[itemdef i_reward_timer]
defname=i_reward_timer
name=Reward Timer
id=i_memory

on=@create
attr=attr_move_never|attr_invis

on=@timer
tag0.timer += 1 //add 1 second
if (<dtag0.timer> >= 86400) //1 day?
  //give reward
  tag.timer=0 //reset timer
endif
timer=1
return 1

A timer which fires every second to every player?
It´s very expensive in resources, in my opinion.
09-13-2012 09:18 PM
Find all posts by this user Like Post Quote this message in a reply
Mordaunt
Super Moderator
****

Posts: 1,237
Likes Given: 26
Likes Received: 55 in 43 posts
Joined: Mar 2012
Reputation: 35



Post: #10
RE: 24h hour online when server crash timer dissapear...
I would run it at the most frewunt of once per minute... you could get away with once every 15 or so. I use, or have used, the method with the server timer to regulate multiple scripts. That way you're not creating lots of memory items running timers

[Image: 2nis46r.jpg]
09-13-2012 10:04 PM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)