Skip to content

Commit

Permalink
Improve command !swap
Browse files Browse the repository at this point in the history
  • Loading branch information
urthub committed Mar 16, 2014
1 parent 18604d1 commit 5ac0e57
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions spunky.py
Original file line number Diff line number Diff line change
Expand Up @@ -1053,9 +1053,13 @@ def handle_say(self, line):
if team1 == team2:
game.rcon_tell(sar['player_num'], "^7Cannot swap, both players are in the same team")
else:
game.rcon_forceteam(victim1.get_player_num(), Player.teams[3])
game.rcon_forceteam(victim2.get_player_num(), Player.teams[team1])
game.rcon_forceteam(victim1.get_player_num(), Player.teams[team2])
game_data = game.get_gamestats()
if game_data[Player.teams[team1]] < game_data[Player.teams[team2]]:
game.rcon_forceteam(victim2.get_player_num(), Player.teams[team1])
game.rcon_forceteam(victim1.get_player_num(), Player.teams[team2])
else:
game.rcon_forceteam(victim1.get_player_num(), Player.teams[team2])
game.rcon_forceteam(victim2.get_player_num(), Player.teams[team1])
game.rcon_say('^7Swapped player ^3%s ^7with ^3%s' % (victim1.get_name(), victim2.get_name()))
else:
game.rcon_tell(sar['player_num'], "^7Usage: !swap <name1> <name2>")
Expand Down

0 comments on commit 5ac0e57

Please sign in to comment.