View Single Post
Re: Transfering alive bot to the other team
Old
  (#2)
KWo
Developer of PODBot mm
 
KWo's Avatar
 
Status: Offline
Posts: 3,425
Join Date: Apr 2004
Default Re: Transfering alive bot to the other team - 03-11-2010

This is Your custom plugin's problem, not podbot mm problem. Actually it comes from metamod which blocks messages sent by other mm plugins. So AMX X is sending TeamInfo messages, but they cannot be captured by podbot mm (this is how metamod works). To skip that problem AMX X coders have to use emessages - those aren't blocked by metamod.
Example of code:
Code:
(...)
        // Turn the rest of players into humans
        for (id = 1; id <= g_maxplayers; id++)
        {
            // Only those of them who aren't zombies
            if (!is_user_alive(id) || g_zombie[id])
                continue
            
            // Remove previous tasks
            remove_task(id+TASK_TEAM)
            
            // Switch to CT
            if (fm_get_user_team(id) != CS_TEAM_CT) // need to change team?
            {
                fm_set_user_team(id, CS_TEAM_CT)
                set_task(0.1+g_teams_i, "fm_set_user_team_msg", id+TASK_TEAM)
                g_teams_i += 0.1; // increase teams task counter
            }
        }
(...)
// Get User Team
stock fm_get_user_team(id)
{
    return get_pdata_int(id, OFFSET_CSTEAMS, OFFSET_LINUX);
}

// Set a Player's Team
stock fm_set_user_team(id, team)
{
    set_pdata_int(id, OFFSET_CSTEAMS, team, OFFSET_LINUX);
}

// 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;
}
  
Reply With Quote