Advertisement
Guest User

Untitled

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