viewing paste topic/11403- vip_player_month | Athena

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
function        script  timeleft__      {
        if ( ( .@left = getarg(0) ) <= 0 ) return getarg(0);
        .@day = .@left / 86400;
        .@hour = .@left % 86400 / 3600;
        .@min = .@left % 3600 / 60;
        .@sec = .@left % 60;
        if ( .@day )
                return .@day +" day "+ .@hour +" hour";
        else if ( .@hour )
                return .@hour +" hour "+ .@min +" min";
        else if ( .@min )
                return .@min +" min "+ .@sec +" sec";
        else
                return .@sec +" sec";
}
 
prontera,155,185,5      script  kjdhfdfs        1_F_MARIA,{
//      dispbottom getgroupid() +"";
        if ( getgroupid() > 2 ) {
                mes "Hell no, you shouldn't use me !";
                close;
        }
        if ( #viptimeleft ) {
                mes "Your time left for being a VIP is "+ callfunc( "timeleft__", #viptimeleft - gettimetick(2) )+".";
                close;
        }
        mes "Do you want to buy VIP status ?";
        next;
        if ( select( "Yes", "No" ) == 2 ) close;
        if ( !countitem(White_Gold_Coin) ) {
                mes "you don't have platinum coin";
                close;
        }
        delitem White_Gold_Coin, 1;
        atcommand "@adjgroup 2";
//      addtimer 30*24*60*60*1000, strnpcinfo(0)+"::OnTimeUp"; // over integer limit
        #viptimeleft = 30*24*60*60 + gettimetick(2);
        mes "thank you for purchasing VIP status";
        close;
OnPCLoginEvent:
        if ( #viptimeleft < gettimetick(2) )
                #viptimeleft = 0;
        else if ( #viptimeleft - gettimetick(2) < 2147483 ) // don't execute addtimer if over integer limit
                addtimer ( #viptimeleft - gettimetick(2) )*1000, strnpcinfo(0)+"::OnTimeUp";
        if ( #viptimeleft )
                atcommand "@adjgroup 2";
        end;
OnTimeUp:
        #viptimeleft = 0;
        atcommand "@adjgroup 0";
        end;
}
Viewed 1013 times, submitted by AnnieRuru.