yuhsing

Untitled

May 26th, 2013
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1.  
  2.  
  3. - script Sample -1,{
  4.  
  5. OnInit:
  6. // item ID + amount
  7. set .item_id,512;
  8. set .item_amount,10;
  9. // online for how many hour
  10. set .online_hours,12;
  11. // check player status every 15 minute.
  12. set .check_interval_minute,15;
  13.  
  14. set .strnpcinfo$,strnpcinfo(0);
  15. end;
  16.  
  17. OnPCLoginEvent:
  18. set .@gettimetick,gettimetick(1);
  19. set .@time_gap,( .@gettimetick - #hour_time_online );
  20. if( .@time_gap > 60 ){
  21. set #hour_time_total,0;
  22. dispbottom "Reset Accumulated Online Time ... because you logoff for 1 minutes.";
  23. }
  24. set #hour_time_online,.@gettimetick;
  25. end;
  26.  
  27. OnCheck:
  28. set #hour_time_online,gettimetick(1);
  29. if( checkvending() || checkchatting() ){
  30. set @chat_vending_user,1;
  31. deltimer .strnpcinfo$+"::OnCheck";
  32. dispbottom "Timer Stopped...user opened Public Chat / Vending...Please relog to re-enable it again.";
  33. }else{
  34. addtimer ( .check_interval_minute * 60000 ),.strnpcinfo$+"::OnCheck";
  35. set #hour_time_total,#hour_time_total + ( .check_interval_minute * 60 );
  36. if( #hour_time_total >= ( .online_hours * 3600 ) ){
  37. mes "You have gained Items for online "+.online_hours+" hours non-stop.";
  38. close2;
  39. set #hour_time_total,#hour_time_total - ( .online_hours * 3600 );
  40. getitem .item_id,.item_amount;
  41. }
  42. }
  43. end;
  44.  
  45. OnPCLogoutEvent:
  46. if( !@chat_vending_user ){
  47. set .@gettimetick,gettimetick(1);
  48. set .@time_gap,( .@gettimetick - #hour_time_online );
  49. set #hour_time_total,#hour_time_total + .@time_gap;
  50. set #hour_time_online,.@gettimetick;
  51. deltimer .strnpcinfo$+"::OnCheck";
  52. }
  53. end;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment