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;
}