// Admin Teams, Copyright 2002, PsychoGuard. No warranties. 

#include <amxmod>

public admin_changeteam(id) {
    if (! (get_user_flags(id) & ADMIN_LEVEL_A)) {
        client_print(id, print_console, "[AMX] You have no access to that command");
        return PLUGIN_HANDLED;
    }
    new command[32];
    read_argv(0, command, 32);
    if (read_argc() < 2) {
        client_print(id, print_console, "[AMX] Usage: %s <part of nick>", command);
        return PLUGIN_HANDLED;
    }
    new arg[32];
    read_argv(1, arg, 32);
    new player = find_player("b", arg);
    if (player) {
        if (get_user_flags(player) & ADMIN_IMMUNITY) {
            client_print(id, print_console, "[AMX] The player has immunity.");
            return PLUGIN_HANDLED;
        }
        if (equal(command, "amx_t")) {
            engclient_cmd(player, "chooseteam")
            engclient_cmd(player, "menuselect", "1")
            engclient_cmd(player, "menuselect", "5")
        } else {
            engclient_cmd(player, "chooseteam")
            engclient_cmd(player, "menuselect", "2")
            engclient_cmd(player, "menuselect", "5")
        }
    } else {
        client_print(id, print_console, "[AMX] Client with that part of nick not found.");
    }

    return PLUGIN_HANDLED;
}

public plugin_init() {
    register_plugin("Admin Teams", "0.5", "PsychoGuard");
    register_clcmd("amx_t", "admin_changeteam", ADMIN_LEVEL_A, "amx_t <part of nick>");
    register_clcmd("amx_ct", "admin_changeteam", ADMIN_LEVEL_A, "amx_ct <part of nick>");  
    return PLUGIN_CONTINUE;
}

