Code:
#include <sourcemod>
#include <sdktools>
#include <tf2_stocks>
#include <tf2>
new iTeamIndex = 3; // 2
public OnPluginStart()
HookEvent("player_spawn", OnPlayerSpawn);
public Action:OnPlayerSpawn(Handle:event, const String:name[], bool:dontBroadcast)
{
new client = GetClientOfUserId(GetEventInt(event, "userid"));
if(!IsPlayerAlive(client))
return;
if(GetClientTeam(client) != iTeamIndex)
{
SetEntProp(client, Prop_Send, "m_lifeState", 2);
ChangeClientTeam(client, iTeamIndex);
SetEntProp(client, Prop_Send, "m_lifeState", 0);
}
if(TF2_GetPlayerClass(client) != TFClass_Soldier)
{
TF2_SetPlayerClass(client, TFClass_Soldier, false);
TF2_RegeneratePlayer(client);
}
}