Thread: Bot check team
View Single Post
Re: Bot check team
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Bot check team - 19-04-2012

Ask to amxmodx plugin writers to use emessages to transfer the player to the team, instead using standard functions cs_set_user_team, which sends normal messages (those cannot be hooked out of amxmodx.dll - by other mm plugins). Emessages aren't blocked by metamod, so bots code perfectly knows the exact moment of transfering the player to the team. I'm not going to change the bot code only because of that amxx scripters don't know how metamod works.
Code example:
Code:
// Set a Player's Team
stock fm_set_user_team(id, team)
{
    set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX);
} 

(...)
//some function here...
        // Switch to CT
        if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
        {        
            fm_set_user_team(id, CS_TEAM_CT)
            fm_set_user_team_msg(id+TEAM_TASK)
        }
(...)

// Send User Team Message
public fm_set_user_team_msg(taskid)
{    
    // Beware: this message can now be picked up by other metamod
    // plugins (yeah, that includes AMXX plugins as well)
    
    // Set the switching team flag
    g_switchingteam[ID_TEAM] = true;
    
    // Tell everyone my new team
    emessage_begin(MSG_ALL, g_msgTeamInfo)
    ewrite_byte(ID_TEAM)
    
    switch (fm_get_user_team(ID_TEAM))
    {
        case CS_TEAM_UNASSIGNED: ewrite_string("UNASSIGNED");
        case CS_TEAM_T: ewrite_string("TERRORIST");
        case CS_TEAM_CT: ewrite_string("CT");
        case CS_TEAM_SPECTATOR: ewrite_string("SPECTATOR");
    }
    
    emessage_end()
    
    // Done switching team
    g_switchingteam[ID_TEAM] = false;
}
Show them the example of the code above and they should know how to use it.
  
Reply With Quote