Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2016
1,186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.43 KB | None | 0 0
  1. //Modified by - PandaLovesHamster
  2. //Custom Guild Limiter
  3. //Credits to the owners of the individual makers of the script, I just tied them all together to create this script
  4.  
  5. ayothaya,171,144,5 script Guild Limiter 833,{
  6.  
  7. // this part registers the guild
  8. function sf {
  9. function s;
  10. .@a = getarg(2);
  11. .@len = getarg(3);
  12. return (
  13. sprintf( getarg(0),
  14. s(.@a, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
  15. s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
  16. s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
  17. s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1)),
  18. s(.@a++, .@len, getarg(1)), s(.@a++, .@len, getarg(1))
  19. )
  20. +(( .@a+1 < .@len )?":Next":":")
  21. +(( .@a-11 > 0 )?":Back":":")
  22. +":Cancel"
  23. );
  24. function s {
  25. if( getarg(0) >= getarg(1) ) return "";
  26. else {
  27. .@name$ = getguildname(getelementofarray(getarg(2),getarg(0)));
  28. return .@name$=="null"?"":.@name$;
  29. }
  30. };
  31. };
  32. function nex { return((getarg(0)+10)<getarg(1)?getarg(0)+10:getarg(1)-(getarg(1)%10)); };
  33. function bac { return((getarg(0)-10)>=0?getarg(0)-10:0); };
  34.  
  35. if(getgmlevel()>=80 ) {
  36. mes .Npc_Name$;
  37. mes "Hello Mr. GM what would you like to do?";
  38. next;
  39. switch( select("Add/Remove Guilds:Clear Guild Data:Player Menu:Cancel") ) {
  40. case 1:
  41. mes .Npc_Name$;
  42. mes "Would you like to add or remove a guild?";
  43. .@a_len = getarraysize($App_Guilds);
  44. .@format$ = "%s:%s:%s:%s:%s:%s:%s:%s:%s:%s";
  45. next;
  46. if( select("Remove:Add") == 1 ) {
  47. while( .@a != 9999 ) {
  48. select( sf( .@format$, $App_Guilds, .@a, .@a_len ) );
  49. switch( @menu ) {
  50. case 11: .@a = nex( .@a, .@a_len ); break;
  51. case 12: .@a = bac( .@a ); break;
  52. case 13: end;
  53.  
  54. default:
  55. .@select = .@a+@menu-1;
  56. mes .Npc_Name$;
  57. mes "You've selected ^0000FF["+getguildname($App_Guilds[.@select])+"]^000000 guild. Would you like to remove them from the accepted guilds?";
  58. next;
  59. if( select("Yes:No") == 1 ) {
  60. deletearray($App_Guilds[.@select],1);
  61. mes .Npc_Name$;
  62. mes "The guild has been removed!";
  63. }
  64. close;
  65. }
  66. }
  67. } else {
  68. mes .Npc_Name$;
  69. mes "Please input guild name or masters name.";
  70. next;
  71. input(.@input$);
  72. .@len = query_sql( "Select `guild_id` from `guild` where `name` like '%"+escape_sql(.@input$)+"%' or `master` like '%"+escape_sql(.@input$)+"%';",.@guild_id );
  73. while( .@a != 9999 ) {
  74. select( sf( .@format$, .@guild_id, .@a, .@len ) );
  75. switch( @menu ) {
  76. case 11: .@a = nex( .@a, .@len ); break;
  77. case 12: .@a = bac( .@a ); break;
  78. case 13: end;
  79.  
  80. default:
  81. .@select = .@a+@menu-1;
  82. .@a_len = getarraysize($App_Guilds);
  83. for(.@b=0;.@b<.@a_len;.@b++)
  84. if( $App_Guilds[.@b]==.@guild_id[.@select] ) {
  85. mes .Npc_Name$;
  86. mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. I'm sorry but that guild has already been added to the accepted list.";
  87. close;
  88. }
  89. mes .Npc_Name$;
  90. mes "You've selected ^0000FF["+getguildname(.@guild_id[.@select])+"]^000000 guild. Would you like to add them to the accepted guilds?";
  91. next;
  92. if( select("Yes:No") == 1 ) {
  93. .@a_len = getarraysize($App_Guilds);
  94. if( .@a_len>=128 ) {
  95. mes .Npc_Name$;
  96. mes "I'm sorry but the accepted list is full please make some room and try again...";
  97. } else {
  98. mes .Npc_Name$;
  99. mes "The guild was successfully added!";
  100. $App_Guilds[.@a_len] = .@guild_id[.@select];
  101. }
  102. }
  103. close;
  104. }
  105. }
  106. }
  107. case 2:
  108. mes .Npc_Name$;
  109. mes "Are you sure you want to clear the guild data?!";
  110. next;
  111. if( select("Yes!:No!")==1 ) {
  112. mes .Npc_Name$;
  113. mes "This is you last chance. Are you surely sure as sure can be?";
  114. next;
  115. if( select("Surly!:No, wait... Where am I?!!")==1 )
  116. deletearray($App_Guilds);
  117. }
  118. if( @menu==1 ) {
  119. mes .Npc_Name$;
  120. mes "The deed is done...";
  121. } else {
  122. mes .Npc_Name$;
  123. mes "Wow that was a close one... Have a nice day!";
  124. }
  125. close;
  126.  
  127. case 3: break;
  128.  
  129. case 4:
  130. mes .Npc_Name$;
  131. mes "Alright, have a nice day!";
  132. close;
  133. }
  134. }
  135.  
  136. .@len = getarraysize($App_Guilds);
  137. for( .@i=0; .@i <= .@len; .@i++ ) {
  138. if( getcharid(2) == $App_Guilds[.@i] )
  139. set .@Guild_Check, .@Guild_Check+1;
  140. }
  141.  
  142.  
  143. // This part ejects players when they are in the map
  144. OnPCLoadMapEvent:
  145. if( getcharid(2) == $App_Guilds[.@i] ){
  146. .count = 0;
  147. .@origin = getcharid(3);
  148. addrid 3, 0, getcharid(2);
  149. if ( strcharinfo(3) == .checkmap$ )
  150. .count++;
  151. if ( !.@origin ) end;
  152. if ( .count > 5 ) { // 5 means only 5 players per guild allowed in a map.
  153. message strcharinfo(0), "Your guild members are over the limit";
  154. sleep2 2000;
  155. warp "SavePoint", 0,0;
  156. }
  157. }
  158. end;
  159. OnInit:
  160. setarray .@checkmap$, "arug_cas01", "arug_cas02", "arug_cas03", "arug_cas04", "arug_cas05", "schg_cas01", "schg_cas02", "schg_cas03", "schg_cas04", "schg_cas05";
  161. .@len = getarraysize( .@checkmap$ );
  162. for ( .@i = 0; .@i < .@size; .@i++ ) {
  163. setmapflag .@checkmap$[.@i], mf_loadevent;
  164. setd "."+ .@checkmap$[.@i], 1;
  165. }
  166. end;
  167. }
  168.  
  169. - script kjdhfkjshf -1,{
  170. OnPCLoadMapEvent:
  171. if ( getmapflag( strcharinfo(3), mf_gvg_castle ) && ( agitcheck() || agitcheck2() )) {
  172. .@len = getarraysize($App_Guilds);
  173. for( .@i=0; .@i <= .@len; .@i++ ) {
  174. if( getcharid(2) == $App_Guilds[.@i] )
  175. set .@Guild_Check, .@Guild_Check+1;
  176. }
  177. if( .@Guild_Check < 1 ) {
  178. dispbottom "Your guild has not yet been approved, please contact the GMs";
  179. sleep2 3000;
  180. warp "SavePoint",0,0;
  181. end;
  182. }
  183. if( !getcharid(2) ) {
  184. dispbottom "Sorry only members of a guild may enter a castle.";
  185. sleep2 3000;
  186. warp "SavePoint",0,0;
  187. end;
  188. }
  189. }
  190. end;
  191. OnInit:
  192. setarray .castles$[0],
  193. "prtg_cas01","prtg_cas02","prtg_cas03","prtg_cas04","prtg_cas05",
  194. "payg_cas01","payg_cas02","payg_cas03","payg_cas04","payg_cas05",
  195. "gefg_cas01","gefg_cas02","gefg_cas03","gefg_cas04","gefg_cas05",
  196. "aldeg_cas01","aldeg_cas02","aldeg_cas03","aldeg_cas04","aldeg_cas05",
  197. "arug_cas01","arug_cas02","arug_cas03","arug_cas04","arug_cas05",
  198. "schg_cas01","schg_cas02","schg_cas03","schg_cas04","schg_cas05";
  199. for ( .@i = 0; .@i < 30; .@i++ )
  200. setmapflag .castles$[.@i], mf_loadevent;
  201. end;
  202. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement