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_msgidStatusIcon, g_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(2, team, 11) if(team[10] == 'T') { if( get_pdata_int(id, OFFSET_TEAM) != 1) { cs_set_user_team(id, 1) } } else if(team[10] == 'C') { if( get_pdata_int(id, OFFSET_TEAM) != 2) { cs_set_user_team(id, 2) } } }
cs_set_user_team(id, team) { switch(team) { case 1: { new iDefuser = get_pdata_int(id, OFFSET_DEFUSE_PLANT) if(iDefuser & HAS_DEFUSE_KIT) { iDefuser -= HAS_DEFUSE_KIT set_pdata_int(id, OFFSET_DEFUSE_PLANT, iDefuser)
static const defuser[] = "defuser" message_begin(MSG_ONE_UNRELIABLE, g_msgidStatusIcon, _, id) write_byte(0) write_string(defuser) write_byte(0) write_byte(255) write_byte(0) message_end() } set_pdata_int(id, OFFSET_TEAM, 1) set_pdata_int(id, OFFSET_INTERNALMODEL, 4) } case 2: { if(pev(id, pev_weapons) & (1<<CSW_C4)) { engclient_cmd(id, "drop", "weapon_c4") } set_pdata_int(id, OFFSET_TEAM, 2) set_pdata_int(id, OFFSET_INTERNALMODEL, 6) } }
dllfunc(DLLFunc_ClientUserInfoChanged, id, engfunc(EngFunc_GetInfoKeyBuffer, id))
static const szTeamNames[][] = {"TERRORIST", "CT"} message_begin(MSG_BROADCAST, g_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
|