· 8 years ago · Feb 28, 2018, 07:02 PM
1//voting
2
3job3_war01,30,34,4 script Vote Shop 439,{
4 message strcharinfo(0),"You currently have [ "+#KAFRAPOINTS+" ] Vote Points.";
5 callshop "Donator_SHOP#02",1;
6 npcshopattach "Donator_SHOP#02";
7 end;
8
9OnBuyItem:
10 for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
11 for(set @j,0; @j < getarraysize(.POD_ITEMS); set @j,@j+2) {
12 if(.POD_ITEMS[@j] == @bought_nameid[@i]) {
13 set @itemcost,(.POD_ITEMS[(@j+1)]*@bought_quantity[@i]);
14 set @totalcost,(@totalcost+@itemcost);
15 break;
16 }
17 }
18 }
19 if(@totalcost > #KAFRAPOINTS) {
20 message strcharinfo(0),"You don't have enough Vote Points.";
21 end;
22 } else {
23 for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
24 getitem @bought_nameid[@i],@bought_quantity[@i];
25 query_sql "INSERT INTO `pointlog` VALUES ( NULL,"+getcharid(3)+",'"+ escape_sql(strcharinfo(0)) +"',"+@bought_nameid[@i]+","+@bought_quantity[@i]+",'KAFRAPOINTS',NOW() )";
26 }
27 set #KAFRAPOINTS,#KAFRAPOINTS-@totalcost;
28 message strcharinfo(0),"You now have ["+#KAFRAPOINTS+"] Vote Points left.";
29 }
30 set @totalcost,0;
31 deletearray @bought_nameid[0],128;
32 deletearray @bought_quantity[0],128;
33 sleep2 1000;
34 message strcharinfo(0),"Trade Information is Logged for Security Reason(s).";
35 end;
36
37OnInit:
38 waitingroom strnpcinfo(2) + ". " + strnpcinfo(1)+"",0;
39 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";
40 npcshopdelitem "Donator_SHOP#02",909;
41 setarray .POD_ITEMS[0],5505,20,5270,15,5233,20,5184,15,5254,15,5292,10,5211,35,5447,15,5444,15,5185,20,5073,20,5286,20,5213,20,5359,30,5535,25,5261,25,5285,20,5495,35; // Input as many items as you want (item::price)
42
43 for(set .@i,0; .@i < getarraysize(.POD_ITEMS); set .@i,.@i+2) {
44 npcshopadditem "Donator_SHOP#02",.POD_ITEMS[.@i],.POD_ITEMS[(.@i+1)];
45 }
46}
47
48- shop Donator_SHOP#02 139,909:10