View Single Post
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#8)
wbyokomo
Zombie Slayer
 
Status: Offline
Posts: 17
Join Date: Apr 2012
Location: Cyberjaya MY
Default Re: [Suggestion] Amxmodx API for YaPB. - 07-05-2016

Fix for this issue:

Well this fix is for ZP4.3Fix5a.
On ZP50 just need to change emessage_begin(MSG_BROADCAST, g_msgScoreInfo) to emessage_begin(MSG_ALL, g_msgScoreInfo) in cs_teams_api.sma

Step by step:
1. Search for UpdateFrags(attacker, victim, frags, deaths, scoreboard) and disable ScoreInfo message for victim:
Code:
// Update Player Frags and Deaths
UpdateFrags(attacker, victim, frags, deaths, scoreboard)
{
    // Set attacker frags
    set_pev(attacker, pev_frags, float(pev(attacker, pev_frags) + frags))
    
    // Set victim deaths
    fm_cs_set_user_deaths(victim, cs_get_user_deaths(victim) + deaths)
    
    // Update scoreboard with attacker and victim info
    if (scoreboard)
    {
        message_begin(MSG_BROADCAST, g_msgScoreInfo)
        write_byte(attacker) // id
        write_short(pev(attacker, pev_frags)) // frags
        write_short(cs_get_user_deaths(attacker)) // deaths
        write_short(0) // class?
        write_short(fm_cs_get_user_team(attacker)) // team
        message_end()
        
        /*message_begin(MSG_BROADCAST, g_msgScoreInfo)
        write_byte(victim) // id
        write_short(pev(victim, pev_frags)) // frags
        write_short(cs_get_user_deaths(victim)) // deaths
        write_short(0) // class?
        write_short(fm_cs_get_user_team(victim)) // team
        message_end()*/
    }
}
2. Search for public fm_cs_set_user_team_msg(taskid) and send ScoreInfo message for target:
Code:
// Send User Team Message
public fm_cs_set_user_team_msg(taskid)
{
    // Note to self: this next message can now be received by other plugins
    
    // Set the switching team flag
    g_switchingteam = true
    
    // Tell everyone my new team
    emessage_begin(MSG_ALL, g_msgTeamInfo)
    ewrite_byte(ID_TEAM) // player
    ewrite_string(CS_TEAM_NAMES[fm_cs_get_user_team(ID_TEAM)]) // team
    emessage_end()
    
    // Fix for AMXX/CZ bots which update team paramater from ScoreInfo message
    emessage_begin(MSG_ALL, g_msgScoreInfo)
    ewrite_byte(ID_TEAM) // id
    ewrite_short(pev(ID_TEAM, pev_frags)) // frags
    ewrite_short(cs_get_user_deaths(ID_TEAM)) // deaths
    ewrite_short(0) // class?
    ewrite_short(fm_cs_get_user_team(ID_TEAM)) // team
    emessage_end()
    
    // Done switching team
    g_switchingteam = false
}
3. Compile your .sma and put in server see the instant team detection even faster than CSBot
  
Reply With Quote