yuhsing

Untitled

Jan 30th, 2013
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.18 KB | None | 0 0
  1.  
  2.  
  3.  
  4. function script F_VIPstart {
  5. set .@ticks, getarg(0); // getarg(0) = ticks (seconds)
  6. if (.@ticks <= 0) {
  7. debugmes "F_VIPstart - tried to set a timer in the past";
  8. end;
  9. }
  10. set .@day,.@ticks / 86400;
  11. Announce("[ "+strcharinfo(0)+" ] turned into a Premium User for "+.@day+" days ! Congratulations!",BC_ALL);
  12. // change them to GM level 1
  13. query_sql "UPDATE login SET `group_id`=1 WHERE account_id="+getcharid(3);
  14. set original_name$,strcharinfo(0);
  15. set .@name$,"[VIP] "+strcharinfo(0);
  16. if( getstrlen( .@name$ ) > 23 ){
  17. set .@name$,strcharinfo(0);
  18. dispbottom "Your charname too long..cant have VIP prefix.";
  19. }
  20.  
  21. query_sql "UPDATE `char` SET `name`='"+.@name$+"' WHERE `char_id`="+getcharid(0);
  22. Announce("[ "+strcharinfo(0)+" ] turned into a Premium User! Congratulations!",BC_ALL);
  23. dispbottom "You now have access to Premium Commands! Take note doing rates will not changes the infos given by the server as regular rate but it will automatically add in your Exp and Drop rates.";
  24.  
  25. // set a variable, PremiumUser, as the Unixtime (gettimetick(2)) when this expires
  26. set PremiumUser, gettimetick(2) + .@ticks;
  27. // add a timer with that tick (in case they stay logged in that long)
  28. if (.@ticks < 2592000) { // prevent overflow error
  29. addtimer .@ticks *1000, "vip_rental::OnVIPend";
  30. }
  31. return;
  32. }
  33.  
  34. - script vip_rental -1,{
  35.  
  36. OnPCLoginEvent:
  37. if (PremiumUser > gettimetick(2)) {
  38. // timer in future
  39. if ((PremiumUser - gettimetick(2)) < 2592000) { // prevent overflow error
  40. Announce("Premium Bonus: Exp 50% / Drop 50% / Premium Commands / Premium NPC Settings",BC_SELF);
  41. dispbottom "Premium Bonus: Expires in " + callfunc("Time2Str",PremiumUser);
  42. addtimer (PremiumUser - gettimetick(2)) *1000, "vip_rental::OnVIPend";
  43. }
  44.  
  45. sc_start sc_expboost,1000*60*60*24,50;
  46. sc_start sc_itemboost,1000*60*60*24,50;
  47.  
  48. } else if (PremiumUser) {
  49. // timer already expired
  50. doevent "vip_rental::OnVIPend";
  51. }
  52. end;
  53.  
  54. OnVIPend:
  55. sc_end sc_expboost;
  56. sc_end sc_itemboost;
  57. query_sql "UPDATE login SET `group_id`=0 WHERE account_id="+getcharid(3);
  58. query_sql "UPDATE `char` SET `name`='"+original_name$+"' WHERE `char_id`="+getcharid(0);
  59. set PremiumUser,0; // clear timer
  60. dispbottom "Your VIP Rental has expired.";
  61. end;
  62. }
Advertisement
Add Comment
Please, Sign In to add comment