I will use it with a little optimization
Code:
#include <sourcemod>
#include <sdktools>
new bool:SkipEntityCheck = false;
public Plugin:myinfo =
{
name = "CoopDoorAntiClose",
author = "PP(R)TH: Dr. Gregory House",
description = "This prevents the door of the start saferoom to be closed after it is fully opened.",
version = "1.0",
url = "http://forums.alliedmods.net/showthread.php?t=225240"
}
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
{
decl String:gameName[32];
GetGameFolderName(gameName, sizeof(gameName));
if (StrContains(gameName, "left4dead") > -1) return APLRes_Success;
else
{
strcopy(error, err_max, "This plugin only supports L4D(2).");
return APLRes_SilentFailure;
}
}
public OnPluginStart()
{
HookEvent("round_start_pre_entity", Event_RoundEnd);
HookEvent("map_transition", Event_RoundEnd);
}
public Action:Event_RoundEnd(Handle:event, const String:name[], bool:dontBroadcast)
{
SkipEntityCheck = false;
}
public OnEntityCreated(entity, const String:classname[])
{
if (SkipEntityCheck) return;
if (StrEqual(classname, "prop_door_rotating_checkpoint") && GetEntProp(entity, Prop_Send, "m_eDoorState") == 0) HookSingleEntityOutput(entity, "OnFullyOpen", OnStartSFDoorFullyOpened, true);
}
public OnStartSFDoorFullyOpened(const String:output[], caller, activator, Float:delay)
{
AcceptEntityInput(caller, "Lock");
SkipEntityCheck = true;
}