Jump to content
  • 0

mvp point and shop


Question

11 answers to this question

Recommended Posts

  • 0
Posted

I have HERE (Euphy's MVP Ladder v1.3) BUT I customize it with a SHOP. ENJOY!!!!:meow:

// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
// * ~~~~~~~~  Euphy's MVP Ladder v1.3  ~~~~~~~~ *
// * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ *
 
bro_mall,113,127,3	script	MVP Ladder	4_m_bosscat,{
	mes "[Rank MVP]";
	mes "Hello.";
	mes "What are you doing here?";
	next;
	switch(select("Check Ranking.:My points.:Exchange Coin.:Nothing...")) {
		case 1:
			mes "[Rank MVP]";
			query_sql("SELECT char_id, CAST(`value` AS SIGNED) FROM `char_reg_num` WHERE `key` = 'MVP_Rank' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 20",.@cid,.@value);
			for(set .@i,0; .@i<getarraysize(.@cid); set .@i,.@i+1) {
				query_sql("SELECT `name` FROM `char` WHERE char_id = "+.@cid[.@i]+";",.@j$);
				set .@name$[.@i], .@j$;
			}
			if (!getarraysize(.@cid))
				mes "The rankings are empty.";
			else for(set .@i,0; .@i<getarraysize(.@cid); set .@i,.@i+1)
			mes "["+(.@i+1)+"] "+.@name$[.@i]+" ~ "+.@value[.@i]+" kills";
			close;
			
		case 2:
			mes "[Rank MVP]";
			mes "You killed "+((MVP_Rank)?"^0055FF"+MVP_Rank:"no")+"^000000 MVP"+((MVP_Rank == 1)?".":"s.");
			close;
		case 3:
			goto H_menu;
			//Item Menu ================================================
			H_menu:
				menu
				"Elunium",R_elu,
				"Oridecon",R_ori,
				"(Costume)There is Somthing (7days)",R_rtis,
				"(Costume)There is Somthing",R_tis,
				"(Costume)Red Wind Hat (7days)",R_rwh,
				"(Costume)Red Wind Hat",R_wh,
				"(Costume)12th Anniversary Fairy Ears (7days)",R_r12,
				"(Costume)12th Anniversary Fairy Ears",R_12,
				"(Costume)Ninja Scroll (7days)",R_rns,
				"(Costume)Ninja Scroll",R_ns,
				"(Costume)Gang Scarf (7days)",R_rgs,
				"(Costume)Gang Scarf",R_gs,
				"(Costume)Holy Mom Love (7days)",R_rhm,
				"(Costume)Holy Mom Love",R_hm,
				"(Costume)Bread Bag (7days)",R_rbb,
				"(Costume)Bread Bag",R_bb,
				"(Costume)Diadem (7days)",R_rdia,
				"(Costume)Diadem",R_dia,
				"(Costume)Ascension Black Dragon (7days)",R_rasc,
				"(Costume)Ascension Black Dragon",R_asc,
				"(Costume)Marcher Hat (7days)",R_rmh,
				"(Costume)Marcher Hat",R_mh,
				"Cancel",H_cancel;
			//Required =================================================
			R_elu:
				next;
				mes "1x MVP Coin";
				menu "Make",M_elu,"Return to Menu",H_menu;
			R_ori:
				next;
				mes "1x MVP Coin";
				menu "Make",M_ori,"Return to Menu",H_menu;
			R_rtis:
				next;
				mes "15x MVP Coin";
				menu "Make",M_rtis,"Return to Menu",H_menu;
			R_tis:
				next;
				mes "60x MVP Coin";
				menu "Make",M_tis,"Return to Menu",H_menu;
			R_rwh:
				next;
				mes "5x MVP Coin";
				menu "Make",M_rwh,"Return to Menu",H_menu;
			R_wh:
				next;
				mes "30x MVP Coin";
				menu "Make",M_wh,"Return to Menu",H_menu;
			R_r12:
				next;
				mes "15x MVP Coin";
				menu "Make",M_r12,"Return to Menu",H_menu;
			R_12:
				next;
				mes "50x MVP Coin";
				menu "Make",M_12,"Return to Menu",H_menu;
			R_rns:
				next;
				mes "9x MVP Coin";
				menu "Make",M_rns,"Return to Menu",H_menu;
			R_ns:
				next;
				mes "35x MVP Coin";
				menu "Make",M_ns,"Return to Menu",H_menu;
			R_rgs:
				next;
				mes "10x MVP Coin";
				menu "Make",M_rgs,"Return to Menu",H_menu;
			R_gs:	
				next;
				mes "35x MVP Coin";
				menu "Make",M_gs,"Return to Menu",H_menu;
			R_rhm:	
				next;
				mes "5x MVP Coin";
				menu "Make",M_rhm,"Return to Menu",H_menu;
			R_hm:
				next;
				mes "30x MVP Coin";
				menu "Make",M_hm,"Return to Menu",H_menu;
			R_rbb:
				next;
				mes "5x MVP Coin";
				menu "Make",M_rbb,"Return to Menu",H_menu;
			R_bb:
				next;
				mes "30x MVP Coin";
				menu "Make",M_bb,"Return to Menu",H_menu;
			R_rdia:
				next;
				mes "5x MVP Coin";
				menu "Make",M_rdia,"Return to Menu",H_menu;
			R_dia:
				next;
				mes "30x MVP Coin";
				menu "Make",M_dia,"Return to Menu",H_menu;
			R_rasc:
				next;
				mes "5x MVP Coin";
				menu "Make",M_rasc,"Return to Menu",H_menu;
			R_asc:
				next;
				mes "30x MVP Coin";
				menu "Make",M_asc,"Return to Menu",H_menu;
			R_rmh:
				next;
				mes "5x MVP Coin";
				menu "Make",M_rmh,"Return to Menu",H_menu;
			R_mh:
				next;
				mes "30x MVP Coin";
				menu "Make",M_mh,"Return to Menu",H_menu;
				
			//Make Item ================================================
			M_elu:
				if(countitem(7929)<1 )
				goto M_insufficient;
				delitem 7929,1;
				getitem 985,1;
			close;
			M_ori:
				if(countitem(7929)<1 )
				goto M_insufficient;
				delitem 7929,1;
				getitem 984,1;
			close;
			M_rtis:
				if(countitem(7929)<15 )
				goto M_insufficient;
				delitem 7929,15;
				rentitem 20183,604800;
			close;
			M_tis:
				if(countitem(7929)<60 )
				goto M_insufficient;
				delitem 7929,60;
				getitem 20183,1;
			close;
			M_rwh:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19579,604800;
			close;
			M_wh:
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19579,1;
			close;
			M_r12:
				if(countitem(7929)<15 )
				goto M_insufficient;
				delitem 7929,15;
				rentitem 20136,604800;
			close;
			M_12:
				if(countitem(7929)<50 )
				goto M_insufficient;
				delitem 7929,50;
				getitem 20136,1;
			close;
			M_rns:
				if(countitem(7929)<9 )
				goto M_insufficient;
				delitem 7929,9;
				rentitem 19606,604800;
			close;
			M_ns:
				if(countitem(7929)<35 )
				goto M_insufficient;
				delitem 7929,35;
				getitem 19606,1;
			close;
			M_rgs:
				if(countitem(7929)<10 )
				goto M_insufficient;
				delitem 7929,10;
				rentitem 19605,604800;
			close;
			M_gs:
				if(countitem(7929)<35 )
				goto M_insufficient;
				delitem 7929,35;
				getitem 19605,1;
			close;
			M_rhm:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19756,604800;
			close;
			M_hm:
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19756,1;
			close;
			M_rbb:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19725,604800;
			close;
			M_bb:
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19725,1;
			close;		
			M_rdia:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19748,604800;
			close;
			M_dia:
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19748,1;
			close;
			M_rasc:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19575,604800;
			close;	
			M_asc:	
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19575,1;
			close;
			M_rmh:
				if(countitem(7929)<5 )
				goto M_insufficient;
				delitem 7929,5;
				rentitem 19653,604800;
			close;
			M_mh:	
				if(countitem(7929)<30 )
				goto M_insufficient;
				delitem 7929,30;
				getitem 19653,1;
			close;
				
			//Insufficient Coin ========================================
			M_insufficient:
			next;
			mes "You don't have the enough coin.";
			mes "Please come back when you do...";
			menu "Return to Main Menu",H_menu,"Leave",H_cancel;
			close;
			//Cancel ===================================================
			H_cancel:
			close;
				
		case 4:
			close;
	}
 
OnNPCKillEvent:
	if (getmonsterinfo(killedrid,22)) {
		set MVP_Rank, MVP_Rank+1;
	if (MVP_Rank == 1)
		query_sql("INSERT INTO `char_reg_num` (`char_id`,`key`,`index`,`value`) VALUES ("+getcharid(0)+",'MVP_Rank','0',1)");
	else
		query_sql("UPDATE `char_reg_num` SET `value` = '"+MVP_Rank+"' WHERE char_id = "+getcharid(0)+" AND `key` ='MVP_Rank'");
		dispbottom "~ You killed "+MVP_Rank+" MVP"+((MVP_Rank == 1)?"":"s")+". ~";
		//dispbottom " ~ Reward: Cash +15 ~ ";
		//set #CASHPOINTS, #CASHPOINTS + 15;
		dispbottom " ~ Reward: BOP ~ ";
		getitem 7929,1; //<<< THIS IS THE COIN REWARD FOR MVP ONLY<<<<<<<<<<<<
		specialeffect2 313;
	}
	end;
}

 

  • Love 1
  • 0
Posted

here you try this 

MVP points script every mvp you killed you will get 1 MVP point

-	script	MonsterKill	-1,{
OnNPCKillEvent:
	if( getmonsterinfo(killedrid, MOB_MVPEXP) ){
	set #MVPPoint,#MVPPoint+1;
	dispbottom "Gained 1 MVP Points. Total : "+ #MVPPoint +" MVP Points.";
	}
}

now this is for MVP shop with only MVP Points currency only credits to original maker of this script i just modified some lines

 

// Settings :
//	-	Only required to edit the ShopSetting() Function
//			Notes : You may also add / remove Menu ( If any ) 
//	-	Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" )
//			Ex. of Variable.	->	Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable
//	-	ERROR Message are used to show Invalid Settings in your NPC.


// Leave this alone...
-	shop	MVP_Shop	-1,512:100


Flaris,111,80,4	script	MVP Exchanger Shop	4_TREASURE_BOX,{
function ShopSettings;
function ValidateCost;
function CurrencyInfo;
function ClearData;
function ValueConvert;
function ErrorNotice;

mes "Welcome this is MVP Shop from the Menu may purchase using ^FF0000MVP Points or MVP Voucher^000000.";
mes "^00FF00____________________________^000000";
mes "So,Which shop you would like to look at it";
next;
// Menu Selection
select("MVP Points");

ClearData();
ShopSettings( @menu );
npcshopitem "MVP_Shop",512,100;
npcshopdelitem "MVP_Shop",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
	npcshopadditem "MVP_Shop",@ItemLists[.@i],@ItemCost[.@i];
mes "Okay...wait awhile";
mes "^00FF00____________________________^000000";
CurrencyInfo( @Currency$ );
mes "^00FF00____________________________^000000";
callshop "MVP_Shop",1;
npcshopattach "MVP_Shop";
end;


function	ShopSettings	{
	switch( getarg(0) ){
		case 1:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"#MVPPoint";
			// Item ID Lists
			setarray @ItemLists[0],20724,2137,2168,2182,2196,28915,28916,28920,2177,13090,5597,5289,5555,5766,5405,19118,19126,22047,15117,19914,5013,18509,5495,18652,18657,18938,18576,5564,5966,5918,18865,5969,5968,5498,5967,28322,28321,16483,18895,13811,2576,28902,18121,1996,19825,28605,13328,20467,20749,5214,18522,5379,5480,5344,18511,5421,5664,18666,5462,18505,19655,19824,20170,19936,5506,20432,20381,19158,19559,18742,20399,20071,20285,19584,5359,5211,18656,18673,5208,18508,5361,5377,19095,5516,5467,5481,5654,5475,5985,18536,5463,5362,5767,5548,5574,5786,5788,5389,18603,2589,6228,7776,2871,2898,1841,16039,1298,2020,13313,1989,1990,2989,28010,2027,16033,21019,16030,16032,16031,28010,18123,1935,2988,2989,1990,1841;
			// Item Price
			setarray @ItemCost[0],1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000;
			break;
		default:
			ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." );
			close;
	}
	
	
if( @Currency$ == "" )
	ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." );
if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) )
	ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." );
return;
}

