Guest User

Untitled

a guest
Oct 7th, 2012
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.01 KB | None | 0 0
  1. prontera,149,193,5 script Vote For Points 62,{
  2. if(getgmlevel()>=99)
  3. {
  4. mes "[Vote For Points - CP]";
  5. mes "Please choose your desired command.";
  6. switch(select("Add Item:Delete Item:Exchange Center"))
  7. {
  8. case 1:
  9. next;
  10. mes "[Vote For Points - CP]";
  11. mes "Enter the Item Number";
  12. input .@itemID;
  13. mes "How many Vote Points?";
  14. input .@itemPOINTS;
  15. mes "Item Name:"+getitemname(.@itemID);
  16. mes "Vote Points:"+.@itemPOINTS;
  17. next;
  18. mes "[Vote For Points = CP]";
  19. if((.@itemID>=501) && (.@itemPOINTS!=0))
  20. {
  21. query_sql "select `item_no` from `v4p_npc` where item_no='"+.@itemID+"'",.@itemNO;
  22. if(getarraysize(.@itemNO)==0)
  23. {
  24. query_sql "insert into `v4p_npc`(item_no,points) values('"+.@itemID+"','"+.@itemPOINTS+"')";
  25. mes "Item Successfully Added.";
  26. close;
  27. }
  28. else
  29. {
  30. mes "Item already exist in the database.";
  31. close;
  32. }
  33. end;
  34. }
  35. else
  36. {
  37. goto itemnotexist;
  38. }
  39. end;
  40. case 2:
  41. next;
  42. mes "[Vote For Points - CP]";
  43. query_sql "select `item_no`,`points` from `v4p_npc`",.@itemNO,.@itemPOINTS;
  44. if(.@itemNO!=0)
  45. {
  46. mes "Choose the item you want to delete.";
  47. for(set .@i,0;.@i<getarraysize(.@itemNO);set .@i,.@i+1)
  48. {
  49. if(.@i<1)
  50. set .@itemLIST$,"["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[0]);
  51. else
  52. set .@itemLIST$,.@itemLIST$+":["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[.@i]);
  53. }
  54. set .@selected, select(.@itemLIST$)-1;
  55. next;
  56. mes "[Vote For Points - CP]";
  57. mes "Are you sure you want to delete this item?";
  58. mes "Item Name:"+getitemname(.@itemNO[.@selected]);
  59. switch(select("Yes, delete this item to the list"))
  60. {
  61. case 1:
  62. query_sql "delete from `v4p_npc` where item_no='"+.@itemNO[.@selected]+"'";
  63. mes "Item successfully deleted";
  64. close;
  65. }
  66. end;
  67. }
  68. else
  69. {
  70. mes "No items found in the database.";
  71. close;
  72. }
  73. end;
  74. case 3:
  75. next;
  76. goto exchangecenter;
  77. end;
  78.  
  79. }
  80. }
  81. else
  82. {
  83. goto exchangecenter;
  84. }
  85. end;
  86.  
  87. exchangecenter:
  88. mes "[Vote For Points]";
  89. mes "Choose your desired items.";
  90. mes "=================================";
  91. query_sql "select `points` from v4p_voters_info where accountid='"+getcharid(3,strcharinfo(0))+"'",.@points;
  92. mes "Your Points:"+.@points[0];
  93. mes "=================================";
  94. query_sql "select `item_no`,`points` from `v4p_npc`",.@itemNO,.@itemPOINTS;
  95. if(.@itemNO!=0)
  96. {
  97. for(set .@i,0;.@i<getarraysize(.@itemNO);set .@i,.@i+1)
  98. {
  99. if(.@i<1)
  100. set .@itemLIST$,"["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[0]);
  101. else
  102. set .@itemLIST$,.@itemLIST$+":["+.@itemPOINTS[.@i]+" vpts] - "+getitemname(.@itemNO[.@i]);
  103. }
  104. set .@selected, select(.@itemLIST$)-1;
  105. next;
  106. mes "[Vote For Points]";
  107. mes getitemname(.@itemNO[.@selected])+" - ["+.@itemPOINTS[.@selected]+" vpts]";
  108. menu "Exchange",trade,"Back to the list",exchangecenter;
  109. end;
  110. trade:
  111. if(.@points[0]>=.@itemPOINTS[.@selected])
  112. {
  113. next;
  114. mes "[Vote For Points]";
  115. mes "Here you go. Thank you for voting RemedyRO.";
  116. query_sql "update `v4p_voters_info` set points='"+(.@points-.@itemPOINTS[.@selected])+"' where accountid='"+getcharid(3,strcharinfo(0))+"'";
  117. getitem .@itemNO[.@selected],1;
  118. announce strcharinfo(0)+" just got "+getitemname(.@itemNO[.@selected])+" by voting. Thank you for voting RemedyRO.",0;
  119. close;
  120. }
  121. else
  122. {
  123. next;
  124. mes "[Vote For Points]";
  125. mes "Issuficient vote points";
  126. close;
  127. }
  128. close;
  129. }
  130. else
  131. {
  132. mes "Sorry there are not items available for exchange.";
  133. close;
  134. }
  135. end;
  136.  
  137. itemnotexist:
  138. mes "Item doest not exist or make sure the points you assigned is not equal to zero.";
  139. close;
  140. end;
  141. }
Add Comment
Please, Sign In to add comment