Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- prontera,150,150,0 script PvP Point Shop 112,{
- query_sql("select `pvp_points` from `login` where `account_id` = "+getcharid(3), .@pvp_points);
- if (.@pvp_points) message strcharinfo(0), "You have "+.@pvp_points+" PvP Points";
- callshop "PvP Shop",1;
- npcshopattach "PvP Shop";
- end;
- OnInit:
- setarray .item_index, 502, 100,
- 503, 100;
- npcshopdelitem "PvP Shop",501;
- for (.@i = 0; .@i < getarraysize(.item_index); .@i+=2)
- npcshopadditem "PvP Shop", .item_index[.@i], .item_index[.@i+1];
- end;
- OnBuyItem:
- for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++) {
- for (.@j = 0; .@j = < getarraysize(.item_index); .@j+=2) {
- if (@bought_nameid[.@i] == .item_index[.@j]) {
- .@price += .item_index[.@j+2] * @bought_quantity[.@i];
- .@item_ids[getarraysize(.@item_ids)] = @bought_nameid[.@i];
- .@item_qty[getarraysize(.@item_qty)] = @bought_quantity[.@i];
- }
- }
- }
- if (!checkweight2(.@item_ids,.@item_qty)) {
- mes "[PvP Point Shop]";
- mes "Purchase Failed!!.";
- mes "Purchasing these items will put you over the weight limit!";
- close;
- }
- query_sql("select `pvp_points` from `login` where `account_id` = "+getcharid(3), .@pvp_points);
- if (.@price > .@pvp_points) {
- mes "[PvP Point Shop]";
- mes "Purchase Failed!!.";
- mes "You do not have enough PvP Points to purchase these items!";
- close;
- }
- query_sql("UPDATE `login` SET `pvp_points` = `pvp_points` - "+.@price+" WHERE `account_id` = "+getcharid(3));
- for (.@i = 0; .@i < getarraysize(.@item_ids); .@i++)
- getitem .@item_ids[.@i], .@item_qty[.@i];
- deletearray @bought_quantity, getarraysize(@bought_quantity);
- deletearray @bought_nameid, getarraysize(@bought_nameid);
- mes "[PvP Point Shop]";
- mes "Purchase Success!";
- mes "Thanks.. "+callfunc("F_Bye");
- close;
- }
- - shop PvP Shop -1,501:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement