//===== rAthena Script ======================================= //= VIP Rental System //===== By: ================================================== //= Brian //===== Current Version: ===================================== //= 1.0 //===== Compatible With: ===================================== //= rAthena SVN //===== Description: ========================================= //= Makes a player VIP (GM level 1) for a set amount of time. //===== Additional Comments: ================================= //= //============================================================ function script F_VIPstart { if( #PremiumUser ){ dispbottom "Sorry, You can't use Another Premium Ticket unless your Premium Service Expires."; end; } set .@ticks, getarg(0); // getarg(0) = ticks (seconds) if (.@ticks <= 0) { debugmes "F_VIPstart - tried to set a timer in the past"; end; } set .@day,.@ticks / 86400; Announce("[ "+strcharinfo(0)+" ] turned into a Premium User for "+.@day+" days ! Congratulations!",BC_ALL); // change them to GM level 1 query_sql "UPDATE login SET `group_id`=1 WHERE account_id="+getcharid(3); 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."; // set a variable, #PremiumUser, as the Unixtime (gettimetick(2)) when this expires set #PremiumUser, gettimetick(2) + .@ticks; // add a timer with that tick (in case they stay logged in that long) if (.@ticks < 2592000) { // prevent overflow error addtimer .@ticks *1000, "vip_rental::OnVIPend"; } return; } - script vip_rental -1,{ OnPCLoginEvent: if (#PremiumUser > gettimetick(2)) { // timer in future if ((#PremiumUser - gettimetick(2)) < 2592000) { // prevent overflow error Announce("Premium Bonus: Exp +50% / Drop +50% / Premium Commands / Premium NPC Settings",BC_SELF); dispbottom "Premium Bonus: Expires in " + callfunc("Time2Str",#PremiumUser); addtimer (#PremiumUser - gettimetick(2)) *1000, "vip_rental::OnVIPend"; } sc_start sc_expboost,1000*60*60*24,50; sc_start sc_itemboost,1000*60*60*24,50; } else if (#PremiumUser) { // timer already expired doevent "vip_rental::OnVIPend"; } end; OnVIPend: sc_end sc_expboost; sc_end sc_itemboost; query_sql "UPDATE login SET `group_id`=0 WHERE account_id="+getcharid(3); set #PremiumUser,0; // clear timer dispbottom "Your VIP Rental has expired."; end; }