function	ErrorNotice	{
	mes "^FF0000ERROR^000000 - "+getarg(0);
	mes "^00FF00____________________________^000000";
	mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !";
	close;
}

function	CurrencyInfo	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000";
	}else if( getitemname( atoi( getarg(0) ) ) == "null" ){
		mes "Variable Currency : ^FF0000"+getarg(0)+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000";
	}
return;
}

function	ValidateCost	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1;
	}else{
		if( getd( getarg(0) ) < getarg(1) ) return 1;
	}
return 0;
}

function ClearData	{
	set @Currency$,"";
	set @TotalCost,0;
	deletearray @bought_nameid[0],getarraysize( @bought_nameid );
	deletearray @bought_quantity[0],getarraysize( @bought_quantity );
	deletearray @ItemLists[0],getarraysize( @ItemLists );
	deletearray @ItemCost[0],getarraysize( @ItemCost );
return;
}

function	ValueConvert	{
	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$;
}

OnBuyItem:
	ShopSettings( @menu );
	for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
		for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)
			if( @ItemLists[@j] == @bought_nameid[@i] )
			set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] );
	mes "^FF0000       BILLING LIST^000000";
	mes "^00FF00____________________________^000000";
	for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )
			mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
	mes "^00FF00____________________________^000000";

	if( getitemname( atoi( @Currency$ ) ) != "null" )
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";
	else if( getitemname( atoi( @Currency$ ) ) == "null" ){
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";
	}
	
	mes "^00FF00____________________________^000000";
	if( ValidateCost( @Currency$,@TotalCost ) ){
		if( getitemname( atoi( @Currency$ ) ) != "null" )
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+getitemname( atoi( @Currency$ ) )+"^000000";
		else{
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000";
		}
	}else{
		if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){
			if( getitemname( atoi( @Currency$ ) ) != "null" )
				delitem atoi( @Currency$ ),@TotalCost;
			else{
				set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost;
			}
			for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
				getitem @bought_nameid[@i],@bought_quantity[@i];
			message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items.";
			mes "Thank you for shopping.";
		}
	}
