Advertisement
existence_dev92

pvp points shops

Aug 5th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.80 KB | None | 0 0
  1. prontera,150,150,0 script PvP Point Shop 112,{
  2. query_sql("select `pvp_points` from `login` where `account_id` = "+getcharid(3), .@pvp_points);
  3. if (.@pvp_points) message strcharinfo(0), "You have "+.@pvp_points+" PvP Points";
  4. callshop "PvP Shop",1;
  5. npcshopattach "PvP Shop";
  6. end;
  7.  
  8. OnInit:
  9. setarray .item_index, 502, 100,
  10. 503, 100;
  11. npcshopdelitem "PvP Shop",501;
  12. for (.@i = 0; .@i < getarraysize(.item_index); .@i+=2)
  13. npcshopadditem "PvP Shop", .item_index[.@i], .item_index[.@i+1];
  14. end;
  15.  
  16. OnBuyItem:
  17. for (.@i = 0; .@i < getarraysize(@bought_nameid); .@i++) {
  18. for (.@j = 0; .@j = < getarraysize(.item_index); .@j+=2) {
  19. if (@bought_nameid[.@i] == .item_index[.@j]) {
  20. .@price += .item_index[.@j+2] * @bought_quantity[.@i];
  21. .@item_ids[getarraysize(.@item_ids)] = @bought_nameid[.@i];
  22. .@item_qty[getarraysize(.@item_qty)] = @bought_quantity[.@i];
  23. }
  24. }
  25. }
  26. if (!checkweight2(.@item_ids,.@item_qty)) {
  27. mes "[PvP Point Shop]";
  28. mes "Purchase Failed!!.";
  29. mes "Purchasing these items will put you over the weight limit!";
  30. close;
  31. }
  32. query_sql("select `pvp_points` from `login` where `account_id` = "+getcharid(3), .@pvp_points);
  33. if (.@price > .@pvp_points) {
  34. mes "[PvP Point Shop]";
  35. mes "Purchase Failed!!.";
  36. mes "You do not have enough PvP Points to purchase these items!";
  37. close;
  38. }
  39. query_sql("UPDATE `login` SET `pvp_points` = `pvp_points` - "+.@price+" WHERE `account_id` = "+getcharid(3));
  40. for (.@i = 0; .@i < getarraysize(.@item_ids); .@i++)
  41. getitem .@item_ids[.@i], .@item_qty[.@i];
  42. deletearray @bought_quantity, getarraysize(@bought_quantity);
  43. deletearray @bought_nameid, getarraysize(@bought_nameid);
  44. mes "[PvP Point Shop]";
  45. mes "Purchase Success!";
  46. mes "Thanks.. "+callfunc("F_Bye");
  47. close;
  48.  
  49. }
  50.  
  51. - shop PvP Shop -1,501:-1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement