Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import sourcemod
  2.  
  3. myinfo = {
  4.     'name': "Omniwolf's Teamswitch Plugin",
  5.     'author': "Omniwolf + quartata",
  6.     'description': "Switches RED Survivors to BLU",
  7.     'version': "1.0"
  8.  
  9. from commands.typed import TypedServerCommand
  10. from events import Event
  11. from events.manager import event_manager
  12. from players.entity import Player
  13.  
  14. @TypedServerCommand("switch_death_on")
  15. def switch_enable(command_info):
  16.   try:
  17.     event_manager.register_for_event("player_death", player_death)
  18.   except ValueError:
  19.     print("Already on.")
  20.  
  21. @TypedServerCommand("switch_death_off")
  22. def switch_disable(command_info):
  23.   try:
  24.     event_manager.unregister_for_event("player_death", player_death)
  25.   except ValueError:
  26.     print("Already off.")
  27.  
  28. def player_death(event):
  29.   player = Player.from_userid(event["userid"])
  30.   if player.get_team() == 2:
  31.     player.set_team(3)