yuhsing

Untitled

May 24th, 2013
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.41 KB | None | 0 0
  1.  
  2. // Oh okay. I cant access rathena and I cannot get support for my other scripts and we cannot talk about the past scripts we were doing like the pvp bet match NPC and the Copy SKill NPC hehe. Anyway I will just wait for them to be up. I hope soon.
  3.  
  4. // By the way my friend, can you make me a script that counts online time of players.
  5.  
  6. // - if a player is online for 12 hours straight he will get a prize for every 12 hours continous he is online.
  7. // But he can character select and it is STILL counted.
  8. // - if player goes offline even for 1 minute then it is not counted and will not get any prize.
  9. // - I can set (gm 99) what prize and how many pieces per 12 hours.
  10. // - I can set (gm 99) how many hours player must be online (12 or 24 hrs).
  11. // - Once they reached the 12 hrs mark (or 24 hrs whichever is set),
  12. // a window will open with a message that he will get a prize then upon closing window the prize that is set will be given.
  13. // - Kindly optimise it so that it would not create more lag in the server resources, kindly use commands that are not making lags.
  14. // Imagine if 1,000 online people have a timer in each of them it might add lag to the server.
  15. // Im not sure about this. I think its better to make use of an alternative that will eat less server resources.
  16.  
  17. // Let me know my friend! Thank you as always! :)
  18.  
  19.  
  20. prontera,155,181,5 script Sample 757,{
  21. if( ( !$hours_duration || $hour_item_id || $hour_item_amount ) && getgmlevel() < .gmlevel ){
  22. mes "Timer disabled. Please wait the GM to setup the NPC first.";
  23. }else if( getgmlevel() < .gmlevel ){
  24. mes "You must online ^FF0000"+$hours_duration+"^000000 hours to get ^777777"+$hour_item_amount+" x "+getitemname( $hour_item_id )+"^000000.";
  25. mes "Timer will reset if you logoff more than 1 minute.";
  26. }else{
  27. do{
  28. mes "Time : every ^777777"+$hours_duration+"^000000 hours";
  29. mes "Item : ^777777"+$hour_item_amount+" x "+getitemname( $hour_item_id )+"^000000";
  30. switch( select( "Edit Time","Edit Item" ) ){
  31. Case 1:
  32. mes "Enter within 0 ~ 24";
  33. mes "^7777770 = disable^000000";
  34. input $hours_duration,0,24;
  35. break;
  36. Case 2:
  37. mes "Enter ItemID";
  38. mes "^7777770 = disable^000000";
  39. do{
  40. input .@item,0,32767;
  41. if( !.@item ) close;
  42. }while( getitemname( .@item ) == "null" );
  43. mes "How many ^FF0000"+getitemname( .@item )+"^000000 ??";
  44. mes "^7777770 = disable^000000";
  45. input .@amount,0,30000;
  46. if( .@amount ){
  47. mes "Total ^0055FF"+.@amount+" x "+getitemname( .@item )+"^000000";
  48. if( select( "Confirm","Close" ) == 1 ){
  49. mes "Done updated.";
  50. set $hour_item_id,.@item;
  51. set $hour_item_amount,.@amount;
  52. }
  53. }
  54. break;
  55. default: break;
  56. }
  57. next;
  58. }while( select("Back Menu","Close" ) == 1 );
  59. }
  60. close;
  61.  
  62. OnInit:
  63. // min GM Level access GM CP.
  64. set .gmlevel,90;
  65. // check player status every 15 minute.
  66. set .check_interval_minute,15;
  67.  
  68. set .strnpcinfo$,strnpcinfo(0);
  69. end;
  70.  
  71. OnPCLoginEvent:
  72. if( $hours_duration && $hour_item_id && $hour_item_amount ){
  73. set .@gettimetick,gettimetick(1);
  74. set .@time_gap,( .@gettimetick - #hour_time_online );
  75. if( .@time_gap > 60 ){
  76. set #hour_time_total,0;
  77. dispbottom "Reset Accumulated Online Time ... because you logoff for 1 minutes.";
  78. }
  79. set #hour_time_online,.@gettimetick;
  80. }
  81. end;
  82.  
  83. OnCheck:
  84. if( $hours_duration && $hour_item_id && $hour_item_amount ){
  85. set #hour_time_online,gettimetick(1);
  86. if( checkvending() || checkchatting() ){
  87. set @chat_vending_user,1;
  88. deltimer .strnpcinfo$+"::OnCheck";
  89. dispbottom "Timer Stopped...user opened Public Chat / Vending...Please relog to re-enable it again.";
  90. }else{
  91. addtimer ( .check_interval_minute * 60000 ),.strnpcinfo$+"::OnCheck";
  92. set #hour_time_total,#hour_time_total + ( .check_interval_minute * 60 );
  93. if( #hour_time_total >= ( $hours_duration * 3600 ) ){
  94. mes "You have gained Items for online "+$hours_duration+" hours non-stop.";
  95. close2;
  96. set #hour_time_total,#hour_time_total - ( $hours_duration * 3600 );
  97. getitem $hour_item_id,$hour_item_amount;
  98. }
  99. }
  100. }
  101. end;
  102.  
  103. OnPCLogoutEvent:
  104. if( $hours_duration && $hour_item_id && $hour_item_amount ){
  105. if( !@chat_vending_user ){
  106. set .@gettimetick,gettimetick(1);
  107. set .@time_gap,( .@gettimetick - #hour_time_online );
  108. set #hour_time_total,#hour_time_total + .@time_gap;
  109. set #hour_time_online,.@gettimetick;
  110. deltimer .strnpcinfo$+"::OnCheck";
  111. }
  112. }
  113. end;
  114. }
Advertisement
Add Comment
Please, Sign In to add comment