Advertisement
Winterfox

Untitled

Jul 6th, 2015
240
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.56 KB | None | 0 0
  1. //======Name========================================
  2. // Daily Login Rewards
  3. //======Version=====================================
  4. // 1.1
  5. // Author: Sandbox, Winterfox
  6. //======Comments====================================
  7. // Updated outdated Syntax-
  8. // Made slight optimizations.
  9. // Added a delay of 3 hours before the player is
  10. // able to claim his reward and only if he has
  11. // not been idle longer than 5 minutes in this
  12. // time frame.
  13. //==================================================
  14.  
  15. - script DailyLoginRewards -1,{
  16. OnInit:
  17. setarray .D_Prize, 501, 502, 503, 607, 608; //Set to desired item prizes
  18. setarray .D_Amt, 1, 2, 3, 2, 1; //Amount of prize to be given
  19. .Serv_Name$ = "Your Server"; //Set to your server name
  20. end;
  21. OnPCLoginEvent:
  22. // Start a timer after 1 minute to sum up idle time
  23. addtimer( 60000, strnpcinfo(3 ) + "::IdleCheck" );
  24. // Start a timer to clam the daily reward after 3 hours
  25. addtimer( 10800000, strnpcinfo(3) + "::StartClaim" );
  26. end;
  27. IdleCheck:
  28. // Add the current idle time to the idle time counter.
  29. #idleTime += checkidle();
  30. // Set a new timer to recheck after 1 minute.
  31. addtimer( 60000, strnpcinfo(3) + "::IdleCheck" );
  32. end;
  33. StartClaim:
  34. // If the idle time was more than 5 minutes in the last 3 hours end the script instead of doing anything.
  35. if( #idleTime < 300 ) end;
  36. if( gettimetick(2) < #ClaimDelay ) end;
  37. if( gettimetick(2) > #StreakDelay ) #LogStreak = 0;
  38.  
  39. if( #RewardStreak == 0 )
  40. dispbottom("Welcome to " + .Serv_Name$ + "! You've received " + .D_Amt[#RewardStreak] + " " + getitemname( .D_Prize[#RewardStreak] )+" for logging in! Visit us daily to get more prize! When you've managed to play with us for 5 consecutive days, you will receive bonus prizes!");
  41.  
  42. if( #RewardStreak > 0 )
  43. dispbottom("Welcome back to " + .Serv_Name$ + "! You've received " + .D_Amt[#RewardStreak] + " " + getitemname( .D_Prize[#RewardStreak] ) + " for logging in! Visit us daily to get more prize! When you've managed to play with us for 5 consecutive days, you will receive bonus prizes!");
  44.  
  45. getitem( .D_Prize[#RewardStreak], .D_Amt[#RewardStreak]);
  46. #RewardStreak += 1;
  47. #LogStreak += 1;
  48. #ClaimDelay = gettimetick(2) + 86400;
  49. #StreakDelay = gettimetick(2) + 172800;
  50.  
  51. if( #LogStreak >= 4 ) {
  52. for( .@i = 0; .@i < 4; set .@i, .@i++ )
  53. getitem(.D_Prize[.@i],.D_Amt[.@i]);
  54.  
  55. dispbottom( "Congratulations! You've received all the daily rewards for logging in 5 consecutive days!" );
  56. #LogStreak = 0;
  57. }
  58. end;
  59. OnPCLogoutEvent:
  60. // Reset idle time on logout.
  61. #idleTime = 0;
  62. end;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement