//@unloadnpc VIP Service
//@loadnpc npc/thor/vip.txt

office,136,27,0	script	VIP Service	1_F_ORIENT_02,{
	if ( #VIP || getgmlevel() >= 1 ) {
		mes .npcname$;
		mes "- - - - - - - - - - - - - - - -";	
		if (getgmlevel() >= 1) {
			mes "Hello GM "+strcharinfo(0);
			mes "How can i assist you?";
		} else {
			mes "Hello "+strcharinfo(0)+", you VIP Status is:";

			// Hourly
			if (#VIP == 1){
				mes "^8C7853BRONZE^000000 VIP PACKAGE";
				mes "- - - - - - - - - -";
				mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2bronze)+"^000000 Rok";
				mes "Duration: ^28bf0024 Hours Online Time^000000";
				mes "Scope: ^28bf00 Characters^000000";  
				mes "Battle Information:";
				mes "> Base EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
				mes "> Job EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
				mes "> Drops: +^ff0000"+$VIPs_BronzeItemRate+"^000000%";
				mes "> Buffs: ^28bf00Inc AGI^000000";
			}else if(#VIP == 2){
				mes "^A9A9A9SILVER^000000 VIP PACKAGE";
				mes "- - - - - - - - - -";
				mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2silver)+"^000000 Rok";
				mes "Duration: ^28bf0024 Hours Online Time^000000";
				mes "Scope: ^28bf00 Characters^000000";   
				mes "Battle Information:";
				mes "> Base EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
				mes "> Job EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
				mes "> Drops: +^ff0000"+$VIPs_SilverItemRate+"^000000%";
				mes "> Buffs: ^28bf00Inc AGI^000000";

			}else if(#VIP == 3){
				mes "^D9D919GOLD^000000 VIP PACKAGE";
				mes "- - - - - - - - - -";
				mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2gold)+"^000000 Rok";
				mes "Duration: ^28bf0024 Hours Online Time^000000";
				mes "Scope: ^28bf00 Characters^000000";   
				mes "Special Access:";
				mes "~ ^ff0000VIP ROOM^000000";
				mes "~ ^ff0000Cloth Color NPC^000000";
				mes "~ ^ff0000Extended Hair Dye and Style^000000";
				mes "Battle Information:";
				mes "> Base EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
				mes "> Job EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
				mes "> Drops: +^ff0000"+$VIPs_GoldItemRate+"^000000%";
				mes "> Buffs: ^28bf00Inc AGI^000000";
			}


		}

		if(getstatus(SC_INC_AGI) <=0) { 
			skilleffect AL_INCAGI,0;
			sc_start SC_INC_AGI,1800000,10;
		}
		next;
		switch(select(
			 ((#VIP )?"- ^777777Remove VIP Status^000000:":":")+
			 "- ^777777VIP Package Information^000000:"+
	 		 "- ^777777Close^000000"
		)) {

		case 1:
			mes .npcname$;
			mes "Are you sure you want to remove your VIP?";
			mes "^FF0000              W  A  R  N  I  N  G^000000";
			mes "You will ^FF0000L O S T^000000 your VIP Status in all server and this can't be undone.";
			mes "Do you wish to proceed?";
			if (select("No, thanks", "Yes, I'm sure") == 2) {
				next;
				mes .npcname$;
				mes "Enter your password.";
				input .@number$;
				query_sql "SELECT count(`user_pass`) from chaos.login WHERE `user_pass` = '"+md5(.@number$)+"' AND `account_id` = '"+getcharid(3)+"'", .@found;
				if(.@found){
					mes .npcname$;
					if(#VIP == 1) {
						set #VIP,0;
						sc_end SC_CASH_PLUSEXP;	
						sc_end SC_CASH_RECEIVEITEM;
						sc_end SC_INC_AGI;
						//atcommand "@aura 0,0,0";
						query_sql "DELETE FROM vip_bronze WHERE `account_id` = "+getcharid(3);
						//query_sql "ALTER TABLE vip_bronze AUTO_INCREMENT = "+1;
						mes "Your VIP Bronze has been cancelled.";
						close;
					}
					if(#VIP == 2) {
						set #VIP,0;
						sc_end SC_CASH_PLUSEXP;	
						sc_end SC_CASH_RECEIVEITEM;
						sc_end SC_INC_AGI;
						//atcommand "@aura 0,0,0";
						query_sql "DELETE FROM vip_silver WHERE `account_id` = "+getcharid(3);
						//query_sql "ALTER TABLE vip_silver AUTO_INCREMENT = "+1;
						mes "Your VIP Silver has been cancelled.";
						close;
					}
					if(#VIP == 3) {
						set #VIP,0;
						sc_end SC_CASH_PLUSEXP;	
						sc_end SC_CASH_RECEIVEITEM;
						sc_end SC_INC_AGI;
						//atcommand "@aura 0,0,0";
						query_sql "DELETE FROM vip_gold WHERE `account_id` = "+getcharid(3);
						//query_sql "ALTER TABLE vip_gold AUTO_INCREMENT = "+1;
						mes "Your VIP Gold has been cancelled.";
						close;
					}
				}else{
					mes .npcname$;
					mes "Incorrect Password.";
					close;
				}
			}			
			close;
		case 2:
			mes .npcname$;
			mes "There are 3 Category for VIP";
			mes "^8C7853Bronze^000000, ^A9A9A9Silver^000000 and ^D9D919Gold^000000.  All these has different previledges.";
			mes "Do you wan't to know more?";
			while(1) {
				next;
				switch ( select ("- ^8C7853Bronze^000000 Package:- ^A9A9A9Silver^000000 Package:- ^D9D919Gold^000000 Package:- Close") ) {
					case 1:
						mes "^8C7853BRONZE^000000 VIP PACKAGE";
						mes "- - - - - - - - - -";
						mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2bronze)+"^000000 Rok";
						mes "Duration: ^28bf0024 Hours Online Time^000000";
						mes "Scope: ^28bf00 Characters^000000";   
						mes "Battle Information:";
						mes "> Base EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
						mes "> Job EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
						mes "> Drops: +^ff0000"+$VIPs_BronzeItemRate+"^000000%";
						mes "> Buffs: ^28bf00Inc AGI^000000";
						break;
					case 2:
						mes "^A9A9A9SILVER^000000 VIP PACKAGE";
						mes "- - - - - - - - - -";
						mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2silver)+"^000000 Rok";
						mes "Duration: ^28bf0024 Hours Online Time^000000";
						mes "Scope: ^28bf00 Characters^000000"; 
						mes "Battle Information:";
						mes "> Base EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
						mes "> Job EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
						mes "> Drops: +^ff0000"+$VIPs_SilverItemRate+"^000000%";
						mes "> Buffs: ^28bf00Inc AGI^000000";
						break;
					case 3:
						mes "^D9D919GOLD^000000 VIP PACKAGE";
						mes "- - - - - - - - - -";
						mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2gold)+"^000000 Rok";
						mes "Duration: ^28bf0024 Hours Online Time^000000";
						mes "Scope: ^28bf00 Characters^000000"; 
				mes "Special Access:";
				mes "~ ^ff0000VIP ROOM^000000";
				mes "~ ^ff0000Cloth Color NPC^000000";
				mes "~ ^ff0000Extended Hair Dye and Style^000000";
				mes "Battle Information:";
						mes "> Base EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
						mes "> Job EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
						mes "> Drops: +^ff0000"+$VIPs_GoldItemRate+"^000000%";
						mes "> Buffs: ^28bf00Inc AGI^000000";
						break;
					default:
						close;
				}
		   	}
		default:
			next;
			mes .npcname$;
			mes "- - - - - - - - - - - - - - - -";	
			mes "Okay ^FF0000"+strcharinfo(0)+"^000000, see you soon.";
			close;
		}

	}
	if (!#VIP){
		disable_items();
		mes .npcname$;
		mes "- - - - - - - - - - - - - - - -";	
		mes "Hello "+strcharinfo(0);
		if (!#freevip) {
			mes "Good News!!! I am giving 24 Hours FREE Silver Package";
			mes "Would you like avail it now?";
			next;
			if (select("Yes", "No") == 1) {
				query_sql("INSERT INTO vip_silver (`account_id`,`start_time`,`total_sec`,`status`) VALUES ("+getcharid(3)+",NOW(),86400,'ACTIVE');");
				sleep2 100;
				set #VIP,2;						
				sc_start SC_CASH_PLUSEXP,86400*1000,$VIPs_SilverExpRate;
				sc_start SC_CASH_RECEIVEITEM,86400*1000,$VIPs_SilverItemRate; 
				skilleffect AL_INCAGI,0;
				sc_start SC_INC_AGI,1800000,10;
				dispbottom "VIP SILVER Bonus: BASE/JOB EXP +"+$VIPs_SilverExpRate+"% | DROP RATE +"+$VIPs_SilverItemRate+"%";
				set #freevip,1;	
				close;
			}
		}
		if (countitem(Gold_VIP_24) > 0) {		
			mes .npcname$;
			mes "Oh you have a VIP Coupon.";
			mes "Would you like to activate 24 Hours Gold VIP now?";
			next;
			if (select("Yes", "No") == 1) {
 				query_sql("INSERT INTO vip_gold (`account_id`,`start_time`,`total_sec`,`status`) VALUES ("+getcharid(3)+",NOW(),86400,'ACTIVE');");
				sleep2 100;
				set #VIP,3;						
				sc_start SC_CASH_PLUSEXP,86400*1000,$VIPs_GoldExpRate;
				sc_start SC_CASH_RECEIVEITEM,86400*1000,$VIPs_GoldItemRate; 
				skilleffect AL_INCAGI,0;
				sc_start SC_INC_AGI,1800000,10;
				dispbottom "VIP GOLD Bonus: BASE/JOB EXP +"+$VIPs_GoldExpRate+"% | DROP RATE +"+$VIPs_GoldItemRate+"%";
				delitem Gold_VIP_24,1;	
				close;
			}
			next;	
		}
		mes "You are not a VIP yet, do you want like to aquire?";
		next;
		switch ( select ("- What is VIP Package:- Buy VIP Package") ) {
		case 1:
			mes .npcname$;
			mes "There are 3 Category for VIP";
			mes "^8C7853Bronze^000000, ^A9A9A9Silver^000000 and ^D9D919Gold^000000.  All these has different previledges.";
			mes "Do you wan't to know more?";
			while(1) {
				next;
				switch ( select ("- ^8C7853Bronze^000000 Package:- ^A9A9A9Silver^000000 Package:- ^D9D919Gold^000000 Package:- Close") ) {
				case 1:
					mes "^8C7853BRONZE^000000 VIP PACKAGE";
					mes "- - - - - - - - - -";
					mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2bronze)+"^000000 Rok";
					mes "Duration: ^28bf0024 Hours Online Time^000000";
					mes "Scope: ^28bf00 Characters^000000"; 
					mes "Battle Information:";
					mes "> Base EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
					mes "> Job EXP: +^ff0000"+$VIPs_BronzeExpRate+"^000000%";
					mes "> Drops: +^ff0000"+$VIPs_BronzeItemRate+"^000000%";
					mes "> Buffs: ^28bf00Inc AGI^000000";
					break;
				case 2:
					mes "^A9A9A9SILVER^000000 VIP PACKAGE";
					mes "- - - - - - - - - -";
					mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2silver)+"^000000 Rok";
					mes "Duration: ^28bf0024 Hours Online Time^000000";
					mes "Scope: ^28bf00 Characters^000000"; 
					mes "Battle Information:";
					mes "> Base EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
					mes "> Job EXP: +^ff0000"+$VIPs_SilverExpRate+"^000000%";
					mes "> Drops: +^ff0000"+$VIPs_SilverItemRate+"^000000%";
					mes "> Buffs: ^28bf00Inc AGI^000000";
					break;
				case 3:
					mes "^D9D919GOLD^000000 VIP PACKAGE";
					mes "- - - - - - - - - -";
					mes "Cost: ^ff0000"+callfunc("F_InsertComma",.vip2gold)+"^000000 Rok";
					mes "Duration: ^28bf0024 Hours Online Time^000000";
					mes "Scope: ^28bf00 Characters^000000"; 
				mes "Special Access:";
				mes "~ ^ff0000VIP ROOM^000000";
				mes "~ ^ff0000Cloth Color NPC^000000";
				mes "~ ^ff0000Extended Hair Dye and Style^000000";
				mes "Battle Information:";
					mes "> Base EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
					mes "> Job EXP: +^ff0000"+$VIPs_GoldExpRate+"^000000%";
					mes "> Drops: +^ff0000"+$VIPs_GoldItemRate+"^000000%";
					mes "> Buffs: ^28bf00Inc AGI^000000";
					break;
				default:
					close;
					}
				}
			case 2:
				switch ( select ("- ^8C7853Bronze^000000 Package:- ^8C7853Silver^000000 Package:- ^D9D919Gold^000000 Package:- Close") ) {
				case 1:
					mes "You are buying ^8C7853Bronze^000000 VIP Package";
					mes "Do you want to proceed?";
					next;
					if (select("Yes", "No") != 1) {
						mes .npcname$;
						mes "Okay, please comeback when you are ready";
						close;
					}
					if(callfunc("F_CheckCredit") < .vip2bronze){
						mes .npcname$;
						mes "Sorry, you don't have enough Credit Points.";
						close;
					}
					callfunc("F_UpdateCredit",-.vip2bronze);
					logmes "CREDIT: -"+.vip2bronze+" VIP BRONZE";	
					sleep2 rand(100,850);
					query_sql("INSERT INTO vip_bronze (`account_id`,`start_time`,`total_sec`,`status`) VALUES ("+getcharid(3)+",NOW(),86400,'ACTIVE');");
					sleep2 100;
					set #VIP,1;						
					sc_start SC_CASH_PLUSEXP,86400*1000,$VIPs_BronzeExpRate;
					sc_start SC_CASH_RECEIVEITEM,86400*1000,$VIPs_BronzeItemRate; 
					skilleffect AL_INCAGI,0;
					sc_start SC_INC_AGI,1800000,10;
					//specialeffect(486, AREA, playerattached());
					dispbottom "VIP BRONZE Bonus: BASE/JOB EXP +"+$VIPs_BronzeExpRate+"% | DROP RATE +"+$VIPs_BronzeItemRate+"%";							
					close;

				case 2:
					mes "You are buying ^8C7853Silver^000000 VIP Package";
					mes "Do you want to proceed?";
					next;
					if (select("Yes", "No") != 1) {
						mes .npcname$;
						mes "Okay, please comeback when you are ready";
						close;
					}
					if(callfunc("F_CheckCredit") < .vip2silver){
						mes .npcname$;
						mes "Sorry, you don't have enough Credit Points.";
						close;
					}
					callfunc("F_UpdateCredit",-.vip2silver);
					logmes "CREDIT: -"+.vip2silver+" VIP SILVER";	
					sleep2 rand(100,850);
					query_sql("INSERT INTO vip_silver (`account_id`,`start_time`,`total_sec`,`status`) VALUES ("+getcharid(3)+",NOW(),86400,'ACTIVE');");
					sleep2 100;
					set #VIP,2;						
					sc_start SC_CASH_PLUSEXP,86400*1000,$VIPs_SilverExpRate;
					sc_start SC_CASH_RECEIVEITEM,86400*1000,$VIPs_SilverItemRate; 
					skilleffect AL_INCAGI,0;
					sc_start SC_INC_AGI,1800000,10;
					//specialeffect(485, AREA, playerattached());
					dispbottom "VIP SILVER Bonus: BASE/JOB EXP +"+$VIPs_SilverExpRate+"% | DROP RATE +"+$VIPs_SilverItemRate+"%";							
					close;

				case 3:
					mes "You are buying ^D9D919Gold^000000 VIP Package";
					mes "Do you want to proceed?";
					next;
					if (select("Yes", "No") != 1) {
						mes .npcname$;
						mes "Okay, please comeback when you are ready";
						close;
					}
					if(callfunc("F_CheckCredit") < .vip2gold){
						mes .npcname$;
						mes "Sorry, you don't have enough Credit Points.";
						close;
					}
					callfunc("F_UpdateCredit",-.vip2gold);
					logmes "CREDIT: -"+.vip2gold+" VIP GOLD";
					sleep2 rand(100,850);
					query_sql("INSERT INTO vip_gold (`account_id`,`start_time`,`total_sec`,`status`) VALUES ("+getcharid(3)+",NOW(),86400,'ACTIVE');");
					sleep2 100;
					set #VIP,3;						
					sc_start SC_CASH_PLUSEXP,86400*1000,$VIPs_GoldExpRate;
					sc_start SC_CASH_RECEIVEITEM,86400*1000,$VIPs_GoldItemRate; 
					skilleffect AL_INCAGI,0;
					sc_start SC_INC_AGI,1800000,10;
					//specialeffect(418, AREA, playerattached());
					dispbottom "VIP GOLD Bonus: BASE/JOB EXP +"+$VIPs_GoldExpRate+"% | DROP RATE +"+$VIPs_GoldItemRate+"%";							
					close;
				default:
					close;
				}
			default:
				close;
			}
	}

OnPCLoginEvent:

	sc_end SC_CASH_PLUSEXP;	
	sc_end SC_CASH_RECEIVEITEM;

	set .@vip1,query_sql("SELECT `total_sec` FROM vip_bronze WHERE `account_id` = "+getcharid(3),.@vip1count);
	set .@vip2,query_sql("SELECT `total_sec` FROM vip_silver WHERE `account_id` = "+getcharid(3),.@vip2count);
	set .@vip3,query_sql("SELECT `total_sec` FROM vip_gold WHERE `account_id` = "+getcharid(3),.@vip3count);

	if (.@vip1) {
		set #VIP,1;
	} else if (.@vip2) {
		set #VIP,2;
	} else if (.@vip3) {
		set #VIP,3;
	} else {
		set #VIP,0;
	}

	if (#VIP==1){
		query_sql "UPDATE vip_bronze SET `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_bronze WHERE `account_id` = "+getcharid(3),.@viptime;
		if (.@viptime >= 1){
			//specialeffect(486, AREA, playerattached());	
			sc_start SC_CASH_PLUSEXP,.@viptime*1000,$VIPs_BronzeExpRate;
			sc_start SC_CASH_RECEIVEITEM,.@viptime*1000,$VIPs_BronzeItemRate;
			skilleffect AL_INCAGI,0;
			sc_start SC_INC_AGI,1800000,10;
		} else {
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			sc_end SC_INC_AGI;
			query_sql "DELETE FROM vip_bronze WHERE `account_id` = "+getcharid(3);
		}
		dispbottom "VIP BRONZE Bonus: BASE/JOB EXP +"+$VIPs_BronzeExpRate+"% | DROP RATE +"+$VIPs_BronzeItemRate+"%";
	}
	if (#VIP==2){
		query_sql "UPDATE vip_silver SET `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_silver WHERE `account_id` = "+getcharid(3),.@viptime;
		if (.@viptime >= 1){
			//specialeffect(485, AREA, playerattached());
			sc_start SC_CASH_PLUSEXP,.@viptime*1000,$VIPs_SilverExpRate;
			sc_start SC_CASH_RECEIVEITEM,.@viptime*1000,$VIPs_SilverItemRate; 
			sc_start SC_INC_AGI,1800000,10; 
		} else {
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			skilleffect AL_INCAGI,0;
			sc_start SC_INC_AGI,1800000,10;
			query_sql "DELETE FROM vip_silver WHERE `account_id` = "+getcharid(3);
		}
		dispbottom "VIP SILVER Bonus: BASE/JOB EXP +"+$VIPs_SilverExpRate+"% | DROP RATE +"+$VIPs_SilverItemRate+"%";
	}	

	if (#VIP==3){
		query_sql "UPDATE vip_gold SET `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_gold WHERE `account_id` = "+getcharid(3),.@viptime;
		if (.@viptime >= 1){
			//specialeffect(418, AREA, playerattached());
			sc_start SC_CASH_PLUSEXP,.@viptime*1000,$VIPs_GoldExpRate;
			sc_start SC_CASH_RECEIVEITEM,.@viptime*1000,$VIPs_GoldItemRate; 
			skilleffect AL_INCAGI,0;
			sc_start SC_INC_AGI,1800000,10;
		} else {
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			sc_end SC_INC_AGI;
			query_sql "DELETE FROM vip_gold WHERE `account_id` = "+getcharid(3);
		}
		dispbottom "VIP GOLD Bonus: BASE/JOB EXP +"+$VIPs_GoldExpRate+"% | DROP RATE +"+$VIPs_GoldItemRate+"%";
	}
	end;

OnPCLogoutEvent:
	if(#VIP == 1) {
		query_sql "UPDATE vip_bronze SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
	}
	if(#VIP == 2) {
		query_sql "UPDATE vip_silver SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
	}
	if(#VIP == 3) {
		query_sql "UPDATE vip_gold SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
	}
	end;

OnTimer60000:
	if(#VIP == 1) {
		//specialeffect(486, AREA, playerattached());
		query_sql "UPDATE vip_bronze SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_bronze WHERE `account_id` = "+getcharid(3),.@isvip;
		if (.@isvip < 1) {
			query_sql "DELETE FROM vip_bronze WHERE `account_id` = "+getcharid(3);
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			sc_end SC_INC_AGI;

		}
	}
	if(#VIP == 2) {
		//specialeffect(485, AREA, playerattached());
		query_sql "UPDATE vip_silver SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_silver WHERE `account_id` = "+getcharid(3),.@isvip;
		if (.@isvip < 1) {
			query_sql "DELETE FROM vip_silver WHERE `account_id` = "+getcharid(3);
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			sc_end SC_INC_AGI;

		}
	}

	if(#VIP == 3) {
		//specialeffect(418, AREA, playerattached());
		query_sql "UPDATE vip_gold SET `total_sec` = `total_sec` - TIMESTAMPDIFF(SECOND, `start_time`,  NOW()), `start_time` = NOW() WHERE `account_id` = "+getcharid(3);
		query_sql "SELECT `total_sec` FROM vip_gold WHERE `account_id` = "+getcharid(3),.@isvip;
		if (.@isvip < 1) {
			query_sql "DELETE FROM vip_gold WHERE `account_id` = "+getcharid(3);
			set #VIP,0;
			sc_end SC_CASH_PLUSEXP;	
			sc_end SC_CASH_RECEIVEITEM;
			sc_end SC_INC_AGI;
		}
	}
	initnpctimer;
	end;

