PHP Code:
public OnClientPutInServer(client)
{
CreateTimer(5.0, Timer_AutoShow, GetClientUserId(client), TIMER_FLAG_NO_MAPCHANGE);
}
public Action:Timer_AutoShow(Handle:timer, any:userid)
{
new client = GetClientOfUserId(userid);
if(client > 0 && IsClientInGame(client))
{
FakeClientCommandEx(client, "sm_join");
}
return Plugin_Handled;
}
This plugin forces a connecting client to use the command specified in FakeClientCommandEx within the time put inside CreateTimer. It works, however the problem I have is that the command is also forced on infected bots.
In this case the command is supposed to make you join the survivor team once you connect, and is intented to be used on players only and not bots. As of now if this plugin is used, the command will be executed not only on the players, but also on the new infected bots that spawn. As a result they will disappear as they tried to join the survivor team, and this also causes the survivor bots to disappear.
This simple plugin wasn't made for L4D2 and I just need someone to make it distinguish between human players and bots, and have the command be executed only on humans.