Guest User

Untitled

a guest
May 25th, 2018
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.59 KB | None | 0 0
  1. alias ihl_pick {
  2. if (!$1) return
  3.  
  4. if ($2) var %u1 $user($gettok(%ihl_game_pickingpool,$rand(1,$gettok(%ihl_game_pickingpool,0,32)),32)).find
  5. else var %u1 = $ihl_findplayer($1)
  6.  
  7. if (%ihl_game_pick == $auth($nick)) {
  8.  
  9. ; if we cant find a player with that name
  10. if (!%u1) { notice $nick $1 is not in listplayers. | return }
  11. if ($user(%u1).auth !isin %ihl_game_pickingpool) { notice $nick $1 is not in listplayers. | return }
  12.  
  13.  
  14. var %l1 $user($auth($nick)).find
  15.  
  16. if ($user(%u1).auth isin %ihl_game_pickingpool) {
  17.  
  18. ; if you only have 1 pick left
  19. if (%ihl_game_count == 1) {
  20.  
  21. ; adding to team
  22. ihl_teams $user(%u1).auth
  23.  
  24. ; changing picker
  25. if (%ihl_game_pick == %ihl_game_leader_2) set %ihl_game_pick %ihl_game_leader_1
  26. else set %ihl_game_pick %ihl_game_leader_2
  27.  
  28. var %l2 $user(%ihl_game_pick).find
  29.  
  30. ; some counting stuff
  31. set %ihl_game_count $calc(2 + %ihl_game_nextcount)
  32. if (%ihl_game_count >= 4) set %ihl_game_count 4
  33. inc %ihl_game_total
  34.  
  35. if (%ihl_game_total == 7) && (%ihl_game_slots == 8) {
  36.  
  37. ; adding last player to team
  38. set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
  39. ihl_teams $remtok(%ihl_game_pickingpool,?,0,32)
  40. var %u2 $user($remtok(%ihl_game_pickingpool,?,0,32)).find
  41.  
  42. ; announce
  43. describe %ihl_cfg_channel $bcolor($user(%l1).nick) $iif($2,has randomized,picked) $bcolor($user(%u1).nick) $+ ! $bcolor($user(%l2).nick) $+ 's turn to pick. Total Picked:3 $calc(2 + %ihl_game_total) $+ 6/0310
  44. describe %ihl_cfg_channel $bcolor($user(%l2).nick) picked $bcolor($user(%u2).nick) $+ . The teams are done! Total Picked:3 $calc(2 + %ihl_game_total + 1) $+ 6/0310
  45. mode %ihl_cfg_channel +vv-m $auth-nick($user(%u1).auth) $auth-nick($user(%u2).auth)
  46.  
  47. if ($rand(1,2) == 1) var %players %ihl_game_leader_1 %ihl_game_team_1 %ihl_game_leader_2 %ihl_game_team_2
  48. else var %players %ihl_game_leader_2 %ihl_game_team_2 %ihl_game_leader_1 %ihl_game_team_1
  49.  
  50. ; some stuff before starting the game
  51. ihl_addplayers %ihl_cfg_gameid %players
  52. var %sql = INSERT INTO bot_games (players, timestamp, type, mode, season) VALUES (?, ?, ?, ?, ?)
  53. scon 1 noop $mysql_exec(%track.db, %sql, %players, $ctime, $(CL), $ihl_game_modes(%ihl_game_modes), %ihl_cfg_season)
  54. unset %ihl_game_phase
  55. unset_all
  56. scon $iif(%c.linesMGN-BOTv1 > %c.linesMGN-BOTv2,2,1) ihl_gameinfo %ihl_cfg_gameid
  57. inc %ihl_cfg_gameid
  58. return
  59. }
  60. else {
  61. describe %ihl_cfg_channel $bcolor($user(%l1).nick) $iif($2,has randomized,picked) $bcolor($user(%u1).nick) $+ ! $bcolor($user(%l2).nick) $+ 's turn to pick. Total Picked:3 $calc(2 + %ihl_game_total) $+ 6/0310
  62. mode %ihl_cfg_channel +v $auth-nick($user(%u1).auth)
  63. set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
  64. }
  65. }
  66. ; if you have 2 picks left
  67. elseif (%ihl_game_count >= 2) {
  68. if (%ihl_game_total == 7) {
  69.  
  70. ; adding last player to team
  71. ihl_teams $user(%u1).auth
  72. describe %ihl_cfg_channel $bcolor($user(%l1).nick) $iif($2,has randomized,picked) $bcolor($user(%u1).nick) $+ . The teams are done! Total Picked:3 $calc(2 + %ihl_game_total + 1) $+ 6/0310
  73. mode %ihl_cfg_channel +v-m $auth-nick($user(%u1).auth)
  74.  
  75. if ($rand(1,2) == 1) var %players %ihl_game_leader_1 %ihl_game_team_1 %ihl_game_leader_2 %ihl_game_team_2
  76. else var %players %ihl_game_leader_2 %ihl_game_team_2 %ihl_game_leader_1 %ihl_game_team_1
  77.  
  78. ; some stuff before starting the game
  79. ihl_addplayers %ihl_cfg_gameid %players
  80. var %sql = INSERT INTO bot_games (players, timestamp, type, mode, season) VALUES (?, ?, ?, ?, ?)
  81. scon 1 noop $mysql_exec(%track.db, %sql, %players, $ctime, $(CL), $ihl_game_modes(%ihl_game_modes), %ihl_cfg_season)
  82. unset %ihl_game_phase
  83. unset_all
  84. scon $iif(%c.linesMGN-BOTv1 > %c.linesMGN-BOTv2,2,1) ihl_gameinfo %ihl_cfg_gameid
  85. inc %ihl_cfg_gameid
  86. return
  87. }
  88. else {
  89. ihl_teams $user(%u1).auth
  90. describe %ihl_cfg_channel $bcolor($user(%l1).nick) $iif($2,has randomized,picked) $bcolor($user(%u1).nick) $+ . You have $calc(%ihl_game_count - 1) more pick. Total Picked:3 $calc(2 + %ihl_game_total + 1) $+ 6/0310
  91. mode %ihl_cfg_channel +v $auth-nick($user(%u1).auth)
  92. }
  93. dec %ihl_game_count
  94. inc %ihl_game_total
  95. set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
  96. }
  97. }
  98. }
  99. }
  100.  
  101. alias ihl_findplayer {
  102. var %counter = 1, %found = 0, %total = $numtok(%ihl_game_pickingpool,32)
  103. while (%counter <= %total) {
  104. var %find $user($gettok(%ihl_game_pickingpool,%counter,32)).find
  105. if ($iif($1 isin $user(%find).nick,yes,no) == yes) {
  106. if ($1 == $user(%find).nick) return %find
  107. else var %findplayer %find
  108. inc %found
  109. }
  110. inc %counter
  111. }
  112. if (%found > 1) { notice $nick Please be more specific! Found $gcolor(%found) players with name: $bcolor($1) | halt }
  113. else return %findplayer
  114. }
  115.  
  116. alias ihl_teams {
  117. if (%ihl_game_pick == %ihl_game_leader_2) {
  118. set %ihl_game_team_2 %ihl_game_team_2 ?
  119. set %ihl_game_team_2 $reptok(%ihl_game_team_2,?,$1,1,32)
  120. }
  121. else {
  122. set %ihl_game_team_1 %ihl_game_team_1 ?
  123. set %ihl_game_team_1 $reptok(%ihl_game_team_1,?,$1,1,32)
  124. }
  125. }
Add Comment
Please, Sign In to add comment