Bot Clan Tags [SourceMod {CSS}]

Forum rules
- Ask questions about or share code from languages other than Source Engine scripting.
- Start new topic titles with the code language in brackets (i.e. [C#], [C++], [PHP], etc.)
User avatar
Blake
500+ Posts
500+ Posts
Posts: 588
Joined: Mon Jul 05, 2010 8:51 pm
Location: Ontario, Canada

Bot Clan Tags [SourceMod {CSS}]

Post by Blake »

Required Includes for Compile & Game Data

Source Mod Code

Code: Select all

#include <sourcemod>
#include <sdktools>
#include <cssclantags>

new g_iMaxClients		= 0;
new Float:g_fTimer		= 0.0;
new Handle:g_hBotClanTag = INVALID_HANDLE;
new GameType;

#define PLUGIN_VERSION "1.0.1"

public Plugin:myinfo =
{
	name = "Bot Clan Tag",
	author = "Smacked",
	description = "Changes the clan of a BOT on the scoreboard",
	version = PLUGIN_VERSION,
	url = "N/A"
};

public OnPluginStart()
{
	g_hBotClanTag = CreateConVar("bot_clantag", "BOT", "Bot ClanTag");
	
	new String:szBuffer[100];
	GetGameFolderName(szBuffer, sizeof(szBuffer));
	
	if(StrEqual("cstrike", szBuffer))
		GameType = true;
	else if(StrEqual("dod", szBuffer))
		GameType = false;
	else
	GameType = false;
}

public OnMapStart()
{
	g_iMaxClients		= GetMaxClients();
	g_fTimer			= 0.0;
}

public OnGameFrame()
{
	if(g_fTimer < GetGameTime() - 0.1)
	{
		g_fTimer = GetGameTime();
		
		for(new i = 1; i <= g_iMaxClients; i++)
		{
			if(!IsValidEdict(i) || !IsClientInGame(i) || !IsFakeClient(i))
				continue;
			
			if (GameType && IsFakeClient(i))
			{
				new String:Tag[255];
				GetConVarString(g_hBotClanTag, Tag, sizeof(Tag));
				CS_SetClientClanTag(i, Tag);
			}
		}
	}
}

Unkown wrote: Life’s too short to worry about the little things.
Albert Einstein wrote: You do not really understand something unless you can explain it to your grandmother.