OnInit:
	//cost
	set .vipbronze,5000;
	set .vipsilver,10000;
	set .vipgold,15000;

	set .vip2bronze,1000;
	set .vip2silver,2000;
	set .vip2gold,3000;

	set .timelimit,10080;
	set .npcname$,"^FF0000VIP Service^000000";

	//set $VIPs_BronzeExpRate,10;		// VIP Gold Exp Boost in % ( 1 = 1% )			*
	//set $VIPs_SilverExpRate,25;		// VIP Silver Exp Boost in % ( 1 = 1% )			*
	//set $VIPs_GoldExpRate,50;		// VIP Platinum Exp Boost in % ( 1 = 1% )		*
	//set $VIPs_BronzeItemRate,10;		// VIP Gold Item Drop Boost in % ( 1 = 1% )		*
	//set $VIPs_SilverItemRate,20;		// VIP Silver Item Drop Boost in % ( 1 = 1% )		*
	//set $VIPs_GoldItemRate,30;		// VIP Platinum Item Drop Boost in % ( 1 = 1%)		*

	set $VIPs_BronzeExpRate,20;		// VIP Gold Exp Boost in % ( 1 = 1% )			*
	set $VIPs_SilverExpRate,50;		// VIP Silver Exp Boost in % ( 1 = 1% )			*
	set $VIPs_GoldExpRate,100;		// VIP Platinum Exp Boost in % ( 1 = 1% )		*
	set $VIPs_BronzeItemRate,20;		// VIP Gold Item Drop Boost in % ( 1 = 1% )		*
	set $VIPs_SilverItemRate,40;		// VIP Silver Item Drop Boost in % ( 1 = 1% )		*
	set $VIPs_GoldItemRate,60;		// VIP Platinum Item Drop Boost in % ( 1 = 1%)		*


	set .BronzeExpRate,10;		// VIP Gold Exp Boost in % ( 1 = 1% )			*
	set .SilverExpRate,25;		// VIP Silver Exp Boost in % ( 1 = 1% )			*
	set .GoldExpRate,50;		// VIP Platinum Exp Boost in % ( 1 = 1% )		*
	set .BronzeItemRate,10;		// VIP Gold Item Drop Boost in % ( 1 = 1% )		*
	set .SilverItemRate,20;		// VIP Silver Item Drop Boost in % ( 1 = 1% )		*
	set .GoldItemRate,30;		// VIP Platinum Item Drop Boost in % ( 1 = 1%)		*

	end;

}

