- shop tax10 -1,501:10000
prontera,255,55,4 script Dealer#tax10 123,{
set .@GM,80;
if (getgmlevel() >= .@GM) {
mes "Hi, Tax Collector How can i help you today?";
mes "You're not excluded from the tax though";
next;
switch(select("Open Buying Shop:Open Selling Shop:View Tax Earned:Collect Tax")){
case 1:
callshop "tax10",1;
npcshopattach "tax10";
end;
case 2:
callshop "tax10",2;
npcshopattach "tax10";
end;
case 3:
mes "Your shop have now earned a total of ^ff0000"+ $collectedtax +"^000000.";
close;
case 4:
if($collectedtax <= 0){
mes "Are you crazy you have nothing to collect!";
close;
} else {
set .@TotalCollected,.@TotalCollected + $collectedtax;
set Zeny,Zeny + .@TotalCollected;
dispbottom "You have collected a total of "+.@TotalCollected+"z Taxes";
set $collectedtax,0;
close;
}
}
}
mes "Hi, Im a traveling merchant I sell everything as cheap as it can be and buy everything as high as I can be";
mes "But every purchase/sold will have an additional 10% tax";
next;
switch(select("Open Buying Shop:Open Selling Shop:Nothing")){
case 1:
callshop "tax10",1;
npcshopattach "tax10";
end;
case 2:
callshop "tax10",2;
npcshopattach "tax10";
end;
case 3:
mes "Stop wasting my time!";
close;
}
OnBuyItem:
set .@TotalCost,0;
for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
for(set .@j,0; .@j < getarraysize( .item ); set .@j,.@j+1)
if( .item[.@j] == @bought_nameid[.@i] )
set .@TotalCost,.@TotalCost + ( .price[.@j] * @bought_quantity[.@i] );
set .@tax,((.@TotalCost * .rates) / 100);
set .@FinalCost,.@FinalCost + (.@TotalCost + .@tax);
if( Zeny >= .@FinalCost ){
set Zeny,Zeny - .@FinalCost;
for(set .@i,0; .@i < getarraysize( @bought_nameid ); set .@i,.@i+1)
getitem @bought_nameid[.@i],@bought_quantity[.@i];
set $collectedtax,$collectedtax + .@tax;
dispbottom "You have paid an additional "+.@tax+"z for this purchase";
close;
} else {
set .@lack,.@lack + (.@FinalCost - Zeny);
mes "Your zeny is not enough for this purchase";
dispbottom "You need "+.@lack+"z more for this purchase";
close;
}
OnSellItem:
set .@TotalEarn,0;
for(set .@j,0; .@j < getarraysize( .bitem ); set .@j,.@j+1)
if( @sold_nameid[.@i] == .bitem[.@j] ) {
set .@TotalEarn,.@TotalEarn + ( .bprice[.@j] * @sold_quantity[.@i] );
set .@btax,.@btax + ((.@TotalEarn * .rates) / 100);
set .@FinalEarn,.@FinalEarn + (.@TotalEarn - .@btax);
set Zeny,Zeny + .@FinalEarn;
for(set .@i,0; .@i < getarraysize( @sold_nameid ); set .@i,.@i+1)
delitem @sold_nameid[.@i],@sold_quantity[.@i];
set $collectedtax,$collectedtax + .@btax;
dispbottom "Your Total Earnings is "+.@FinalEarn+".";
dispbottom "You earnings have been reduced by "+.@tax+"z because of the 10% tax";
close;
} else {
mes "Sorry I dont buy that kind of item";
close;
}
OnInit:
set .rates,10; //set tax here
setarray .item[0],501,502,503;
setarray .price[0],10000,15000,20000;
setarray .bitem[0],748,969;
setarray .bprice[0],27500,100000;
npcshopitem "tax_Shop",512,1000;
npcshopdelitem "tax_Shop",512;
for(set .@i,0; .@i < getarraysize( .item ); set .@i,.@i+1)
npcshopadditem "tax10",.item[.@i],.price[.@i];
end;
}
test this and give me feedback :)) apparently i cant make all selling items have tax(i cant think of a logic for it) so just add the items you want to be sellable in the shop in
bitem and the bprice for the price of it :))