Raised This Month: $ Target: $400
 0% 

custom teams help!


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
SeriousSam
Senior Member
Join Date: Aug 2009
Location: Bulgaria
Old 04-25-2011 , 14:26   custom teams help!
Reply With Quote #1

Hello, I want to force the player to be a spectator when he joins the server, and present him with a menu where he can choose from a custom team, class, gender and so on, and after he finishes his selection, to be moved to the corresponding team and set with a custom player model according to his selection. I started with looking at Exolent's team join management plugin, and so far I made the part where the player is forced to be a spectator, but it doesn't work quite right, the player is indeed switched to the spectator team after he closes the motd window, but the hud is different and still displays money and roundtime, and he can't move. I don't know why, can you help me?

PHP Code:
#include <amxmodx>

#define PLUGIN "Classes"
#define VERSION "1.0"
#define AUTHOR "SeriousSamBG"

enum
{
    
TEAM_NONE 0,
    
TEAM_T,
    
TEAM_CT,
    
TEAM_SPEC,
    
    
MAX_TEAMS
};

new const 
g_cTeamChars[MAX_TEAMS] =
{
    
'U',
    
'T',
    
'C',
    
'S'
};

// Old Style Menus
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);

// New VGUI Menus
stock const VGUI_JOIN_TEAM_NUM =        2;

new 
g_iTeam[33];
new 
g_iPlayers[MAX_TEAMS];

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
register_event("TeamInfo""event_TeamInfo""a");
    
register_message(get_user_msgid("ShowMenu"), "message_ShowMenu");
    
register_message(get_user_msgid("VGUIMenu"), "message_VGUIMenu");
}

public 
event_TeamInfo()
{
    new 
id read_data(1);
    new 
sTeam[32], iTeam;
    
    
read_data(2sTeamsizeof(sTeam) - 1);
    
    for(new 
0MAX_TEAMSi++)
    {
        if(
g_cTeamChars[i] == sTeam[0])
        {
            
iTeam i;
            break;
        }
    }
    
    if(
g_iTeam[id] != iTeam)
    {
        
g_iPlayers[g_iTeam[id]]--;
        
g_iTeam[id] = iTeam;
        
g_iPlayers[iTeam]++;
    }
}

public 
message_ShowMenu(iMsgidiDestid)
{
    static 
sMenuCode[iMaxLen];
    
    
get_msg_arg_string(4sMenuCodesizeof(sMenuCode) - 1);
    
    if(
equal(sMenuCodeFIRST_JOIN_MSG) || equal(sMenuCodeFIRST_JOIN_MSG_SPEC))
    {
        if(
is_user_connected(id) && !(TEAM_NONE g_iTeam[id] < TEAM_SPEC))
        {
            
set_autojoin_task(idiMsgid);
            return 
PLUGIN_HANDLED;
        }
    }
    else if(
equal(sMenuCodeINGAME_JOIN_MSG) || equal(sMenuCodeINGAME_JOIN_MSG_SPEC))
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

public 
message_VGUIMenu(iMsgidiDestid)
{
    if(
get_msg_arg_int(1) != VGUI_JOIN_TEAM_NUM)
    {
        return 
PLUGIN_CONTINUE;
    }
    
    if(
is_user_connected(id) && !(TEAM_NONE g_iTeam[id] < TEAM_SPEC))
    {
        
set_autojoin_task(idiMsgid);
        return 
PLUGIN_HANDLED;
    }
    else if(
TEAM_NONE g_iTeam[id] < TEAM_SPEC)
    {
        return 
PLUGIN_HANDLED;
    }
    return 
PLUGIN_CONTINUE;
}

stock set_autojoin_task(idiMsgid)
{
    new 
iMsgBlock get_msg_block(iMsgid);
    
set_msg_block(iMsgidBLOCK_SET);
    
    
engclient_cmd(id"jointeam""3");
    
    
set_msg_block(iMsgidiMsgBlock);

__________________
SeriousSam is offline
Send a message via Skype™ to SeriousSam
 



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 19:45.


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