SphereCommunity

Full Version: 24h hour online when server crash timer dissapear...
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
That's true, it does use resources. You could always go with Mordaunt's idea of using serv.time, which is accurate, and use f_onserver_timer in sphere.ini to trigger any instances of which players online can receive a reward, here's a little example assuming you set TIMERCALL=1 in sphere.ini:
Code:
[events e_reward_timer] //add this event to all the players
on=@login
serv.timercall=1 //let's just set timercall here in sphere.ini without having to change the settings manually.
if !(<tag0.reward_timer>)
  tag.reward_timer=<eval <serv.time> /600> //<serv.time> is based in miliseconds
endif

[function f_onserver_timer] //sphere.ini TIMERCALL=1
if (<serv.clients>)
  for x 0 <eval <serv.clients> +-1>
    if (<serv.client.<local.x>>)
      if (<serv.client.<local.x>.account.plevel> < 2) //is a player?
        if (<eval <eval <serv.time> /600> +-<serv.client.<local.x>.tag0.reward_timer>> >= 1440) //1 day passed
          serv.client.<local.x>.tag.reward_timer=<eval <serv.time> /600>
          trysrc <serv.client.<local.x>.uid> serv.client.<local.x>.message @67 You have been rewarded!
          //serv.newitem=your_reward_item
          //new.cont=<serv.client.<local.x>.findlayer.21> //pack? or findlayer.29 for bank?
        endif
      endif
    endif
  endfor
endif
Pages: 1 2
Reference URL's