- shop tax_Shop -1,909:100 prontera,155,181,5 script Sample#taxshop 757,{ function getGuildLeader; set .@Guild,getGuildLeader(); if( select( "Open Shop",( .@Guild >= 0 )?"Collect Tax : ^0055FF"++" Zeny^000000":"" ) == 1 ){ mes "A Total of "+.TaxRate+"% Tax will be transfer to "+getarraysize( .CastleMap$ )+" Castle Guild equally."; callshop "tax_Shop",1; npcshopattach "tax_Shop"; end; }else{ mes "Gained total of "+getd( "$GuildTax_"+.@Guild )+" Zeny."; mes "Tax is shared equally among "+getarraysize( .CastleMap$ )+" Castle Guild."; if( select("Collect:Cancel") == 1 ){ set Zeny,Zeny + getd( "$GuildTax_"+.@Guild ); setd( "$GuildTax_"+.@Guild ),0; mes "Tax Collected."; } } close; function getGuildLeader { // Check Player is Guild Master or not. for( set .@i,0; .@i < getarraysize( .CastleMap$ ); set .@i,.@i + 1 ) if( getcharid(0) == getguildmasterid( getcastledata( .CastleMap$[.@i],1 ) ) ) retuurn .@i; return -1; } OnBuyItem: set .@TotalCost,0; // Calculate Total Cost for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1) for(set .@j,0; .@j < getarraysize( .Items ); set .@j,.@j+1) if( .Items[.@j] == @bought_nameid[.@i] ) set .@TotalCost,.@TotalCost + ( .Costs[.@j] * @bought_quantity[.@i] ); if( Zeny >= .@TotalCost ){ // Deduct Zeny + Gain Items. set Zeny,Zeny - .@TotalCost; for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1) getitem @bought_nameid[.@i],@bought_quantity[.@i]; // Assign Tax Amount equally to other Guilds. for( set .@i,0; .@i < getarraysize( .CastleMap$ ); set .@i,.@i + 1 ) setd( "$GuildTax_"+.@i ),getd( "$GuildTax_"+.@i ) + ( (( .@TotalCost * .TaxRate ) / 100 ) / getarraysize( .CastleMap$ ) ); // Notification on Total Tax Received by Guild. message strcharinfo(0),"Total Tax Received by Guild : "+(( .@TotalCost * .TaxRate ) / 100 )+" Zeny"; }else{ mes "You dont have enough Zeny..."; } close; OnInit: // Castle Map Name setarray .CastleMap$,"prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05"; // Tax Gained upon purchasing set .TaxRate,10; // Item List + Cost setarray .Items[0],607,608,512; setarray .Costs[0],100,200,300; npcshopitem "tax_Shop",512,1000; npcshopdelitem "tax_Shop",512; for(set .@i,0; .@i < getarraysize( .Items ); set .@i,.@i+1) npcshopadditem "tax_Shop",.Items[.@i],.Costs[.@i]; end; }