Advertisement
Guest User

Untitled

a guest
Nov 15th, 2011
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.66 KB | None | 0 0
  1. //=============Script Edited by demon57 a.k.a Albert ===============
  2. //=============Thanks to Terces===============================
  3. //=============Don't make money with this free script===============
  4. - script PvpLadder -1,{
  5. end;
  6. OnInit:
  7. // 0 = Disabled (NO)
  8. // 1 = Enable (YES)
  9. set $@languageselect, 0; //Enable/Disable language selection [English/German] (Default: 1)
  10. set $@LadderAnnounce, 0; //Enable/Disable the announcement when a char reaches a new position in the ladder (Default: 1)
  11.  
  12. set $@LadderLength, 30; //Set the length of the Ladder [!Not higher than 128!] (Default: 30)
  13. set $@LadderSteps, 10; //Set the views per page (Default: 10)
  14.  
  15. set $@LadderExpGain, 1; //Enable/Disable experience gain when reaching a new position in the ladder (*Note1)
  16. set $@LadderExp, 50; //Set Experience gain value (*Note1)
  17.  
  18. // Update v1.7.0
  19. set $@LadderZenyGain, 1; //Enable/Disable zeny gain when reaching a new position in the ladder
  20. set $@LadderZeny, 50; //Set Zeny gain value
  21. set $@LadderChatRoom, 1; //Enable/Disable an Chat Room over the NPC with the message "PvP Ladder" (Users can not enter the Chat room)
  22.  
  23. // Update v1.7.1 (Thanks to AnnieRuRu)
  24. // Added GM PvP Ladder Reset Function
  25.  
  26. // Update v1.7.2
  27. // Thanks to for the Feedback
  28. set $@LadderAskLogin, 1; //Enable/Disable that the NPC asks about the Broadcast when a Player logins / or with the Npc Chat (0 = Login Ask , 1 = Npc Chat) Related: 0
  29. }
  30.  
  31. - script PVPLADDER -1,{
  32. OnPCKillEvent:
  33. if (terces_PVP_resets != $terces_PVP_resets) {
  34. dispbottom "Please relog your character, in order to get the correct kills for you in the PVP ladder.";
  35. dispbottom "Because a GM just reset the ladder.";
  36. end;
  37. }
  38. if ( killedrid == getcharid(3) ) {
  39. set PVPDeaths, PVPDeaths +1;
  40. set #PVPDeathsAccount, #PVPDeathsAccount +1;
  41. set @PVPDeathstoday, @PVPDeathstoday +1;
  42. end;
  43. }
  44. set $@PVPcounter,$@PVPcounter+1;
  45. set getd("$@PVPKill"+$@PVPcounter),getcharid(3); //getd to avoid errors when more than 1 people kill someone
  46. attachrid(killedrid);
  47. set PVPDeaths,PVPDeaths+1;
  48. set @PVPDeathstoday,@PVPDeathstoday+1;
  49. set #PVPDeathsAccount,#PVPDeathsAccount+1;
  50. set getd("$@PVPkilledplayer"+$@PVPcounter+"$"), strcharinfo(0); //again, getd to avoid possible glitches
  51. detachrid;
  52.  
  53. attachrid(getd("$@PVPKill"+$@PVPcounter));
  54. CountKills:
  55. set PVPKills,PVPKills+1;
  56. set @PVPKillstoday,@PVPKillstoday+1;
  57. set #PVPKillsAccount,#PVPKillsAccount+1;
  58. setarray @playerstats[0],@PVPKillstoday,@PVPDeathstoday,PVPKills,PVPDeaths,#PVPKillsAccount,#PVPDeathsAccount;
  59.  
  60. l_ladder:
  61. set @considerdeath,0;
  62. for (set @PosinLadder, 0; @PosinLadder < $@LadderLength; set @PosinLadder, @PosinLadder + 1){
  63. if (PVPKills >= $terces_PVP_kills[@PosinLadder]){ //Player deserves to be in the ladder
  64. //Check if Death plays a role on the position
  65. if ((PVPKills == $terces_PVP_kills[@PosinLadder]) && (PVPDeaths > $terces_PVP_deaths[@PosinLadder])) set @considerdeath,1; //Consider Deaths
  66. //Check if the player only topped his own scores
  67. if ($terces_PVP_names$[@PosinLadder] == strcharinfo(0)){
  68. set $terces_PVP_kills[@PosinLadder],PVPKills;
  69. set $terces_PVP_deaths[@PosinLadder],PVPDeaths;
  70. end;
  71. }
  72. //Moves all characters in the Ladder
  73. for (set @beginmoving, $@LadderLength; @beginmoving >= (@PosinLadder+@considerdeath); set @beginmoving, @beginmoving - 1){
  74. if ($terces_PVP_names$[@beginmoving] == strcharinfo(0)){
  75. //If the player already is in the Ladder it only has to move players between characters new position and characters old position
  76. callsub L_LadderMove,0;
  77. end;
  78. }
  79. else if (@beginmoving == (@PosinLadder+@considerdeath)){
  80. //Player is not in the Ladder and therefor it has to move all players from characters new position downwards
  81. callsub L_LadderMove,1;
  82. end;
  83. }
  84. }
  85. end;
  86. }
  87. }
  88.  
  89.  
  90. L_LadderMove:
  91. if (getarg(0) == 0) set @length,@beginmoving;
  92. if (getarg(0) == 1) set @length,$@LadderLength;
  93. for (set @movecycle, @length; @movecycle > (@PosinLadder+@considerdeath);
  94. set @movecycle, @movecycle - 1){
  95.  
  96. set $terces_PVP_names$[@movecycle],$terces_PVP_names$[(@movecycle-1)];
  97. set $terces_PVP_kills[@movecycle],$terces_PVP_kills[(@movecycle-1)];
  98. set $terces_PVP_deaths[@movecycle],$terces_PVP_deaths[(@movecycle-1)];
  99. set $terces_PVP_times[@movecycle],$terces_PVP_times[(@movecycle-1)];
  100. }
  101. //sets the character's stats in the new position
  102. set $terces_PVP_names$[(@PosinLadder+@considerdeath)],strcharinfo(0);
  103. set $terces_PVP_kills[(@PosinLadder+@considerdeath)],PVPKills;
  104. set $terces_PVP_deaths[(@PosinLadder+@considerdeath)],PVPDeaths;
  105. set $terces_PVP_times[(@PosinLadder+@considerdeath)],gettimetick(2);
  106. //Experience Gain
  107. if ($@LadderExpGain == 1){
  108. set BaseExp,BaseExp+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderExp);
  109. dispbottom "You have just been rewarded with "+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderExp)+" base experience points";
  110. }
  111. //Zeny Gain
  112. if ($@LadderZenyGain == 1){
  113. set Zeny,Zeny+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderZeny);
  114. dispbottom "You have just been rewarded with "+(($@LadderLength-((@PosinLadder+@considerdeath)-1))*$@LadderZeny)+" Zeny";
  115. }
  116. //Announcement (Setting for Char)
  117. if (pvpbroadcast == 2){
  118. announce strcharinfo(0)+" just claimed the "+((@PosinLadder+@considerdeath)+1)+". Position in the Top "+$@LadderLength+" after killing "+getd("$@PVPkilledplayer"+$@PVPcounter+"$")+".",16;
  119. }
  120. //Announcement (Setting for Account)
  121. if (#pvpbroadcast == 2){
  122. announce strcharinfo(0)+" just claimed the "+((@PosinLadder+@considerdeath)+1)+". Position in the Top "+$@LadderLength+" after killing "+getd("$@PVPkilledplayer"+$@PVPcounter+"$")+".",16;
  123. }
  124. end;
  125.  
  126. OnPCLoginEvent:
  127. if (terces_PVP_resets != $terces_PVP_resets){
  128. set PVPDeaths,0;
  129. set @PVPDeathstoday,0;
  130. set #PVPDeathsAccount,0;
  131. set PVPKills,0;
  132. set @PVPKillstoday,0;
  133. set #PVPKillsAccount,0;
  134. set terces_PVP_resets,$terces_PVP_resets;
  135. }
  136. if ($@LadderAskLogin == 0){
  137. if (#pvpbroadcast == 2) goto L_ignore;
  138. if (pvpbroadcast == 2) goto L_ignore;
  139. if (#pvpbroadcast == 1) goto L_ignore;
  140. if (pvpbroadcast == 1) goto L_ignore;
  141.  
  142. if (pvpbroadcast == 0)
  143. mes "Hi, "+strcharinfo(0)+"";
  144. mes "Me is the PvP Top Management!";
  145. mes "Let me ask you one Question and i will let you play!";
  146. menu "Later please",L_close,"Okay, fine",L_fine;
  147.  
  148. L_fine:
  149. next;
  150. mes "Well, do you want read Broadcast Messages when a Player reach a new position on the PvP Ranglist?";
  151. menu "Yeah, why not",L_accept,"No, thanks",L_accept_2,"Wtf is Broadcast?",L_broadcast;
  152.  
  153. L_accept:
  154. next;
  155. mes "Yay, thank you! ^_^";
  156. mes "Will this Setting work on all your Chars on this account or only this char?";
  157. menu "Account",L_account,"Only this char",L_char;
  158.  
  159. L_account:
  160. set #pvpbroadcast,2;
  161. next;
  162. mes "Okay, "+strcharinfo(0)+"";
  163. mes "Thank you for your time and have fun!";
  164. close;
  165.  
  166. L_char:
  167. set pvpbroadcast,2;
  168. next;
  169. mes "Okay, "+strcharinfo(0)+"";
  170. mes "Thank you for your time and have fun!";
  171. goto access_eng;
  172. close;
  173.  
  174. L_accept_2:
  175. next;
  176. mes "Yay, thank you! ^_^";
  177. mes "Will this Setting work on all your Chars on this account or only this char?";
  178. menu "Account",L_account_2,"Only this char",L_char_2;
  179.  
  180. L_close:
  181. close;
  182.  
  183. L_account_2:
  184. set #pvpbroadcast,1;
  185. next;
  186. mes "Okay, "+strcharinfo(0)+"";
  187. mes "Thank you for your time and have fun!";
  188. close;
  189.  
  190. L_char_2:
  191. set pvpbroadcast,1;
  192. next;
  193. mes "Okay, "+strcharinfo(0)+"";
  194. mes "Thank you for your time and have fun!";
  195. goto access_eng;
  196. close;
  197.  
  198.  
  199. L_broadcast:
  200. mes "Broadcasts are this yellow messages from the GMs";
  201. goto L_fine;
  202. }
  203. }
  204.  
  205. prontera,159,186,4 script PvP Ladder 57,{
  206. if ($@LadderChatRoom == 1) {
  207. waitingroom "PvP Top "+$@LadderLength+"",0; // Look on the configuration!
  208. }
  209. set @name$,"[PvP-Ladder]";
  210. //Colour of: Position Name Kills Deaths Time
  211. setarray @colour$[0], "^996600", "^006699", "^00AA00", "^FF0000", "^EE8800";
  212. if ($@LadderAskLogin == 1){
  213. if (#pvpbroadcast == 2) goto access_eng;
  214. if (pvpbroadcast == 2) goto access_eng;
  215. if (#pvpbroadcast == 1) goto access_eng;
  216. if (pvpbroadcast == 1) goto access_eng;
  217. if (pvpbroadcast == 0)
  218. mes "Hi, "+strcharinfo(0)+"";
  219. mes "Me is the PvP Top Management!";
  220. mes "Let me ask you one Question and i will let you play!";
  221. menu "Later please",L_close,"Okay, fine",L_fine;
  222.  
  223. L_fine:
  224. next;
  225. mes "Well, do you want read Broadcast Messages when a Player reach a new position on the PvP Ranglist?";
  226. menu "Yeah, why not",L_accept,"No, thanks",L_accept_2,"Wtf is Broadcast?",L_broadcast;
  227.  
  228. L_accept:
  229. next;
  230. mes "Yay, thank you! ^_^";
  231. mes "Will this Setting work on all your Chars on this account or only this char?";
  232. menu "Account",L_account,"Only this char",L_char;
  233.  
  234. L_account:
  235. set #pvpbroadcast,2;
  236. next;
  237. mes "Okay, "+strcharinfo(0)+"";
  238. mes "Thank you for your time and have fun!";
  239. close;
  240.  
  241. L_char:
  242. set pvpbroadcast,2;
  243. next;
  244. mes "Okay, "+strcharinfo(0)+"";
  245. mes "Thank you for your time and have fun!";
  246. goto access_eng;
  247. close;
  248.  
  249. L_accept_2:
  250. next;
  251. mes "Yay, thank you! ^_^";
  252. mes "Will this Setting work on all your Chars on this account or only this char?";
  253. menu "Account",L_account_2,"Only this char",L_char_2;
  254.  
  255. L_close:
  256. close;
  257.  
  258. L_account_2:
  259. set #pvpbroadcast,1;
  260. next;
  261. mes "Okay, "+strcharinfo(0)+"";
  262. mes "Thank you for your time and have fun!";
  263. close;
  264.  
  265. L_char_2:
  266. set pvpbroadcast,1;
  267. next;
  268. mes "Okay, "+strcharinfo(0)+"";
  269. mes "Thank you for your time and have fun!";
  270. goto access_eng;
  271. close;
  272.  
  273.  
  274. L_broadcast:
  275. mes "Broadcasts are this yellow messages from the GMs";
  276. goto L_fine;
  277. }
  278. access_eng:
  279. mes @name$;
  280. mes "Hello "+strcharinfo(0)+"...";
  281. mes "If you want to I can show you your PVP stats.";
  282. next;
  283. M_selection_eng:
  284. if ( getgmlevel () < 99 )
  285. menu "Show me the PVP Ladder",M_Ladder_eng,"PvP stats since my login",M_seitLogin_eng,"PvP stats of this Char",M_dieserChar_eng,"Stats of the whole account",M_vomAccount_eng,"Cancel",M_abbrechen_eng;
  286. else
  287. menu "Show me the PVP Ladder",M_Ladder_eng,"PvP stats since my login",M_seitLogin_eng,"PvP stats of this Char",M_dieserChar_eng,"Stats of the whole account",M_vomAccount_eng,"Reset Ladder",L_reset,"Cancel",M_abbrechen_eng;
  288.  
  289. M_Ladder_eng:
  290. mes "Alright...I'll show you the Top "+ $@LadderLength +" with "+$@LadderSteps+" entries per page.";
  291. mes "It'll be viewed like this:";
  292. mes @colour$[0]+"Place^000000: "+@colour$[1]+"<name>^000000 :"+@colour$[2]+"<kills>^000000:"+@colour$[3]+"<deaths>^000000 "+@colour$[4]+"<time>";
  293. next;
  294. callsub L_Ladder;
  295. goto M_selection_eng;
  296.  
  297. M_seitLogin_eng:
  298. mes @name$;
  299. mes "Your stats since your login:";
  300. mes @PVPKillstoday+"/"+@PVPDeathstoday+"(Kills/Deaths)";
  301. next;
  302. goto M_selection_eng;
  303.  
  304. M_dieserChar_eng:
  305. mes @name$;
  306. mes "Your stats of this Char:";
  307. mes PVPKills+"/"+PVPDeaths+"(Kills/Deaths)";
  308. next;
  309. goto M_selection_eng;
  310.  
  311. M_vomAccount_eng:
  312. mes @name$;
  313. mes "Your stats of the whole account:";
  314. mes #PVPKillsAccount+"/"+#PVPDeathsAccount+"(Kills/Deaths)";
  315. next;
  316. goto M_selection_eng;
  317.  
  318. M_abbrechen_eng:
  319. mes @name$;
  320. mes "OK. You can come back to me and see your stats whenever you want.";
  321. close;
  322.  
  323. L_reset:
  324. if (getgmlevel() < 99) end;
  325. mes "Do you want to reset the ladder?";
  326. if (select ("Yes","No") == 2) goto L_end;
  327. mes "Are you really really sure you want to reset it?";
  328. menu "Yes, ffs!!",-,"No",L_end;
  329. deletearray $terces_PVP_kills,128;
  330. deletearray $terces_PVP_deaths,128;
  331. deletearray $terces_PVP_names$,128;
  332. deletearray $terces_PVP_times,128;
  333. set $terces_PVP_resets,$terces_PVP_resets +1;
  334.  
  335. L_end:
  336. mes "Okay...cya";
  337. close;
  338.  
  339. L_Ladder:
  340. for (set @y,0; @y < $@LadderLength; set @y,@y+$@LadderSteps){
  341. for (set @x,@y; (@x < (@y+$@LadderSteps)) && (@x < ($@LadderLength)); set @x,@x+1){
  342. if ($terces_PVP_names$[@x] != ""){
  343. mes @colour$[0]+(@x+1)+"^000000: "+@colour$[1]+$terces_PVP_names$[@x]+"^000000 "+@colour$[2]+$terces_PVP_kills[@x]+"^000000:"+@colour$[3]+$terces_PVP_deaths[@x]+"^000000 ~ "+@colour$[4]+callfunc ("Gettime",$terces_PVP_times[@x])+"^000000";
  344. } else {
  345. mes "^DD0000"+(@x+1)+": ^006699None^000000 ";
  346. }
  347. }
  348. next;
  349. }
  350. return;
  351. }
  352.  
  353. function script Gettime {
  354. if (getarg(0)==0) return;
  355.  
  356. set @difftimedays,(gettimetick(2) - getarg(0));
  357. set @difftimehours,@difftimedays%86400;
  358. set @difftimeminutes,@difftimehours%3600;
  359. set @difftimeseconds,@difftimeminutes%60;
  360.  
  361. set @days,@difftimedays/86400;
  362. set @hours,@difftimehours/3600;
  363. set @minutes,@difftimeminutes/60;
  364. set @seconds,@difftimeseconds;
  365. set @result$,"";
  366. if(@days != 0) set @result$,@result$+@days+"d ";
  367. if(@hours != 0) set @result$,@result$+@hours+"h ";
  368. if(@minutes != 0) set @result$,@result$+@minutes+"m ";
  369. if(@seconds != 0) set @result$,@result$+@seconds+"s";
  370.  
  371. return (@result$);
  372. }
  373.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement