# Restrict team plugin for Deathrun Mod v 1.5
# Visit our DeathRun Server 188.134.21.171:27015
# Visit our site www.tk-portal.ru

import es

def load():
    es.addons.registerClientCommandFilter(clientFilter)   
    es.addons.registerClientCommandFilter(ter) 
    es.addons.registerClientCommandFilter(hook) 

def unload():
    es.addons.unregisterClientCommandFilter(clientFilter)
    es.addons.unregisterClientCommandFilter(ter)  
    es.addons.unregisterClientCommandFilter(hook)  

def clientFilter(userid, args):
    if args[0].lower() == 'jointeam' and es.getplayerteam(userid) == 2:
        return False
    return True
    if args[0].lower() == 'jointeam' and es.getplayerteam(userid) == 3:
        return False
    return True
    if args[0].lower() == 'jointeam':
        if args[1].lower() == '0':
            return False
    return True

def hook(userid, args):
    if args[0].lower() == "jointeam":
        if args[1].lower() == '0':
            return False
    return True

def ter(userid, args):
    if args[0].lower() == "jointeam" and args[1].lower() == '2' and es.getplayercount(2) != 0:
        es.tell(userid,'Only the chosen one can become a terrorist!!')
        return False  
    return True
