Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function script F_VIPstart {
- if( PremiumUser ){
- dispbottom "You are already a premium users.";
- 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);
- set original_name$,strcharinfo(0);
- set .@name$,"[VIP] "+strcharinfo(0);
- if( getstrlen( .@name$ ) > 23 ){
- set .@name$,strcharinfo(0);
- dispbottom "Your charname too long..cant have VIP prefix.";
- }
- query_sql "UPDATE `char` SET `name`='"+.@name$+"' WHERE `char_id`="+getcharid(0);
- Announce("[ "+strcharinfo(0)+" ] turned into a Premium User! Congratulations!",BC_ALL);
- 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);
- query_sql "UPDATE `char` SET `name`='"+original_name$+"' WHERE `char_id`="+getcharid(0);
- set PremiumUser,0; // clear timer
- dispbottom "Your VIP Rental has expired.";
- dispbottom "Original Name = "+original_name$;
- end;
- }
Advertisement
Add Comment
Please, Sign In to add comment