Actually I'm doing something like an Automix and I'm trying to hook the jointeam with a code that I found in the Auto-Jointeam plugin.
The problem: It lets me to choose my class (skin) and it doesn't have to.
Here is the code:
PHP Code:
new teamsChoosen = false;
new hookM = true;
new team[32];
public plugin_init(){
register_message(get_user_msgid("VGUIMenu"), "Message_VGUIMenu");
register_message(get_user_msgid("ShowMenu"), "Message_ShowMenu");
register_clcmd("jointeam", "join");
register_clcmd("chooseteam", "choose");
}
public Message_VGUIMenu(msgId, dest, id) {
if(hookM && !teamsChoosen){
if(is_user_connected(id) && get_msg_arg_int(1) == 2){
new params[2];
params[0] = msgId;
set_task(0.1, "autoJoin", id, params, sizeof(params));
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public Message_ShowMenu(msgId, dest, id){
if(hookM && !teamsChoosen){
new menuCode[32];
get_msg_arg_string(4, menuCode, charsmax(menuCode));
if(containi(menuCode, "Team_Select") > 0){
new params[2];
params[0] = msgId;
set_task(0.1, "autoJoin", id, params, sizeof(params));
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public autoJoin(params[], id){
new block = get_msg_block(params[0]);
set_msg_block(params[0], BLOCK_SET);
engclient_cmd(id, "jointeam", team[id]);
engclient_cmd(id, "joinclass", "5");
set_msg_block(params[0], block);
}
public join(id){
new param[32];
read_args(param, charsmax(param));
remove_quotes(param);
trim(param);
if(hookM && !teamsChoosen){
if(equal(param, "1")){
return PLUGIN_CONTINUE;
}
else if(equal(param, "2")){
return PLUGIN_CONTINUE;
}
else{
client_print(id, print_chat, "You cannot join to that team now.");
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public choose(id){
new random = random_num(0, 1);
if(random == 0){
team[id] = "1";
}
else if(random == 1){
team[id] = "2";
}
engclient_cmd(id, "jointeam", team[id]);
return PLUGIN_HANDLED;
}