Advertisement
Capuche

Hourly_points

May 8th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. //===== rAthena Script =======================================
  2. //= Hourly Points
  3. //===== By: ==================================================
  4. //= Capuche
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= rAthena SVN
  9. //===== Description: =========================================
  10. //= Give a reward for staying IG 1 hour.
  11. //= It exists a lot a hourly points npc, it's just for fun.
  12. //= nb. : A while loop may not be the best way to prevent
  13. //= multi-loop..
  14. //============================================================
  15.  
  16. - script hourlypoints -1,{
  17. OnPCLoginEvent:
  18. .@time_loop = @time_loop = gettimetick(2);
  19. setd "."+ getcharid(0) +""+ .@time_loop, 1;
  20. while(1) {
  21. sleep2 30000;
  22. if ( !getd( "."+ getcharid(0) +""+ .@time_loop ) ) end;
  23. @loop__++; // +1 loop every 30 secs
  24. if( hourly_reward == gettime(8) ) {
  25. @loop__ = 0;
  26. if( .re_log ) end;
  27. }
  28. else if( checkvending() || checkchatting() ) {
  29. dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
  30. end;
  31. }
  32. else if( checkidle() > 300 ) {
  33. if( @loop__ > 1 )
  34. dispbottom "The hourly points event is re-initialized because you were idle more than 5 minutes.";
  35. @loop__ = 0;
  36. if( .re_log ) end;
  37. }
  38. else if( @loop__ == 60*2 ) {
  39. hourly_reward = gettime(8);
  40. getitem .reward_ID,1;
  41. dispbottom "You received 1 "+ getitemname( .reward_ID ) +" by staying ingame for 1 hour.";
  42. if( .re_log ) end;
  43. }
  44. }
  45. end;
  46. OnPCLogoutEvent:
  47. setd "."+ getcharid(0) +""+ @time_loop, 0;
  48. end;
  49. OnInit:
  50. .re_log = 0; // player must relog to re-activate the hourly point ? (1: yes, 0: no)
  51. .reward_ID = 7227; // item ID reward when player not idle and online more than 1 hour
  52. end;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement