icabit

mvp ladder with sql

Jul 21st, 2013
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.07 KB | None | 0 0
  1. prontera,167,230,5 script MvP Ranking 837,{
  2.  
  3. set .@npc$,"[ ^FF0000 MvP's Ranking ^000000 ]";
  4. mes .@npc$;
  5. query_sql "SELECT name, kills, points FROM mvp ORDER BY kills DESC LIMIT 10",.@name$,.@kills,.@points;
  6. for(set .@i,0;.@i<=9;set .@i,.@i+1) {
  7. mes "^0000FF"+(.@i+1)+".^000000 " +( (.@name$[.@i] == "")? "None":.@name$[.@i] )+ " - ^FF0000"+.@kills[.@i]+"^000000 Kill(s)";
  8. }
  9. mes " ";
  10. set .@npc$,"";
  11. set .@points,0;
  12. query_sql "SELECT `points` FROM `mvp` WHERE `char_id`="+getcharid(0),.@points;
  13. mes "^0000FF["+strcharinfo(0)+"'s]^000000 MvP kill(s) is ^FF0000"+.@points+"^000000 Boss Monster(s).";
  14. close;
  15.  
  16. OnInit:
  17. waitingroom "MvP's Ranking",0; // Look on the configuration!
  18. end;
  19. }
  20.  
  21. - script GlobalMvP::GlobalMvP -1,{
  22.  
  23. OnNPCKillEvent:
  24. switch(readparam(122)) {
  25. // Amon Ra
  26. case 1511:
  27. goto addpoints;
  28. end;
  29. // B_EREMES
  30. case 1647:
  31. goto addpoints;
  32. end;
  33. // Atroce
  34. case 1785:
  35. goto addpoints;
  36. end;
  37. // BACSOJIN_
  38. case 1630:
  39. goto addpoints;
  40. end;
  41. // Baphomet
  42. case 1039:
  43. goto addpoints;
  44. end;
  45. // BEELZEBUB_
  46. case 1874:
  47. goto addpoints;
  48. end;
  49. // Dark Lord
  50. case 1272:
  51. goto addpoints;
  52. end;
  53. // Detale
  54. case 1719:
  55. goto addpoints;
  56. end;
  57. // Doppelganger
  58. case 1046:
  59. goto addpoints;
  60. end;
  61. // Dracula
  62. case 1389:
  63. goto addpoints;
  64. end;
  65. // Drake
  66. case 1112:
  67. goto addpoints;
  68. end;
  69. // Eddga
  70. case 1115:
  71. goto addpoints;
  72. end;
  73. // Entweihen
  74. case 1957:
  75. goto addpoints;
  76. end;
  77. // Evil Snake Lord
  78. case 1418:
  79. goto addpoints;
  80. end;
  81. // FALLINGBISHOP
  82. case 1871:
  83. goto addpoints;
  84. end;
  85. // Garm
  86. case 1252:
  87. goto addpoints;
  88. end;
  89. // GLOOMUNDERNIGHT
  90. case 1768:
  91. goto addpoints;
  92. end;
  93. // Golden Bug
  94. case 1086:
  95. goto addpoints;
  96. end;
  97. // G_MAGALETA
  98. case 1802:
  99. goto addpoints;
  100. end;
  101. // High Priest Magaleta
  102. case 1649:
  103. goto addpoints;
  104. end;
  105. // High Wizard Katryne
  106. case 1651:
  107. goto addpoints;
  108. end;
  109. // Ifrit
  110. case 1832:
  111. goto addpoints;
  112. end;
  113. // Incantation Samurai
  114. case 1492:
  115. goto addpoints;
  116. end;
  117. // Kiel_
  118. case 1734:
  119. goto addpoints;
  120. end;
  121. // Stormy Knight
  122. case 1251:
  123. goto addpoints;
  124. end;
  125. // Ktullanux
  126. case 1779:
  127. goto addpoints;
  128. end;
  129. // Lady Tanee
  130. case 1688:
  131. goto addpoints;
  132. end;
  133. // G_SEYREN
  134. case 1640:
  135. goto addpoints;
  136. end;
  137. // Lord Knight Seyren
  138. case 1646:
  139. goto addpoints;
  140. end;
  141. // Lord of Death
  142. case 1373:
  143. goto addpoints;
  144. end;
  145. // Maya
  146. case 1147:
  147. goto addpoints;
  148. end;
  149. // Mistress
  150. case 1059:
  151. goto addpoints;
  152. end;
  153. // Moonlight flower
  154. case 1150:
  155. goto addpoints;
  156. end;
  157. // Naght Seiger
  158. case 1956:
  159. goto addpoints;
  160. end;
  161. // Orc Hero
  162. case 1087:
  163. goto addpoints;
  164. end;
  165. // Orc Lord
  166. case 1190:
  167. goto addpoints;
  168. end;
  169. // Osiris
  170. case 1038:
  171. goto addpoints;
  172. end;
  173. // Pharaoh
  174. case 1157:
  175. goto addpoints;
  176. end;
  177. // Phreeoni
  178. case 1159:
  179. goto addpoints;
  180. end;
  181. // Poripori
  182. case 1502:
  183. goto addpoints;
  184. end;
  185. // RSX
  186. case 1623:
  187. goto addpoints;
  188. end;
  189. // Sniper Shecil
  190. // Sniper Cecil
  191. case 1650:
  192. goto addpoints;
  193. end;
  194. // Tao Gunka
  195. case 1583:
  196. goto addpoints;
  197. end;
  198. // Thanatos
  199. case 1708:
  200. goto addpoints;
  201. end;
  202. // Turtle General
  203. case 1312:
  204. goto addpoints;
  205. end;
  206. // Valkyrie
  207. case 1765:
  208. goto addpoints;
  209. end;
  210. // Valkyrie rangdris
  211. case 1751:
  212. goto addpoints;
  213. end;
  214. // Vesper
  215. case 1685:
  216. goto addpoints;
  217. end;
  218. // Whitesmith Howard
  219. case 1648:
  220. goto addpoints;
  221. end;
  222. // Satan Morroc
  223. case 1917:
  224. goto addpoints;
  225. end;
  226. // Egnigem Cenia
  227. case 1658:
  228. goto addpoints;
  229. end;
  230. // Zmey Gorynych
  231. case 1885:
  232. goto addpoints;
  233. end;
  234. // Hard Rock Mamooth
  235. case 1990:
  236. goto addpoints;
  237. end;
  238. // Tendrillion
  239. case 1991:
  240. goto addpoints;
  241. end;
  242. default:
  243. end;
  244. } // End switch
  245.  
  246. addpoints:
  247. // getitem 20482,1;
  248. getmapxy(.@map$,.@x,.@y,0);
  249. if((.@map$=="06guild_01")||(.@map$=="06guild_02")||(.@map$=="06guild_03")||(.@map$=="06guild_04")||(.@map$=="06guild_05")||(.@map$=="06guild_06")||(.@map$=="06guild_07")||(.@map$=="06guild_08"))
  250. {
  251. }
  252. else
  253. {
  254. query_sql "SELECT `name` FROM `mvp` WHERE `char_id`="+getcharid(0)+"",.@name$;
  255. if ( .@name$ == "" ) { query_sql "INSERT INTO `mvp` (`char_id`,`name`,`kills`,`points`) VALUES (" + getcharid(0) + ",'" + escape_sql(strcharinfo(0)) + "',1,1)"; end; }
  256. query_sql "UPDATE `mvp` SET `kills` = (`kills` + 1), `points` = (`points` +1) WHERE `char_id`=" + getcharid(0);
  257. end;
  258.  
  259. OnInit:
  260. query_sql("CREATE TABLE IF NOT EXISTS `mvp` (`char_id` int(11) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(255) NOT NULL DEFAULT '0', `kills` int(11) unsigned NOT NULL DEFAULT '0',`points` int(11) unsigned NOT NULL DEFAULT '0', `level` int(11) unsigned NOT NULL DEFAULT '0', KEY `char_id` (`char_id`), KEY `kills` (`kills`), KEY `points` (`level`), KEY `level` (`level`)) ENGINE=MyISAM");
  261. end;
  262. }
  263. }
Advertisement
Add Comment
Please, Sign In to add comment