Advertisement
Guest User

hi

a guest
Oct 11th, 2012
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. //===== eAthena Script =======================================
  2. //= VIP Rental System
  3. //===== By: ==================================================
  4. //= Brian
  5. //===== Current Version: =====================================
  6. //= 1.0
  7. //===== Compatible With: =====================================
  8. //= eAthena SVN (SQL only)
  9. //===== Description: =========================================
  10. //= Makes a player VIP (GM level 1) for a set amount of time.
  11. //===== Additional Comments: =================================
  12. //=
  13. //============================================================
  14.  
  15. function script F_VIPstart {
  16. set .@ticks, getarg(0); // getarg(0) = ticks (seconds)
  17. if (.@ticks <= 0) {
  18. debugmes "F_VIPstart - tried to set a timer in the past";
  19. end;
  20. }
  21. // change them to GM level 1
  22. atcommand "@adjgmlvl 1 "+strcharinfo(0);
  23. query_sql "UPDATE login SET `level`=1 WHERE account_id="+getcharid(3);
  24. dispbottom "You now have access to VIP 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.";
  25.  
  26. // set a variable, #VIP_expire, as the Unixtime (gettimetick(2)) when this expires
  27. set #VIP_expire, gettimetick(2) + .@ticks;
  28. // add a timer with that tick (in case they stay logged in that long)
  29. if (.@ticks < 2592000) { // prevent overflow error
  30. addtimer .@ticks *1000, "vip_rental::OnVIPend";
  31. }
  32. return;
  33. }
  34.  
  35. - script vip_rental -1,{
  36. OnPCLoginEvent:
  37. if (#VIP_expire > gettimetick(2)) {
  38. // timer in future
  39. if ((#VIP_expire - gettimetick(2)) < 2592000) { // prevent overflow error
  40. Announce("Your VIP Rental stays active, Bonus exp 100% and 150% Bonus for drop rates," + (#VIP_expire - gettimetick(2)) + " remaining seconds.", BC_SELF);
  41. addtimer (#VIP_expire - gettimetick(2)) *1000, "vip_rental::OnVIPend";
  42. }
  43. } else if (#VIP_expire) {
  44. // timer already expired
  45. doevent "vip_rental::OnVIPend";
  46. }
  47. end;
  48.  
  49. OnVIPend:
  50. // change them to GM level 0
  51. atcommand "@adjgmlvl 0 "+strcharinfo(0);
  52. query_sql "UPDATE login SET `level`=0 WHERE account_id="+getcharid(3);
  53. set #VIP_expire, 0; // clear timer
  54. dispbottom "Your VIP Rental has expired.";
  55. end;
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement