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

Intended for use on live public servers.
2 posts Page 1 of 1 First unread post
Kuma
Scripter
Scripter
Posts: 758
Joined: Fri Mar 22, 2013 10:05 am


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
Attachments
switchnlock.py
(1.33 KiB) Downloaded 174 times
danhezee
Former Admin / Co-founder
Former Admin / Co-founder
Posts: 1710
Joined: Wed Oct 03, 2012 12:09 am


We might need to incorporate this into the league match script
2 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 20 guests