ClearData();
close;

}

 Enjoy

  • Love 1
  • 0
Posted
On 2017/10/6 at 11:35 AM, Quesooo said:

here you try this 

MVP points script every mvp you killed you will get 1 MVP point


-	script	MonsterKill	-1,{
OnNPCKillEvent:
	if( getmonsterinfo(killedrid, MOB_MVPEXP) ){
	set #MVPPoint,#MVPPoint+1;
	dispbottom "Gained 1 MVP Points. Total : "+ #MVPPoint +" MVP Points.";
	}
}

now this is for MVP shop with only MVP Points currency only credits to original maker of this script i just modified some lines

 


// Settings :
//	-	Only required to edit the ShopSetting() Function
//			Notes : You may also add / remove Menu ( If any ) 
//	-	Shop Currency can be either ItemID or Variable Name, but must write within Quotation Marks ( "" )
//			Ex. of Variable.	->	Zeny , #CASHPOINTS , #KAFRAPOINTS , CustomVariable , #CustomVariable
//	-	ERROR Message are used to show Invalid Settings in your NPC.


// Leave this alone...
-	shop	MVP_Shop	-1,512:100


Flaris,111,80,4	script	MVP Exchanger Shop	4_TREASURE_BOX,{
function ShopSettings;
function ValidateCost;
function CurrencyInfo;
function ClearData;
function ValueConvert;
function ErrorNotice;

mes "Welcome this is MVP Shop from the Menu may purchase using ^FF0000MVP Points or MVP Voucher^000000.";
mes "^00FF00____________________________^000000";
mes "So,Which shop you would like to look at it";
next;
// Menu Selection
select("MVP Points");

ClearData();
ShopSettings( @menu );
npcshopitem "MVP_Shop",512,100;
npcshopdelitem "MVP_Shop",512;
for(set .@i,0; .@i < getarraysize( @ItemLists ); set .@i,.@i+1)
	npcshopadditem "MVP_Shop",@ItemLists[.@i],@ItemCost[.@i];
mes "Okay...wait awhile";
mes "^00FF00____________________________^000000";
CurrencyInfo( @Currency$ );
mes "^00FF00____________________________^000000";
callshop "MVP_Shop",1;
npcshopattach "MVP_Shop";
end;


function	ShopSettings	{
	switch( getarg(0) ){
		case 1:
			// Currency [ Item ID / Variable Name ]
			set @Currency$,"#MVPPoint";
			// Item ID Lists
			setarray @ItemLists[0],20724,2137,2168,2182,2196,28915,28916,28920,2177,13090,5597,5289,5555,5766,5405,19118,19126,22047,15117,19914,5013,18509,5495,18652,18657,18938,18576,5564,5966,5918,18865,5969,5968,5498,5967,28322,28321,16483,18895,13811,2576,28902,18121,1996,19825,28605,13328,20467,20749,5214,18522,5379,5480,5344,18511,5421,5664,18666,5462,18505,19655,19824,20170,19936,5506,20432,20381,19158,19559,18742,20399,20071,20285,19584,5359,5211,18656,18673,5208,18508,5361,5377,19095,5516,5467,5481,5654,5475,5985,18536,5463,5362,5767,5548,5574,5786,5788,5389,18603,2589,6228,7776,2871,2898,1841,16039,1298,2020,13313,1989,1990,2989,28010,2027,16033,21019,16030,16032,16031,28010,18123,1935,2988,2989,1990,1841;
			// Item Price
			setarray @ItemCost[0],1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000,1000;
			break;
		default:
			ErrorNotice( "Invalid Menu Selection for Menu "+@menu+"." );
			close;
	}
	
	
if( @Currency$ == "" )
	ErrorNotice( "Invalid Currency Setting in Menu "+@menu+" ." );
if( getarraysize( @ItemCost ) != getarraysize( @ItemLists ) || getarraysize( @ItemLists ) != getarraysize( @ItemCost ) )
	ErrorNotice( "Missing or Extra Value of Item or Cost Settings in Menu "+@menu+" ." );
return;
}

function	ErrorNotice	{
	mes "^FF0000ERROR^000000 - "+getarg(0);
	mes "^00FF00____________________________^000000";
	mes "Inform this Message to ^0000FFGame Staffs^000000 immediately !";
	close;
}

function	CurrencyInfo	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		mes "Item Currency : ^FF0000"+getitemname( atoi( getarg(0) ) )+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( countitem( atoi( getarg(0) ) ) )+"^000000";
	}else if( getitemname( atoi( getarg(0) ) ) == "null" ){
		mes "Variable Currency : ^FF0000"+getarg(0)+"^000000";
		mes "Available Amount : ^0000FF"+ValueConvert( getd( getarg(0) ) )+"^000000";
	}
