.:: Bots United ::.  
filebase forums discord server github wiki web
cubebot epodbot fritzbot gravebot grogbot hpbbot ivpbot jkbotti joebot
meanmod podbotmm racc rcbot realbot sandbot shrikebot soulfathermaps yapb

Go Back   .:: Bots United ::. > Cyborg Factory > YaPB
YaPB Yet another POD-Bot flavor by Whistler and Jeefo Counter-Strike

Reply
 
Thread Tools
[Suggestion] Amxmodx API for YaPB.
Old
  (#1)
wbyokomo
Zombie Slayer
 
Status: Offline
Posts: 17
Join Date: Apr 2012
Location: Cyberjaya MY
Thumbs up [Suggestion] Amxmodx API for YaPB. - 04-11-2015

Hi, i like this bot very much it works fine on server, but it has some issues on cs1.6 custom mod like ZombieMod, Biohazard and any other mods that use instant team changes.

Issues:
1. Team detection
- In Zombie Plague Mod when zombie(TR player) infect a human(CT player) the CT player will change team to TR, but this player won't attack any other CT player, it will still attacking the Zombie player(TR).

2. Knife attack distance
- This is known issue on podbot too, since we are running Zombie Plague Mod, the zombies only have 1 weapon (knife). So when it get close to Humans (CT), the humans will use knife too and start a knife battle lol.

My suggestions:
1. Implement a better way to set CS1.6 team, use m_iTeam (114) offset.
2. Create AmxModx API to set/get enemy target, knife attack distance. So with this API server owner can code a simple amxx plugin to make YaPB more compatible to any CS1.6 custom mods.

You can see this custom YaPB, it has AmxModx API features.
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#2)
wbyokomo
Zombie Slayer
 
Status: Offline
Posts: 17
Join Date: Apr 2012
Location: Cyberjaya MY
Default Re: [Suggestion] Amxmodx API for YaPB. - 04-11-2015

I see in bool Bot::LookupEnemy (void) you are using a var to retrieve player team.

PHP Code:
      // search the world for players...
      
for (int i 0GetMaxClients (); i++)
      {
         if (!(
g_clients[i].flags CF_USED) || !(g_clients[i].flags CF_ALIVE) || (g_clients[i].team == m_team) || (g_clients[i].ent == GetEntity ()))
            continue; 
It would be good if you add an API to get/set internal player team too.
Example:
yb_get_player_team(index)
yb_set_player_team(index, m_team)
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#3)
jeefo
путинхуйлоебаное
 
jeefo's Avatar
 
Status: Offline
Posts: 453
Join Date: Nov 2005
Location: Saint-Petersburg
Default Re: [Suggestion] Amxmodx API for YaPB. - 04-11-2015

Hello!

Offset is not used, to ensure that futures CS 1.6 updates (if any) will not break bot compatibility.

You can force bot to get valid TeamId by sending TeamInfo message manually, when needed.

About the API, you have found SyPB Bot. I'm not sure, that yapb needs this.
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#4)
wbyokomo
Zombie Slayer
 
Status: Offline
Posts: 17
Join Date: Apr 2012
Location: Cyberjaya MY
Default Re: [Suggestion] Amxmodx API for YaPB. - 04-11-2015

Quote:
Originally Posted by jeefo View Post
Hello!

Offset is not used, to ensure that futures CS 1.6 updates (if any) will not break bot compatibility.

You can force bot to get valid TeamId by sending TeamInfo message manually, when needed.

About the API, you have found SyPB Bot. I'm not sure, that yapb needs this.
Sad.. but that SyPB eat too much cpu usage. I prefer YaPB.
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#5)
Krtola
Member
 
Status: Offline
Posts: 24
Join Date: Nov 2015
Default Re: [Suggestion] Amxmodx API for YaPB. - 04-11-2015

The same problem I noticed on my zombie mod(biohazard).
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#6)
wbyokomo
Zombie Slayer
 
Status: Offline
Posts: 17
Join Date: Apr 2012
Location: Cyberjaya MY
Default Re: [Suggestion] Amxmodx API for YaPB. - 04-11-2015

I found the reason why yapb failed to instantly detect team change, it because TeamInfo message cannot be read by any other metamod module.

I tried to send TeamInfo message via emessage_begin but it failed too.

So i found a silly method to fix this issue, but it need to modify our custom cs1.6 mod, example in Zombie Plague and Biohazard.

Here is an example of fix:
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <cstrike>
#include <fun>

#define PLUGIN "Silly Fix"
#define VERSION "0.0.1"
#define AUTHOR "wbyokomo"

new bool:bTeamChangeSpawn[33], iOrigin[33][3]

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
RegisterHam(Ham_Spawn"player""OnSpawnPost"1)
}

public 
client_putinserver(id)
{
    
bTeamChangeSpawn[id] = false //reset flag
}

public 
OnSpawnPost(id)
{
    
//stop here if changing team
    
if(bTeamChangeSpawn[id])
    {
        
bTeamChangeSpawn[id] = false
        
return;
    }
    
    
//our new post actions
    
if(!is_user_alive(id)) return;

    if(
cs_get_user_team(id) != CS_TEAM_CTSetPlayerTeam(idCS_TEAM_CT);
}

//silly team changer fix
SetPlayerTeam(idCsTeams:team)
{
    
bTeamChangeSpawn[id] = true //mark team change flag
    
get_user_origin(idiOrigin[id]) //get current origin
    
cs_set_user_team(idteamCS_NORESET//set our new team
    
ExecuteHam(Ham_CS_RoundRespawnid//call round respawn, in order to update TeamInfo, using emessage_begin is useless too. metamod still can't retrieve it. Use ExecuteHam not ExecuteHamB
    
set_user_origin(idiOrigin[id]) //set back our origin
    //you need to add unstuck code here sometime our origin will stuck.

I know this is not efficient but at least it working and bot instantly can detect new team changes. Fast target change is awesome
  
Reply With Quote
Re: [Suggestion] Amxmodx API for YaPB.
Old
  (#7)
Krtola
Member
 
Status: Offline
Posts: 24
Join Date: Nov 2015
Default Re: [Suggestion] Amxmodx API for YaPB. - 28-02-2016

undefined symbol "CS_NORESET"

Whan to do now?
  
Reply With Quote
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
Reply

Tags
amxmodx api request.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com