Page 1 of 1

[SCRIPT] Switch n Lock (Useful for organised events)

Posted: Thu Oct 10, 2013 11:32 am
by Kuma
A script I made for clan matches etc. It has some good time saving commands for organised events. The commands are:-

/sl or /switchlock - Switches everyone to the spectator team and locks both Blue and Green teams.
/ms or /multiswitch <team_name> <player_names> - switches multiple people for example "/ms green kuma polm vladvp"
Code: Select all
#Switch n' Lock by Kuma
#Switches a complete team and locks it
#Also allows switching of multiple people at the same time

from commands import add, admin, alias, get_team, get_player

@alias('sl')
@admin
def switchlock(connection):
    protocol = connection.protocol
    switchandlock(connection)

@alias('ms')
@admin
def multiswitch(connection, *args):
    protocol = connection.protocol
    players = []
    if len(args) >= 2:
        teamname = args[0]
        team_ = get_team(connection, teamname)
        for player in args[1:]:
            players.append(get_player(protocol, player))
        for player in players:
            if player.team != team_:
                player.team = team_
                player.respawn()
        connection.send_chat('It will take some time to effect (respawn time)')
    else:
        raise ValueError()       

add(switchlock)
add(multiswitch)


def switchandlock(connection):
    protocol = connection.protocol
    players = protocol.players
    blue = get_team(connection, 'blue')
    green = get_team(connection, 'green')
    green.locked = True
    blue.locked = True
    for player in players.values():
        player.team = get_team(connection, 'spectator')
        player.kill()

def apply_script(protocol, connection, config):
    return protocol, connection

Re: [SCRIPT] Switch n Lock (Useful for organised events)

Posted: Thu Nov 21, 2013 4:14 am
by danhezee
We might need to incorporate this into the league match script