return;
}

function	ValidateCost	{
	if( getitemname( atoi( getarg(0) ) ) != "null" ){
		if( countitem( atoi( getarg(0) ) ) < getarg(1) ) return 1;
	}else{
		if( getd( getarg(0) ) < getarg(1) ) return 1;
	}
return 0;
}

function ClearData	{
	set @Currency$,"";
	set @TotalCost,0;
	deletearray @bought_nameid[0],getarraysize( @bought_nameid );
	deletearray @bought_quantity[0],getarraysize( @bought_quantity );
	deletearray @ItemLists[0],getarraysize( @ItemLists );
	deletearray @ItemCost[0],getarraysize( @ItemCost );
return;
}

function	ValueConvert	{
	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$;
}

OnBuyItem:
	ShopSettings( @menu );
	for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
		for(set @j,0; @j < getarraysize( @ItemLists ); set @j,@j+1)
			if( @ItemLists[@j] == @bought_nameid[@i] )
			set @TotalCost,@TotalCost + ( @ItemCost[@j] * @bought_quantity[@i] );
	mes "^FF0000       BILLING LIST^000000";
	mes "^00FF00____________________________^000000";
	for( set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1 )
			mes "^FF0000"+@bought_quantity[@i]+" x ^0000FF"+getitemname( @bought_nameid[@i] )+"^000000";
	mes "^00FF00____________________________^000000";

	if( getitemname( atoi( @Currency$ ) ) != "null" )
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" x "+getitemname( atoi( @Currency$ ) )+"^000000";
	else if( getitemname( atoi( @Currency$ ) ) == "null" ){
		mes "Total Cost : ^0000FF"+ValueConvert( @TotalCost )+" "+@Currency$+"^000000";
	}
	
	mes "^00FF00____________________________^000000";
	if( ValidateCost( @Currency$,@TotalCost ) ){
		if( getitemname( atoi( @Currency$ ) ) != "null" )
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+getitemname( atoi( @Currency$ ) )+"^000000";
		else{
			mes "[ ^FF0000X^000000 ] Insufficient ^0000FF"+@Currency$+"^000000";
		}
	}else{
		if( select( "^0000FFPurchase^000000:Cancel" ) == 1 ){
			if( getitemname( atoi( @Currency$ ) ) != "null" )
				delitem atoi( @Currency$ ),@TotalCost;
			else{
				set getd( @Currency$ ),getd( @Currency$ ) - @TotalCost;
			}
			for(set @i,0; @i < getarraysize( @bought_nameid ); set @i,@i+1)
				getitem @bought_nameid[@i],@bought_quantity[@i];
			message strcharinfo(0),"Purchased "+getarraysize( @bought_nameid )+" Items.";
			mes "Thank you for shopping.";
		}
	}
ClearData();
close;

}

 Enjoy

 

Is it possible to use discounts?

  • 0
Posted
15 hours ago, jackalio said:

 

Is it possible to use discounts?

what do you mean discount?? by using merchants and get discounts on every prize???

 

i don't test it yet by using merchants skill

  • 0
Posted
2 minutes ago, Quesooo said:

はい、あなたはすでにそれに答える

 

私は割引がzenyでのみ動作すると思うので

 

Thank you It is a fun NPC so I will use it

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.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...