View Single Post
Author Message
doublejz
Junior Member
Join Date: Mar 2022
Old 04-06-2022 , 18:22   Persistent Bot Named XYZ
Reply With Quote #1

So long story short one of our old time members has past away. In tribute we've been trying to come up with a way to always have a bot named after him. Currently we have the bot quota set to 5 followed by the bot_add XYZ which works and keeps 6 bots in the server until players join.

When a player joins, there is that chance that bot XYZ gets kicked leaving the other bots in the server.

What we are trying to do is:
Determine if bot(s) are present and if so, check to see if one of them is named XYZ. If there isn't then we would rename a random bot to XYZ.

I might be going about this all wrong but this was my initial thought process. Any help is appreciated, as I'm trying to get back into scripting here after being absent for ~10+ years.

PHP Code:
public OnPluginStart()
{
    
HookEvent("round_start"OnRoundStartEventHookMode_PostNoCopy);
}

public 
OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    
decl String:t_name[64];
    
Format(t_namesizeof(t_name), "Name");
    new 
count 0;
    for (new 
1<= MaxClientsi++)
    {
    if(
IsClientInGame(i))
        {
        
count++;
        
GetClientName(it_namesizeof(t_name));
/*
*        Store somewhere?? array??? how??
*/
        
}
    }
/*    Test output to see if [BOT] was found and if any are named XYZ
*    If [BOT] was found but not XYZ, rename a bot with [BOT]-?????? to [BOT]-XYZ
*    sm_rename i "[Bot]-XYZ"
*/
       
else
       
       return 
Plugin_Handled;

doublejz is offline