Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prontera,155,161,5 script Sample 757,{
- .@gm_level = getgmlevel();
- switch( select( "Informations",
- ( .@gm_level == .vip_id )?"Check Remaining Time":"",
- ( .@gm_level == .vip_id )?"":"Purchase VIP" ) ){
- Case 1:
- mes "This is a VIP system.";
- break;
- Case 2:
- mes "Your VIP Time Left :";
- mes " > ^0055FF"+callsub( view_vip_time,#premium_time )+"^000000";
- break;
- Case 3:
- mes "Purchase VIP ?";
- mes "Duration : ^0055FF"+callsub( view_vip_time,( .vip_duration + gettimetick(2) ) )+"^000000";
- if( .vip_item_size ){
- for( set .@i,0; .@i < .vip_item_size; set .@i,.@i+1 ){
- set .@amount,countitem( .vip_item[.@i] );
- mes " > "+( ( .@amount < .vip_amount[.@i] )?"^FF0000":"^0055FF" )+" "+callsub( value_convert,.vip_amount[.@i] )+" x "+getitemname( .vip_item[.@i] )+"^000000";
- if( .@amount < .vip_amount[.@i] ) set .@fail,.@fail + 1;
- }
- }
- if( .vip_zeny ){
- mes " >"+( ( Zeny < .vip_zeny )?"^FF0000":"^0055FF" )+" "+callsub( value_convert,.vip_zeny )+" Zeny^000000";
- }
- mes "you need these items.";
- if( !.@fail && Zeny >= .vip_zeny )
- if( select("Confirm","Cancel") == 1 ){
- for( set .@i,0; .@i < .vip_item_size; set .@i,.@i+1 )
- if( countitem( .vip_item[.@i] ) < .vip_amount[.@i] ){
- mes "You didnt have enough "+getitemname( .vip_item[.@i] )+".";
- close;
- }
- for( set .@i,0; .@i < .vip_item_size; set .@i,.@i+1 )
- delitem .vip_item[.@i],.vip_amount[.@i];
- set #premium_time,( gettimetick(2) + .vip_duration );
- atcommand "@adjgmlvl "+.vip_id;
- message strcharinfo(0),"You purchased VIP for next "+callsub( view_vip_time,#premium_time );
- addtimer (( #premium_time - gettimetick(2) ) * 1000 ),strnpcinfo(0)+"::OnPCLoginEvent";
- }
- default: break;
- }
- close;
- view_vip_time:
- set .@time,( getarg(0) - gettimetick(2) );
- set .@day,( .@time / ( 3600 * 24 ) );
- set .@hour,( .@time / 3600 % 24 );
- set .@min,( .@time % 3600 / 60 );
- set .@sec,( .@time % 60 );
- set .@time$,(( .@day )? .@day+" Day ":"" ) +
- (( .@hour )? .@hour+" Hr ":"" ) +
- (( .@min )? .@min+" Min ":"" ) +
- (( .@sec )? .@sec+" Sec":"" );
- return .@time$;
- value_convert:
- set .@num, atoi(""+getarg(0));
- if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
- set .@l, getstrlen(""+.@num);
- for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
- set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
- if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
- }
- return .@num$;
- OnInit:
- // VIP GM Lvl
- set .vip_id,1;
- // How long each purchase of VIP last ( seconds )
- set .vip_duration,86400;
- // required item + amount
- setarray .vip_item,607,608,512;
- setarray .vip_amount,1,2,3;
- set .vip_item_size,getarraysize( .vip_item );
- // required zeny
- set .vip_zeny,100000;
- end;
- OnPCLoginEvent:
- if( #premium_time ){
- deltimer strnpcinfo(0)+"::OnPCLoginEvent";
- if( #premium_time <= gettimetick(2) ){
- mes "Your VIP has expired. Status removed.";
- set #premium_time,0;
- deltimer strnpcinfo(0)+"::OnPCLoginEvent";
- if( getgroupid() == .vip_id )
- atcommand "@adjgmlvl 0";
- close;
- }else{
- set .@timeleft,( #premium_time - gettimetick(2) + 1 );
- if( .@timeleft ){
- mes "Your VIP Time Left :";
- mes " > ^0055FF"+callsub( view_vip_time,#premium_time )+"^000000";
- }
- atcommand "@adjgmlvl "+.vip_id;
- addtimer ( .@timeleft * 1000 ),strnpcinfo(0)+"::OnPCLoginEvent";
- }
- }
- close;
- }
Advertisement
Add Comment
Please, Sign In to add comment