Raised This Month: $ Target: $400
 0% 

Custom menu instead of team select menu.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Neeeeeeeeeel.-
Some Guy Yellin'
Join Date: Jul 2010
Location: Argentina
Old 03-10-2014 , 20:59   Custom menu instead of team select menu.
Reply With Quote #1

I want to join players in CT team always with a custom menu instead of default team select menu. This code works in most cases but sometimes (2/10 times) using old style menu it joins me on TT menu. I don't know how to fix it...

Auto join on connect plugin doesn't fit to my needs...
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <fakemeta>

new g_msgid[33];
new 
ingame[33];
stock const FIRST_JOIN_MSG[] = "#Team_Select";
stock const FIRST_JOIN_MSG_SPEC[] = "#Team_Select_Spect";
stock const INGAME_JOIN_MSG[] = "#IG_Team_Select";
stock const INGAME_JOIN_MSG_SPEC[] = "#IG_Team_Select_Spect";
const 
iMaxLen sizeof(INGAME_JOIN_MSG_SPEC);
stock const VGUI_JOIN_TEAM_NUM 2;
const 
OFFSET_CSMENUCODE 205;
const 
KEYSMENU MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_4|MENU_KEY_5|MENU_KEY_6|MENU_KEY_7|MENU_KEY_8|MENU_KEY_9|MENU_KEY_0;

public 
plugin_init(){
    
register_clcmd("chooseteam""clcmd_changeteam");
    
register_clcmd("jointeam""clcmd_changeteam");
    
register_menu("Access Menu"KEYSMENU"menu_access");
    
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
    
register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
}
public 
message_VGUIMenu(iMsgidiDestid){
    if(
get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM){
        return 
PLUGIN_CONTINUE;
    }
    
    if(
is_user_connected(id) && !ingame[id]){
        
g_msgid[id] = iMsgid;
        
show_menu_access(id);
        return 
PLUGIN_HANDLED;
    }
    
    return 
PLUGIN_HANDLED;
}
public 
message_ShowMenu(iMsgidiDestid){
    static 
sMenuCode[iMaxLen];
    
get_msg_arg_string(4sMenuCodesizeof(sMenuCode)-1);
    if(
equal(sMenuCodeFIRST_JOIN_MSG) || equal(sMenuCodeFIRST_JOIN_MSG_SPEC) || 
    
equal(sMenuCodeINGAME_JOIN_MSG) || equal(sMenuCodeINGAME_JOIN_MSG_SPEC)){
        if(
is_user_connected(id)  && !ingame[id]){
            
g_msgid[id] = iMsgid;
            
show_menu_access(id);
            return 
PLUGIN_HANDLED;
        }
    }
    return 
PLUGIN_HANDLED;
}
public 
clcmd_changeteam(id){
    if(!
ingameid ]){
        
show_menu_access(id);
    }
    return 
PLUGIN_HANDLED;
}
public 
show_menu_access(id){
    static 
menu[256];
    new 
len;
    
    
len += formatex(menu[len], charsmax(menu)-len"\wAccess Menu^n^n");
    
len += formatex(menu[len], charsmax(menu)-len"\y1. \rAccess^n");
    
len += formatex(menu[len], charsmax(menu)-len"\y0. \rSalir");
    
    
set_pdata_int(idOFFSET_CSMENUCODE0);
    
show_menu(idKEYSMENUmenu, -1"Access Menu");
}
public 
menu_access(idkey){
    if (
key == 0){
        static 
msg_block;
        
msg_block get_msg_block(g_msgid[id]);
        
set_msg_block(g_msgid[id], BLOCK_SET);
        
engclient_cmd(id"jointeam""2");
        
engclient_cmd(id"joinclass""5");
        
set_msg_block(g_msgid[id], msg_block);
        
ingame[id] = 1;
    }
}
public 
client_putinserver(id){
    
show_menu_access(id);

__________________
Neeeeeeeeeel.- is offline
Send a message via Skype™ to Neeeeeeeeeel.-
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 05:56.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode