#include <sourcemod>
#include <cstrike>

public Plugin:myinfo = 
{
	name = "Teamcolors",
	author = "Jackmaster",
	description = "changes the teamcolors",
	version = "1.0",
	url = "hd-gamer.de & internationalmultigaming.de"
}

public OnPluginStart()
{
	// hooks
	HookEvent("player_spawn", EventPlayerSpawn)
}

//spawnhook
public Action:EventPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client = GetClientOfUserId(GetEventInt(event, "userid"));
	
	if (client == 0)
		return;
	
	if (IsClientInGame(client) && IsPlayerAlive(client))
	{
		if (GetClientTeam(client) == CS_TEAM_CT)
		{
			SetEntityRenderMode(client, RENDER_TRANSCOLOR);
			// blue
			SetEntityRenderColor(client, 0, 0, 255, 255);
		}
		if (GetClientTeam(client) == CS_TEAM_T)
		{
			SetEntityRenderMode(client, RENDER_TRANSCOLOR);
			// red
			SetEntityRenderColor(client, 255, 0, 0, 255);
		}
	}
}
