· 8 years ago · Feb 22, 2018, 05:56 AM
1itemmall,188,58,2 script Donation Items 437,{
2 message strcharinfo(0),"You currently have [ "+#CASHPOINTS+" ] Donation Point(s).";
3 callshop "Donator_SHOP#01",1;
4 npcshopattach "Donator_SHOP#01";
5 end;
6
7OnBuyItem:
8 for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
9 for(set @j,0; @j < getarraysize(.POD_ITEMS); set @j,@j+2) {
10 if(.POD_ITEMS[@j] == @bought_nameid[@i]) {
11 set @itemcost,(.POD_ITEMS[(@j+1)]*@bought_quantity[@i]);
12 set @totalcost,(@totalcost+@itemcost);
13 break;
14 }
15 }
16 }
17 if(@totalcost > #CASHPOINTS) {
18 message strcharinfo(0),"You don't have enough Donation Point(s).";
19 end;
20 } else {
21 for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
22 getitem @bought_nameid[@i],@bought_quantity[@i];
23 query_sql "INSERT INTO `pointlog` VALUES ( NULL,"+getcharid(3)+",'"+ escape_sql(strcharinfo(0)) +"',"+@bought_nameid[@i]+","+@bought_quantity[@i]+",'CAHSPOINTS',NOW() )";
24 }
25 set #CASHPOINTS,#CASHPOINTS-@totalcost;
26 message strcharinfo(0),"You now have [ "+#CASHPOINTS+" ] Donation Point(s) left.";
27 }
28 set @totalcost,0;
29 deletearray @bought_nameid[0],128;
30 deletearray @bought_quantity[0],128;
31 sleep2 1000;
32 message strcharinfo(0),"Trade Information is Logged for Security Reason(s).";
33 end;
34
35OnInit:
36 waitingroom strnpcinfo(2) + ". " + strnpcinfo(1)+"",0;
37 query_sql "CREATE TABLE IF NOT EXISTS `pointlog` (`id` int(11) NOT NULL auto_increment,`account_id` int(11) NOT NULL default '0',`name` varchar(30) NOT NULL default '',`item` int(11) NOT NULL default '0', `amount` int(11) NOT NULL default '1',`point` varchar(30) NOT NULL default '', `time` datetime NOT NULL default '0000-00-00 00:00:00', PRIMARY KEY (`id`), KEY `char_id` (`account_id`)) ENGINE=MyISAM";
38 npcshopdelitem "Donator_SHOP#01",5323;
39 setarray .POD_ITEMS[0],5423,65,5324,20,5372,30,5396,25,5137,60,5325,50,5592,25,5800,20,5389,20,5402,12,5401,10,5288,10,5483,6,5377,18,5361,10,5463,20,5374,120,5518,120,1228,70,13017,55,12103,2,7776,2,7807,1,13610,1,13611,1; // Input as many items as you want (item::price)
40
41 for(set .@i,0; .@i < getarraysize(.POD_ITEMS); set .@i,.@i+2) {
42 npcshopadditem "Donator_SHOP#01",.POD_ITEMS[.@i],.POD_ITEMS[(.@i+1)];
43 }
44}
45
46- shop Donator_SHOP#01 139,5423,65,5324,20,5372,30,5396,25,5137,60,5325,50,5592,25,5800,20,5389,20,5402,12,5401,10,5288,10,5483,6,5377,18,5361,10,5463,20,5374,120,5518,120,1228,70,13017,55,12103,2,7776,2,7807,1,13610,1,13611,1