Jump to content
  • 0
Sign in to follow this  
Virtue

Help with this VIP Script

Question

Hi,

I'm at a loss about this script. No Errors on script checker, it's just that once the set VIP time expires sometimes it goes on negative and the VIP time doesn't end.

Any help would be appreciated!

Script below

 

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,150,150,0	script	VIP Administrator	4_F_KAFRA5,{
	set .@npcname$,"^0000FF[ TEst ]^000000";
	if ( getgroupid() > 1 ) {
		mes .@npcname$;
		mes "Hell no, you shouldn't use me !";
		close;
	}
	if ( #viptimeleft ) {
		mes .@npcname$;
		mes "Your time left for being a VIP is "+ callfunc( "timeleft__", #viptimeleft - gettimetick(2) )+".";
		close;
	}
	mes .@npcname$;
	mes "How can I help?";
	next;
	if ( select( "What's a VIP?", "Nothing" ) == 2 ) close;
	mes .@npcname$;
	mes "You'll get the following benefits for being a VIP:";
	mes "Server rates increased while on VIP Status";
	mes "^9ACD32Base & Job Exp - 12x^000000";
	mes "^FF4500Equipment - 6x^000000";
	mes "^FF0000Cards - 0.12%^000000";
	mes "^00BFFFUsable, Healing & Common Drop - 7x^000000";
	mes "^FF0000Death Penalty - 0.5%^000000";
	close;
	
OnPCLoginEvent:
	if ( #viptimeleft >= 0 ) {
		ModExp = 125;
		ModDrop = 125;
		ModDeath = 50;
		dispbottom ("VIP: Your time left for being a VIP is "+ callfunc( "timeleft__", #viptimeleft - gettimetick(2) ) +".",0xFF7256);
		}
	if ( #viptimeleft < gettimetick(2) )
		set #viptimeleft,0;
	else if ( #viptimeleft - gettimetick(2) < 2147483 ) // don't execute addtimer if over integer limit
		addtimer(( #viptimeleft - gettimetick(2))*1000, strnpcinfo(NPC_NAME_UNIQUE)+"::OnTimeUp");
	else if ( #viptimeleft < 0)
	ModExp = 100;
	ModDrop = 100;
	ModDeath = 100;
	end;
	
OnTimeUp:
	announce "[ VIP : Your VIP Subcription has Expired. ]",bc_self,0xffbc90;
	dispbottom ("VIP: Your VIP Subcription has Expired.",0xFF7256);
	#viptimeleft = 0;
	ModExp = 100;
	ModDrop = 100;
	ModDeath = 100;
	end;
}
Edited by Virtue

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.