yuhsing

Untitled

Feb 18th, 2013
47
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 10.21 KB | None | 0 0
  1.  
  2. // 1. 3v3 an 5v5 menu to choose from
  3. // 2. Party leader must already have party of 3 or 5 so he can talk to NPC to register.
  4. // 3. If he still do not have party the NPC will say to make party with 3 or 5 members.
  5. // 4. Once he registers the NPC will announce that party (partyname) is waiting for a 3v3 or 5v5 event (whatever he registered on)
  6. // 5. Announcement will be every minute until 15 mins then cancel the registration. Cancellation of registration is also announced when after 15 mins.
  7. // 6. used maps will be guild_vs1-3 and guild_vs2-2. The first to register will choose which map to use and it will be included in the announcement.
  8. // 7. Now the joining party with 3 or 5 members will talk to NPC and if they are complete they are accepted. if they are not complete then the NPC will say to make party with 3 or 5 members (whatever is needed by the first registered party).
  9. // 8. Both teams will be warped at the same time and that is already the start of the match. But Announcement first of "In 1 minute both party A (partyname) and Party B (partyname) will be warped to the Arena and start the match.". Then after 1 minute countdown of "Party recalling in 5", 4 3 2 1 before warp.
  10. // 9. both party leaders will have to pay 3 pcs or 5pcs item 7179 upon registering. Whoever wins will get all 6 pcs (or 10 pcs) 7179 from the NPC. Its like a bet match.
  11.  
  12.  
  13.  
  14. prontera,155,181,5 script Sample#myro 757,{
  15. .@gmlevel = getgmlevel();
  16. .@partyid = getcharid(1);
  17.  
  18. callsub display_event_info;
  19. next;
  20. switch( select( ( .status == 1 )?"Register":( .status == 2 )?"Join / Quit Match":"",
  21. ( .@gmlevel < .gm_level || .status )?"":"Configurations",
  22. ( .@gmlevel < .gm_level || !.status )?"":"Stop Event" ) ){
  23.  
  24. Case 1:
  25. if( getcharid(0) != getpartyleader( .@partyid,2 ) ){
  26. mes "Only Party Leader can register.";
  27. }else if( .@partyid == .team[0] ){
  28. if( !.team[1] ){
  29. if( select("Quit Match","Cancel") == 1 ){
  30. .team[0] = 0;
  31. .status = 1;
  32. stopnpctimer;
  33. if( .amount && .item_id ){
  34. message strcharinfo(0),"Retrieved "+ValueConvert( .amount )+" x "+getitemname( .item_id )+".";
  35. getitem .item_id,.amount;
  36. }
  37. if( .zeny ){
  38. message strcharinfo(0),"Retrieved "+ValueConvert( .zeny )+" Zeny.";
  39. Zeny += .zeny;
  40. }
  41. }
  42.  
  43. }else{
  44. mes "Cant quit since team 2 already joined.";
  45. }
  46. close;
  47. }else{
  48.  
  49. .@count = callsub( count_party_member,.@partyid );
  50. if( .@count != .party_member ){
  51. mes "Please make a party of ^FF0000"+.party_member+" online members^000000.";
  52. mes " ";
  53. mes "You have "+.@count+" members online now.";
  54.  
  55. }else{
  56.  
  57. if( .item_id )
  58. if( countitem( .item_id ) < .amount ){
  59. mes "You need "+ValueConvert( .amount )+" x "+getitemname( .item_id );
  60. close;
  61. }else{
  62. .@amount = ( .amount * 2 );
  63. message strcharinfo(0),"Paid "+ValueConvert( .@amount )+" x "+getitemname( .item_id )+".";
  64. delitem .item_id,.@amount;
  65. }
  66.  
  67. if( .zeny )
  68. if( Zeny < .zeny ){
  69. mes "You need "+ValueConvert( .zeny )+" Zeny";
  70. close;
  71. }else{
  72. message strcharinfo(0),"Total of "+ValueConvert( .zeny )+" Zeny deducted.";
  73. Zeny -= .zeny;
  74. }
  75.  
  76. switch( .status ){
  77. Case 1:
  78. mes "You may decide the map now.";
  79. .map = select( implode( .map_name$,":" ) ) - 1;
  80. mes "Your team has been registered.";
  81. .team[0] = .@partyid;
  82. .status = 2;
  83. .minute = 0;
  84. initnpctimer;
  85. break;
  86. Case 2:
  87. mes "Your team has joined the match.";
  88. .team[1] = .@partyid;
  89. .status = 3;
  90. stopnpctimer;
  91. close2;
  92. donpcevent strnpcinfo(0)+"::OnEventStart";
  93. end;
  94. break;
  95. default:
  96. mes "Registration closed.";
  97. close;
  98. }
  99. }
  100. }
  101. break;
  102. Case 2:
  103. while( 1 ){
  104.  
  105. callsub display_event_info;
  106. next;
  107. switch( select( "Edit Party Member","Required Item","Required Zeny","^FF0000Start Event^000000" ) ){
  108. Case 1:
  109. mes "Enter the Amount of Party Member required.";
  110. mes "^777777( 0 ~ 10 )^000000";
  111. input .party_member,0,10;
  112. break;
  113. Case 2:
  114. mes "Enter item ID :";
  115. do{
  116. input .@input;
  117. }while( getitemname( .@input ) == "null" );
  118. mes "Enter Amount : "+getitemname( .@input );
  119. mes "^777777( 0 ~ "+ValueConvert( 30000 )+" )^000000";
  120. input .amount,0,30000;
  121. if( .amount ) .item_id = .@input;
  122. break;
  123. Case 3:
  124. mes "Enter Zeny amount :";
  125. mes "^777777( 0 ~ "+ValueConvert( 10000000 )+" )^000000";
  126. input .zeny,0,10000000;
  127. break;
  128. Case 4:
  129. if( .party_member < 1 ){
  130. mes "^FF0000Invalid^000000. Minimum 1 Party Member.";
  131. }else if( !.amount && !.zeny ){
  132. mes "^FF0000Invalid^000000. Required 1 item or Zeny.";
  133. }else{
  134. mes "Event started.";
  135. announce "An Event has been started by GM, registration are now opened.",0;
  136. .status = 1;
  137. close;
  138. }
  139. break;
  140. }
  141. next;
  142. }
  143. break;
  144. Case 3:
  145. mes "Event Cancelled";
  146. close2;
  147. announce "Event has been cancelled by GM.",0;
  148. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  149. callsub( clear_variable );
  150. end;
  151. default: break;
  152. }
  153. close;
  154.  
  155. OnInit:
  156. // Minimum GM Level to access cp.
  157. .gm_level = 80;
  158. // Map Name List
  159. setarray .map_name$,"Map 1","Map 2";
  160. setarray .map_list$,"guild_vs1-3","guild_vs2-2";
  161.  
  162. // map flag initialize
  163. .map_size = getarraysize( .map_list$ );
  164. for( .@i = 0; .@i < .map_size; .@i++ ){
  165. setmapflag .map_list$[.@i],mf_partylock;
  166. setmapflag .map_list$[.@i],mf_nogo;
  167. setmapflag .map_list$[.@i],mf_pvp;
  168. setmapflag .map_list$[.@i],mf_battleground,2;
  169. bg_updatescore .map_list$[.@i],.score[ 0 ],.score[ 1 ];
  170. }
  171.  
  172. // npc locations
  173. getmapxy( .npc_map$,.npc_x,.npc_y,1 );
  174. end;
  175.  
  176. function ValueConvert {
  177. set .@num, atoi(""+getarg(0));
  178. if ( .@num == 0 || .@num >= 2147483647 ) return getarg(0);
  179. set .@l, getstrlen(""+.@num);
  180. for ( set .@i,0; .@i < .@l; set .@i, .@i + 1 ) {
  181. set .@num$, .@num % pow(10,.@i+1) / pow(10,.@i) + .@num$;
  182. if ( (.@i+1) % 3 == 0 && .@i+1 != .@l ) set .@num$, ","+ .@num$;
  183. }
  184. return .@num$;
  185. }
  186.  
  187. display_event_info:
  188. mes "^FF0000[ PARTY MATCH EVENT ]^000000";
  189. mes "Status : ^777777"+(( !.status )?"^FF0000Not Running":( .status == 1 )?"Waiting Team 1":( .status == 2 )?"Waiting Team 2":"Running" )+"^000000";
  190. if( .status || getgmlevel() >= .gm_level ){
  191. mes "Party Member : ^777777"+.party_member+"^000000";
  192. if( .status == 2 ) mes "Location : ^777777"+.map_name$[.map]+"^000000";
  193. }
  194. mes " ";
  195. if( .amount ) mes "Required Item : ^777777"+ValueConvert( .amount )+" x "+getitemname( .item_id )+"^000000";
  196. if( .zeny ) mes "Required Zeny : ^777777"+ValueConvert( .zeny )+" Zeny^000000";
  197. if( .status == 2 ) mes "Registration Countdown : "+( 15 - .minute )+" minutes.";
  198. return;
  199.  
  200. count_party_member:
  201. .@getarg = getarg(0);
  202.  
  203. getpartymember .@getarg,1;
  204. getpartymember .@getarg,2;
  205. for( .@i = 0; .@i < $@partymembercount; .@i++ )
  206. if( isloggedin( $@partymemberaid[.@i],$@partymembercid[.@i] ) )
  207. .@count++;
  208.  
  209. return .@count;
  210.  
  211. clear_variable:
  212. .minute = 0;
  213. .status = 0;
  214. deletearray .team;
  215. deletearray .score;
  216. end;
  217.  
  218. OnTimer60000:
  219. .minute++;
  220. if( .minute < 15 ){
  221. announce "[ Party : "+getpartyname( .team[0] )+" ] is waiting for a "+.party_member+" vs "+.party_member+" event. ( "+( 15 - .minute )+" minutes to go )",0;
  222. initnpctimer;
  223. }else{
  224. stopnpctimer;
  225. announce "Event Cancelled, 2 Teams failed to register.",0;
  226. callsub clear_variable;
  227. }
  228. end;
  229.  
  230. OnEventStart:
  231. announce "Both team success to register for the events. Get ready while you're being warped within 1 minutes.",0;
  232. // sleep 55000;
  233.  
  234. for( .@i = 5; .@i; .@i-- ){
  235. announce " ::: Warp within "+.@i+" seconds ::: ",0;
  236. sleep 1000;
  237. }
  238.  
  239. // re-count for party members..
  240. .@count[0] = callsub( count_party_member,.team[0] );
  241. .@count[1] = callsub( count_party_member,.team[1] );
  242.  
  243. // check party.
  244. if( .@count[0] != .party_member || .@count[1] != .party_member ){
  245. announce "Event stopped, one of the registered team doesnt meet the requirements of "+.party_member+" members.",0;
  246. }else{
  247. announce "Event Start now......",0;
  248. warpparty .map_list$[.map],0,0,.team[0];
  249. warpparty .map_list$[.map],0,0,.team[1];
  250. deletearray .score;
  251. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  252.  
  253. sleep 5000;
  254. mapannounce .map_list$[.map],"Kill all opponent enemy and win the events within 15 minute.",0;
  255.  
  256. sleep ( 10 * 60000 );
  257.  
  258. // check and set winner
  259. if( .score[0] > .score[1] ) .winner = .team[0];
  260. else if( .score[0] < .score[1] ) .winner = .team[1];
  261. else if( .score[0] == .score[1] ) .winner = 0;
  262.  
  263.  
  264. // if got winner
  265. if( .winner ){
  266. mapannounce .map_list$[.map],"WINNER Party : [ "+getpartyname( .winner )+" ] : Game end.",0;
  267.  
  268. .@party_leader = getpartyleader( .winner,1 );
  269. if( attachrid( .@party_leader ) ){
  270. if( .zeny ){
  271. mapannounce .map_list$[.map],"Party Leader received "+ValueConvert( .zeny )+" Zeny",bc_blue;
  272. Zeny = Zeny + ( .zeny * 2 );
  273. }
  274. if( .amount ){
  275. mapannounce .map_list$[.map],"Party Leader received "+ValueConvert( .amount )+" x "+getitemname( .item_id ),bc_blue;
  276. getitem .item_id,( .amount * 2 ),.@party_leader;
  277. }
  278. detachrid;
  279.  
  280. }else{
  281. mapannounce .map_list$[.map],"Fail to claim rewards because Party Leader not found / offline.",0;
  282. }
  283.  
  284. // draw game
  285. }else{
  286. mapannounce .map_list$[.map],"This Game is DRAW !!! No winner.",0;
  287. }
  288.  
  289. // clear map users.
  290. sleep 3500;
  291. mapwarp .map_list$[.map],.npc_map$,.npc_x,.npc_y;
  292. }
  293. callsub( clear_variable );
  294. end;
  295.  
  296. OnPCKillEvent:
  297. if( .status > 2 && strcharinfo(3) == .map_list$[.map] ){
  298. .@team = ( ( getcharid(1) == .team[0] )? 0:1 );
  299. mapannounce .map_list$[.map],"[ Party : "+getpartyname( .team[ .@team ] )+" ] "+strcharinfo(0)+" has "+( ( killedrid == getcharid(3) )?"commit suicide":"killed "+rid2name( killedrid ) )+" .",0;
  300.  
  301. .score[ .@team ]++;
  302. bg_updatescore .map_list$[.map],.score[ 0 ],.score[ 1 ];
  303.  
  304. if( attachrid( killedrid ) ){
  305. sleep2 1000;
  306. atcommand "@alive";
  307. warp "Save",0,0;
  308. detachrid;
  309. }
  310.  
  311. if( .score[0] >= .party_member || !.score[1] >= .party_member )
  312. awake strnpcinfo(0);
  313. }
  314. end;
  315. }
Advertisement
Add Comment
Please, Sign In to add comment