Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- alias ihl_pick {
- if (!$1) return
- if ($2) var %u1 $user($gettok(%ihl_game_pickingpool,$rand(1,$gettok(%ihl_game_pickingpool,0,32)),32)).find
- else var %u1 = $ihl_findplayer($1)
- if (%ihl_game_pick == $auth($nick)) {
- ; if we cant find a player with that name
- if (!%u1) { notice $nick $1 is not in listplayers. | return }
- if ($user(%u1).auth !isin %ihl_game_pickingpool) { notice $nick $1 is not in listplayers. | return }
- var %l1 $user($auth($nick)).find
- if ($user(%u1).auth isin %ihl_game_pickingpool) {
- ; if you only have 1 pick left
- if (%ihl_game_count == 1) {
- ; adding to team
- ihl_teams $user(%u1).auth
- ; changing picker
- if (%ihl_game_pick == %ihl_game_leader_2) set %ihl_game_pick %ihl_game_leader_1
- else set %ihl_game_pick %ihl_game_leader_2
- var %l2 $user(%ihl_game_pick).find
- ; some counting stuff
- set %ihl_game_count $calc(2 + %ihl_game_nextcount)
- if (%ihl_game_count >= 4) set %ihl_game_count 4
- inc %ihl_game_total
- if (%ihl_game_total == 7) && (%ihl_game_slots == 8) {
- ; adding last player to team
- set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
- ihl_teams $remtok(%ihl_game_pickingpool,?,0,32)
- var %u2 $user($remtok(%ihl_game_pickingpool,?,0,32)).find
- ; announce
- 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
- 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
- mode %ihl_cfg_channel +vv-m $auth-nick($user(%u1).auth) $auth-nick($user(%u2).auth)
- if ($rand(1,2) == 1) var %players %ihl_game_leader_1 %ihl_game_team_1 %ihl_game_leader_2 %ihl_game_team_2
- else var %players %ihl_game_leader_2 %ihl_game_team_2 %ihl_game_leader_1 %ihl_game_team_1
- ; some stuff before starting the game
- ihl_addplayers %ihl_cfg_gameid %players
- var %sql = INSERT INTO bot_games (players, timestamp, type, mode, season) VALUES (?, ?, ?, ?, ?)
- scon 1 noop $mysql_exec(%track.db, %sql, %players, $ctime, $(CL), $ihl_game_modes(%ihl_game_modes), %ihl_cfg_season)
- unset %ihl_game_phase
- unset_all
- scon $iif(%c.linesMGN-BOTv1 > %c.linesMGN-BOTv2,2,1) ihl_gameinfo %ihl_cfg_gameid
- inc %ihl_cfg_gameid
- return
- }
- else {
- 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
- mode %ihl_cfg_channel +v $auth-nick($user(%u1).auth)
- set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
- }
- }
- ; if you have 2 picks left
- elseif (%ihl_game_count >= 2) {
- if (%ihl_game_total == 7) {
- ; adding last player to team
- ihl_teams $user(%u1).auth
- 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
- mode %ihl_cfg_channel +v-m $auth-nick($user(%u1).auth)
- if ($rand(1,2) == 1) var %players %ihl_game_leader_1 %ihl_game_team_1 %ihl_game_leader_2 %ihl_game_team_2
- else var %players %ihl_game_leader_2 %ihl_game_team_2 %ihl_game_leader_1 %ihl_game_team_1
- ; some stuff before starting the game
- ihl_addplayers %ihl_cfg_gameid %players
- var %sql = INSERT INTO bot_games (players, timestamp, type, mode, season) VALUES (?, ?, ?, ?, ?)
- scon 1 noop $mysql_exec(%track.db, %sql, %players, $ctime, $(CL), $ihl_game_modes(%ihl_game_modes), %ihl_cfg_season)
- unset %ihl_game_phase
- unset_all
- scon $iif(%c.linesMGN-BOTv1 > %c.linesMGN-BOTv2,2,1) ihl_gameinfo %ihl_cfg_gameid
- inc %ihl_cfg_gameid
- return
- }
- else {
- ihl_teams $user(%u1).auth
- 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
- mode %ihl_cfg_channel +v $auth-nick($user(%u1).auth)
- }
- dec %ihl_game_count
- inc %ihl_game_total
- set %ihl_game_pickingpool $remtok(%ihl_game_pickingpool,$user(%u1).auth,1,32)
- }
- }
- }
- }
- alias ihl_findplayer {
- var %counter = 1, %found = 0, %total = $numtok(%ihl_game_pickingpool,32)
- while (%counter <= %total) {
- var %find $user($gettok(%ihl_game_pickingpool,%counter,32)).find
- if ($iif($1 isin $user(%find).nick,yes,no) == yes) {
- if ($1 == $user(%find).nick) return %find
- else var %findplayer %find
- inc %found
- }
- inc %counter
- }
- if (%found > 1) { notice $nick Please be more specific! Found $gcolor(%found) players with name: $bcolor($1) | halt }
- else return %findplayer
- }
- alias ihl_teams {
- if (%ihl_game_pick == %ihl_game_leader_2) {
- set %ihl_game_team_2 %ihl_game_team_2 ?
- set %ihl_game_team_2 $reptok(%ihl_game_team_2,?,$1,1,32)
- }
- else {
- set %ihl_game_team_1 %ihl_game_team_1 ?
- set %ihl_game_team_1 $reptok(%ihl_game_team_1,?,$1,1,32)
- }
- }
Add Comment
Please, Sign In to add comment