AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   catch "team is full" event, help it doesn't work (https://forums.alliedmods.net/showthread.php?t=88789)

Owyn 03-29-2009 05:42

catch "team is full" event, help it doesn't work
 
PHP Code:

/* AMX Mod X Plugin

* (c) Copyright 2008, ConnorMcLeod 
* This file is provided as is (no warranties). 

*/ 

#include <amxmodx>
#include <fakemeta>

#define ADMIN_CHOOSETEAM    ADMIN_RCON

#define OFFSET_TEAM        114
#define OFFSET_DEFUSE_PLANT        193
#define HAS_DEFUSE_KIT            (1<<16)
#define OFFSET_INTERNALMODEL        126

new g_msgidStatusIcong_msgidTeamInfo

public plugin_init()
{
    
register_plugin("Admin ChooseTeam""0.1""ConnorMcLeod")
    
register_event("TextMsg""Too_Many""b""1=4""2&#Too_Many")
}

public 
plugin_cfg()
{
    
g_msgidStatusIcon get_user_msgid("StatusIcon")
    
g_msgidTeamInfo get_user_msgid("TeamInfo")
}

public 
Too_Many(id)
{
    if(
is_user_bot(id))
        return

/*    if(!(get_user_flags(id) & ADMIN_CHOOSETEAM))
    {
        return
    }*/

    
static team[12]
    
read_data(2team11)
    if(
team[10] == 'T')
    {
        if( 
get_pdata_int(idOFFSET_TEAM) != 1)
        {
            
cs_set_user_team(id1)
        }
    }
    else if(
team[10] == 'C')
    {
        if( 
get_pdata_int(idOFFSET_TEAM) != 2)
        {
            
cs_set_user_team(id2)
        }
    }
}

cs_set_user_team(idteam)
{
    switch(
team)
    {
        case 
1
        {
            new 
iDefuser get_pdata_int(idOFFSET_DEFUSE_PLANT)
            if(
iDefuser HAS_DEFUSE_KIT)
            {
                
iDefuser -= HAS_DEFUSE_KIT
                set_pdata_int
(idOFFSET_DEFUSE_PLANTiDefuser)

                static const 
defuser[] = "defuser"            
                
message_begin(MSG_ONE_UNRELIABLEg_msgidStatusIcon_id)
                
write_byte(0)
                
write_string(defuser)
                
write_byte(0)
                
write_byte(255)
                
write_byte(0)
                
message_end()
            }
            
set_pdata_int(idOFFSET_TEAM1)
            
set_pdata_int(idOFFSET_INTERNALMODEL4)
        }
        case 
2:
        {
            if(
pev(idpev_weapons) & (1<<CSW_C4))
            {
                
engclient_cmd(id"drop""weapon_c4")
            }
            
set_pdata_int(idOFFSET_TEAM2)
            
set_pdata_int(idOFFSET_INTERNALMODEL6)
        }
    }

    
dllfunc(DLLFunc_ClientUserInfoChangedidengfunc(EngFunc_GetInfoKeyBufferid))

    static const 
szTeamNames[][] = {"TERRORIST""CT"}
    
message_begin(MSG_BROADCASTg_msgidTeamInfo)
    
write_byte(id)
    
write_string(szTeamNames[team-1])
    
message_end()


hi, i'm trying to get this to work, but no luck, it doesn't do its job, can you tell me what can be wrong? )= (i think it doesn't properly hook "team is full" message and takes no action


All times are GMT -4. The time now is 08:59.

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