View Single Post
blacktr4sh
Junior Member
Join Date: Apr 2020
Old 08-04-2020 , 17:20   Re: [TF2] Need help re-creating sv_cheats "bot" command
Reply With Quote #7

Quote:
Originally Posted by SSheriFF View Post
PHP Code:
public Action OnCheatCommand(int client, const char[] commandint argc)
{
    if (
StrEqual(command"bot"))
    {
        
int iBot;
        
char sName[32];
        
int NameArg 0;
        
char sArg[32];
        
char sTeam[32];
        
int TeamArg 0;
        
char sClass[32];
        
int ClassArg 0;
        
int ArgsNum GetCmdArgs();
        for (
int i 1<= ArgsNum;i++)
        {
            
GetCmdArg(isArg32);
            if (
strcmp(sArg"-name") == 0)
                
NameArg = (i+1);
            if (
strcmp(sArg"-team") == 0)
                
TeamArg = (i+1);
               if (
strcmp(sArg"-class") == 0)
                
ClassArg = (i+1);
        }
        if(
NameArg!=0)
        {
            
GetCmdArg(NameArgsName32);
            
iBot CreateFakeClient(sName);
           }
           if(
TeamArg!=0)
        {
            
GetCmdArg(TeamArgsTeam32);
            
TF2_ChangeClientTeam(iBotTF2_GetClientTeam(sTeam));
           }
           if(
ClassArg!=0)
        {
            
GetCmdArg(ClassArgsClass32);
            
//Do your stuff with the class using "sClass" as the class
           
}
    }
    return 
Plugin_Handled;

Wow, thanks very much! I was also just experimenting with loops to try and get the values as well but you were quicker. I will test it out.
blacktr4sh is offline