pickup bot - 11/09/05 08:15 PM
i'm working on a pickup bot and i'm having some problems with it. sometimes when a user types !remove it will devoice him but not take him out of the topic. also when i do !reset once in awhile it will leave 1 person voiced. also i need to find a better way to do !remove # so that i dont have to check how many lines is in players.txt for each #. here's the code..
Code:
on :TEXT:!add:#pickup.aq2:{ if ($read(players.txt, w, $nick)) { haltdef } elseif ($lines(players.txt) == 8) { haltdef } else { write players.txt $nick if ($lines(players.txt) == 8) { topic # AQ2 Pickup - ./././././././. - Type !add to join. mode # -vvvv $read(players.txt, 1) $read(players.txt, 2) $read(players.txt, 3) $read(players.txt, 4) mode # -vvvv $read(players.txt, 5) $read(players.txt, 6) $read(players.txt, 7) $read(players.txt, 8) write -c players.txt msg # Pickup starting now.. Players: $read(players.txt, 1) $+ , $read(players.txt, 2) $+ , $read(players.txt, 3) $+ , $read(players.txt, 4) $+ , $read(players.txt, 5) $+ , $read(players.txt, 6) $+ , $read(players.txt, 7) $+ , $read(players.txt, 8) $+ . Captains: $read(players.txt, $rand(1,4)) $read(players.txt, $rand(5,8)) msg $read(players.txt, 1) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 2) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 3) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 4) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 5) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 6) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 7) Pickup starting.. %server $+ . Password is " $+ %password $+ ". msg $read(players.txt, 8) Pickup starting.. %server $+ . Password is " $+ %password $+ ". haltdef } if ($lines(players.txt) == 7) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ / $+ $read(players.txt, 6) $+ / $+ $read(players.txt, 7) $+ /. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 6) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ / $+ $read(players.txt, 6) $+ /./. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 5) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ /././. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 4) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ /./././. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 3) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ /././././. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 2) { topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ /./././././. - Type !add to join. | mode # +v $nick | haltdef } if ($lines(players.txt) == 1) { topic # AQ2 Pickup - $read(players.txt, 1) $+ /././././././. - Type !add to join. | mode # +v $nick | haltdef } } } on :TEXT:!remove:#pickup.aq2:{ if ($read(players.txt, w, $nick)) { if ($lines(players.txt) == 1) { write -dl1 players.txt | topic # AQ2 Pickup - ./././././././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 2) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ /././././././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 3) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ /./././././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 4) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ /././././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 5) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ /./././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 6) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ /././. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 7) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ / $+ $read(players.txt, 6) $+ /./. - Type !add to join. | mode # -v $nick | haltdef } if ($lines(players.txt) == 8) { write -dl1 players.txt | topic # AQ2 Pickup - $read(players.txt, 1) $+ / $+ $read(players.txt, 2) $+ / $+ $read(players.txt, 3) $+ / $+ $read(players.txt, 4) $+ / $+ $read(players.txt, 5) $+ / $+ $read(players.txt, 6) $+ / $+ $read(players.txt, 7) $+ /. - Type !add to join. | mode # -v $nick | haltdef } } else { haltdef } } on master:TEXT:!reset:#pickup.aq2:{ mode # -vvvv $read(players.txt, 1) $read(players.txt, 2) $read(players.txt, 3) $read(players.txt, 4) mode # -vvvv $read(players.txt, 5) $read(players.txt, 6) $read(players.txt, 7) $read(players.txt, 8) write -c players.txt topic # AQ2 Pickup - ./././././././. - Type !add to join. } on master:TEXT:!remove *:#pickup.aq2, ?:{ if ($2 == 1) { mode # -v $read(players.txt, 1) | write -dl1 players.txt | haltdef } if ($2 == 2) { mode # -v $read(players.txt, 2) | write -dl2 players.txt | haltdef } if ($2 == 3) { mode # -v $read(players.txt, 3) | write -dl3 players.txt | haltdef } if ($2 == 4) { mode # -v $read(players.txt, 4) | write -dl4 players.txt | haltdef } if ($2 == 5) { mode # -v $read(players.txt, 5) | write -dl5 players.txt | haltdef } if ($2 == 6) { mode # -v $read(players.txt, 6) | write -dl6 players.txt | haltdef } if ($2 == 7) { mode # -v $read(players.txt, 7) | write -dl7 players.txt | haltdef } if ($2 == 8) { mode # -v $read(players.txt, 8) | write -dl8 players.txt | haltdef } else { haltdef } }