|
Junior Member
|
08-04-2020
, 17:20
Re: [TF2] Need help re-creating sv_cheats "bot" command
|
#7
|
Quote:
Originally Posted by SSheriFF
PHP Code:
public Action OnCheatCommand(int client, const char[] command, int 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; i <= ArgsNum;i++)
{
GetCmdArg(i, sArg, 32);
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(NameArg, sName, 32);
iBot = CreateFakeClient(sName);
}
if(TeamArg!=0)
{
GetCmdArg(TeamArg, sTeam, 32);
TF2_ChangeClientTeam(iBot, TF2_GetClientTeam(sTeam));
}
if(ClassArg!=0)
{
GetCmdArg(ClassArg, sClass, 32);
//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.
|
|
|
|