Raised This Month: $ Target: $400
 0% 

Solved CT bots that are respawned after bomb plant are frozen - fix?


Post New Thread Reply   
 
Thread Tools Display Modes
jay7
Senior Member
Join Date: Jun 2004
Old 02-09-2025 , 02:08   Re: CT bots that are respawned after bomb plant are frozen - fix?
Reply With Quote #11

Quote:
Originally Posted by Austin View Post
Here is the code for csgo I don't know anything about Amxmodx and cs 1.6 you will have to translate it. But what is going on is easy to understand and hopefully easy to implement / port to 1.6

All that I am doing to fix this (thanks to everyone) is teleporting bots that are respawned after the bomb plant to the planted bomb and then teleporting them back.

This seems to really fix the stuck problems with them.
I also decided to do this to all bots because all bots knowing where the planted bomb is makes for some interesting game play and defending the planted bomb. All bots rush to the planted bomb on both teams!

PHP Code:
public Action Timer_Respawn(Handle timerany serial)
{
    
int client GetClientFromSerial(serial);
    if (!
g_bRoundEnded &&
            
IsValidClient(client) &&
            
IsClientInGame(client) &&
            !
IsPlayerAlive(client) &&
            (
GetClientTeam(client) == || GetClientTeam(client) == 3)
            )
    {
        
int ent = -1;
        
char name[255];
        
GetClientName(clientname254);

        
// some percent of CT bots spawned after the bomb plant are stuck, wake them up
        //if(IsFakeClient(client) && GetClientTeam(client) == 3 && bombIsPlanted)
        // showing the respawned bots (both teams) where the planted bomb is makes for better game play
        // so do ths for bot t and ct bots.
        
if(IsFakeClient(client) && bombIsPlanted)
        {
            
CS_RespawnPlayer(client);

            
ent = -1;
            
ent FindEntityByClassname(ent"planted_c4");
            if(
ent != -1)
            {
                
float c4_position[3];
                
float player_position[3];
                
GetEntPropVector(ent,            Prop_Send"m_vecOrigin"c4_position);
                
GetEntPropVector(client,    Prop_Send"m_vecOrigin"player_position);
                
TeleportEntity(clientc4_positionNULL_VECTORNULL_VECTOR);
                
                
Event BombPlanted CreateEvent("bomb_planted");
                if(
BombPlanted != null)
                {
                    
SetEventInt(BombPlanted"userid"client);
                    
// DebugLog(bombSite);
                    //bool GiveRealBombSite    = (GetRandomInt(1, 10) <= 7);                    
                    
SetEventInt(BombPlanted"site"bombSite);
                    
FireEvent(BombPlantedtrue);
                }
                
TeleportEntity(clientplayer_positionNULL_VECTORNULL_VECTOR);
            }
        }
        else
        {
            
CS_RespawnPlayer(client);
            
ent = -1;
            
ent FindEntityByClassname(ent"weapon_c4");
            if(
ent != -&& (GetRandomInt(110) <= 7))
            {
                
//DebugLog("Found weapon_c4");
                
float c4_position[3];
                
float player_position[3];
                
GetEntPropVector(ent,            Prop_Send"m_vecOrigin"c4_position);
                
GetEntPropVector(client,    Prop_Send"m_vecOrigin"player_position);
                
TeleportEntity(clientc4_positionNULL_VECTORNULL_VECTOR);
                
TeleportEntity(clientplayer_positionNULL_VECTORNULL_VECTOR);
            }            
        }

        if(
GetClientTeam(client) == CS_TEAM_T)
            
CPrintToChatAll(" {orange}* Respawned - {red}%s - {purple}%3.0f"nameg_respawn_time.FloatValue);
        else
            
CPrintToChatAll(" {orange}* Respawned - {blue}%s - {purple}%3.0f"nameg_respawn_time.FloatValue);

        
// V01 - 1.0
        // each respawn increases the respawn time up to 12 seconds
        
g_respawn_time.FloatValue += 1.0;
        if(
g_respawn_time.FloatValue 15.0)
            
g_respawn_time.FloatValue 15.0;
    }

Thank you Austin! There is someone working on / port and there’s definitely usable code here. Seems like valve never caught on since the first cs version and never tried to support this game modes where it matters.
jay7 is offline
Austin
Senior Member
Join Date: Oct 2005
Old 02-10-2025 , 10:32   Re: CT bots that are respawned after bomb plant are frozen - fix?
Reply With Quote #12

25 years from now someone will be still running 1.6 and asking about this!


Edit:
Also, I don't know why I didn't post the entire plugin so here it is.
Attached Files
File Type: sp Get Plugin or Get Source (ABS_CSGO_Respawn.sp - 10 views - 6.1 KB)

Last edited by Austin; 02-11-2025 at 15:25.
Austin is offline
Reply


Thread Tools
Display Modes

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


All times are GMT -4. The time now is 20:33.


Powered by vBulletin®
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Theme made by Freecode