try this
prt_in,118,37,5 script Vote Shop 868,{
set .@count, query_sql("SELECT `amount` FROM ea_voting WHERE `account_id` = " + getcharid(3), .@VotingPoints);
set @VotingPoints, .@VotingPoints;
message strcharinfo(0),"You currently have [ "+ @VotingPoints +" ] Vote Points.";
message strcharinfo(0),"Vote Points are used to buy from me even if the windows displays 'Z'.";
message strcharinfo(0),"You can get Vote Points by Voting from our website ";
callshop "Donator_SHOP#03",1;
npcshopattach "Donator_SHOP#03";
end;
OnBuyItem:
getinventorylist;
set .@tmp_weight, 0;
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
for(set @j,0; @j < getarraysize(.POD_ITEMS); set @j,@j+2) {
if(.POD_ITEMS[@j] == @bought_nameid[@i]) {
set @itemcost,(.POD_ITEMS[(@j+1)]*@bought_quantity[@i]);
set @totalcost,(@totalcost+@itemcost);
set .@tmp_weight, .@tmp_weight +(getiteminfo(@bought_nameid[@i], 6) * @bought_quantity[@i]);
break;
}
}
}
if (@inventorylist_count > MAX_INVENTORY)
{
message strcharinfo(0),"Over max inventory";
end;
}
if ((Weight + .@tmp_weight) > MaxWeight)
{
message strcharinfo(0),"Over max weight";
end;
}
set .@count, query_sql("SELECT `amount` FROM ea_voting WHERE `account_id` = " + getcharid(3), .@VotingPoints);
set @VotingPoints, .@VotingPoints;
if(@totalcost > @VotingPoints) {
message strcharinfo(0),"You don't have enough Vote Points. Relog to be able to buy again with correct Vote Points.";
end;
} else {
for(set @i,0; @i < getarraysize(@bought_nameid); set @i,@i+1) {
getitem @bought_nameid[@i],@bought_quantity[@i];
query_sql "INSERT INTO `votepointlog` VALUES ( NULL,"+getcharid(3)+",'"+ escape_sql(strcharinfo(0)) +"',"+@bought_nameid[@i]+","+@bought_quantity[@i]+",'KAFRAPOINTS',NOW() )";
}
set @VotingPoints,@VotingPoints-@totalcost;
query_sql "UPDATE ea_voting SET amount = " + @VotingPoints + " WHERE account_id = " + getcharid(3);
message strcharinfo(0),"You now have ["+@VotingPoints+"] Vote Points left. Get more Vote Points by Voting from our website ";
}
set @totalcost,0;
deletearray @bought_nameid[0],128;
deletearray @bought_quantity[0],128;
sleep2 1000;
message strcharinfo(0),"Trade Information is Logged for Security Reason(s). No return no exchange.";
end;
OnInit:
waitingroom strnpcinfo(2) + "" + strnpcinfo(1)+"",0;
query_sql "CREATE TABLE IF NOT EXISTS `votepointlog` (`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";
npcshopdelitem "Donator_SHOP#03",677;
setarray .POD_ITEMS[0],12210,80,12103,80,12214,80; // Input as many items as you want (item::price)
set .table, "ea_voting";
for(set .@i,0; .@i < getarraysize(.POD_ITEMS); set .@i,.@i+2) {
npcshopadditem "Donator_SHOP#03",.POD_ITEMS[.@i],.POD_ITEMS[(.@i+1)];
}
}
- shop Donator_SHOP#03 139,677:100