Hi. I'm trying to make a plugin that checks if a specified class is a bot or not while on the class menu.
At the begin i looked
this plugin and got some ideas from it.
This is the code:
Code:
#include <sourcemod>
#include <tf2_stocks>
public OnPluginStart()
{
HookEvent ("player_changeclass", Event_ChangeClass);
}
public Event_ChangeClass(Handle:event, const String:name[], bool:dontBroadcast)
{
new iClient = GetClientOfUserId (GetEventInt (event, "userid")),
iClass = GetEventInt (event, "class"),
iTeam = GetClientTeam (iClient);
PrintToChatAll("Test123 %d",iClass);
if (IsBotIn(iTeam, iClass))
{
PrintToChatAll("BOT SI.");
}
else
{
PrintToChatAll("BOT NO.");
}
}
bool:IsBotIn(iTeam, iClass)
{
int i;
for (i = 0; i <= MAXPLAYERS ; i++)
if(TF2_GetPlayerClass(i) == iClass && GetClientTeam(i) == iTeam)
{
if (IsFakeClient(i))
{
return true;
}
else if (!IsFakeClient(i))
{
return false;
}
break;
}
return false;
}
The problem is that "BOT SI" and "BOT NO" never get printed. What is the problem? I just want to do a specified command if there's a bot using the class chosen on the class menu and another command if there's not. What's wrong?