View Single Post
Re: BOT confusing after transfered
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: BOT confusing after transfered - 26-06-2010

This is not pb mm bug nor issue. This is metamod problem which blocks standard messges sent by other plugins (i.e. amxmodx messages are blocked so pb mm cannot intercept/handle them). You need to ask ptb plugin developer to rewrite it to use emassages. If he is just using set_user_team or cs_set_user team none of metamod bots can see messges sent by those functions. Thus bots don't know they have been transferred into opposite team. Example of working code below.
Code:
(...)
    fm_set_user_team(id, team); // call the function to change the team by the user
    cs_reset_user_model( id );
(...)

stock fm_set_user_team(id, team)
{
    set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX);
    fm_set_user_team_msg(id);
}

// Send User Team Message
public fm_set_user_team_msg(id)
{
    // Beware: this message can now be picked up by other metamod
    // plugins (yeah, that includes AMXX plugins as well)
        
    // Tell everyone my new team
    emessage_begin(MSG_ALL, g_msgTeamInfo)
    ewrite_byte(id)
    switch (fm_get_user_team(id))
    {
        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()
}

stock fm_get_user_team(id)
{
    return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}
  
Reply With Quote