import sourcemod
myinfo = {
'name': "Omniwolf's Teamswitch Plugin",
'author': "Omniwolf + quartata",
'description': "Switches RED Survivors to BLU",
'version': "1.0"
from commands.typed import TypedServerCommand
from events import Event
from events.manager import event_manager
from players.entity import Player
@TypedServerCommand("switch_death_on")
def switch_enable(command_info):
try:
event_manager.register_for_event("player_death", player_death)
except ValueError:
print("Already on.")
@TypedServerCommand("switch_death_off")
def switch_disable(command_info):
try:
event_manager.unregister_for_event("player_death", player_death)
except ValueError:
print("Already off.")
def player_death(event):
player = Player.from_userid(event["userid"])
if player.get_team() == 2:
player.set_team(3)