yuhsing

Untitled

Sep 22nd, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1.  
  2. - script bg_pk -1,{
  3. OnInit:
  4. // both red and blue team required how many player
  5. $@team_count = 5;
  6. // map that will be used.
  7. .map$ = "bat_c01";
  8. // cloth color for red team
  9. .bg_cloth_red = 2;
  10. // cloth color for blue team
  11. .bg_cloth_blue = 10;
  12.  
  13. $@bg_npc_name$ = strnpcinfo(0);
  14. setmapflag .map$,mf_loadevent;
  15. setmapflag .map$,mf_battleground;
  16. setmapflag .map$,mf_partylock;
  17. mapwarp .map$,"prontera",155,175;
  18. donpcevent "::OnBGEnable";
  19. end;
  20.  
  21. OnRedJoin:
  22. .@bg_user_count = bg_get_data( .bg_red,0 );
  23. if( .@bg_user_count == $@team_count ){
  24. kickwaitingroomall "bg_red";
  25. end;
  26. }else if( .@bg_user_count && .@bg_user_count < $@team_count ){
  27. .@count = 1;
  28. }else{
  29. .@count = $@team_count;
  30. }
  31. if( getwaitingroomstate( 0,"bg_red" ) == .@count ){
  32. if( .@count == 1 && .bg_red ){
  33. waitingroom2bg_single( .bg_red,.map$,0,0,"bg_red" );
  34. mapannounce .map$,"A Player joined RED Team. Red Team has "+bg_get_data( .bg_red,0 )+" users now.",0;
  35. }else{
  36. .bg_red = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_red" );
  37. mapannounce .map$,"Red Team joined...",0;
  38. bg_warp .bg_red,.map$,0,0;
  39. }
  40. }
  41. end;
  42.  
  43. OnBlueJoin:
  44. .@bg_user_count = bg_get_data( .bg_blue,0 );
  45. if( .@bg_user_count == $@team_count ){
  46. kickwaitingroomall "bg_blue";
  47. end;
  48. }else if( .@bg_user_count && .@bg_user_count < $@team_count ){
  49. .@count = 1;
  50. }else{
  51. .@count = $@team_count;
  52. }
  53. if( getwaitingroomstate( 0,"bg_blue" ) == .@count ){
  54. if( .@count == 1 && .bg_blue ){
  55. waitingroom2bg_single( .bg_blue,.map$,0,0,"bg_red" );
  56. mapannounce .map$,"A Player joined BLUE Team. BLUE Team has "+bg_get_data( .bg_blue,0 )+" users now.",0;
  57. }else{
  58. .bg_blue = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_blue" );
  59. mapannounce .map$,"Blue Team joined...",0;
  60. bg_warp .bg_blue,.map$,0,0;
  61. }
  62. }
  63. end;
  64.  
  65. OnSoloJoin:
  66. .@bg_solo = waitingroom2bg( .map$,0,0,$@bg_npc_name$+"::OnQuit",$@bg_npc_name$+"::OnDead","bg_solo" );
  67. mapannounce .map$,"A Solo Player joined.",0;
  68. bg_warp .@bg_solo,.map$,0,0;
  69. end;
  70.  
  71. OnDead:
  72. .@bg_id = getcharid(4);
  73. if( .@bg_id == .bg_red || .@bg_id == .bg_blue )
  74. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  75. warp "SavePoint",0,0;
  76. OnQuit:
  77. .@bg_id = getcharid(4);
  78. bg_leave;
  79. if( .@bg_id == .bg_red ){
  80. announce "BG Red Team have an empty slot since a player just left the team.",0;
  81. }else if( .@bg_id == .bg_blue ){
  82. announce "BG Blue Team have an empty slot since a player just left the team.",0;
  83. }
  84. if( bg_get_data( .@bg_id,0 ) == 0 ){
  85. if( .@bg_id == .bg_red ) .bg_red = 0;
  86. else if( .@bg_id == .bg_blue ) .bg_blue = 0;
  87. bg_destroy .@bg_id;
  88. }
  89. end;
  90.  
  91. OnPCLoadMapEvent:
  92. if( strcharinfo(3) == .map$ ){
  93. .@bg_id = getcharid(4);
  94. if( !.@bg_id ){
  95. warp "SavePoint",0,0;
  96. }else if( .@bg_id == .bg_red ){
  97. changelook LOOK_CLOTHES_COLOR,.bg_cloth_red;
  98. }else if( .@bg_id == .bg_blue ){
  99. changelook LOOK_CLOTHES_COLOR,.bg_cloth_blue;
  100. }else{
  101. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  102. }
  103. }
  104. end;
  105. }
  106.  
  107.  
  108.  
  109. prontera,151,182,5 script Red Team::bg_red 100,{
  110. if( getcharid(4) ){
  111. bg_leave;
  112. message strcharinfo(0),"You leaved the Group.";
  113. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  114. }
  115. end;
  116. OnBGEnable:
  117. delwaitingroom;
  118. waitingroom "Red TEAM",( $@team_count + 1 ),$@bg_npc_name$+"::OnRedJoin",1;
  119. end;
  120. }
  121. prontera,160,182,5 script Blue Team::bg_blue 100,{
  122. if( getcharid(4) ){
  123. bg_leave;
  124. message strcharinfo(0),"You leaved the Group.";
  125. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  126. }
  127. end;
  128. OnBGEnable:
  129. delwaitingroom;
  130. waitingroom "Blue TEAM",( $@team_count + 1 ),$@bg_npc_name$+"::OnBlueJoin",1;
  131. end;
  132. }
  133. prontera,155,182,5 script SOLO Team::bg_solo 100,{
  134. if( getcharid(4) ){
  135. bg_leave;
  136. message strcharinfo(0),"You leaved the Group.";
  137. changelook LOOK_CLOTHES_COLOR,getlook( LOOK_CLOTHES_COLOR );
  138. }
  139. end;
  140. OnBGEnable:
  141. delwaitingroom;
  142. waitingroom "SOLO TEAM",2,$@bg_npc_name$+"::OnSoloJoin",1;
  143. end;
  144. }
Advertisement
Add Comment
Please, Sign In to add comment